| Flutter Linux Embedder |

Functions
fl_method_response_test.cc File Reference
`#include "flutter/shell/platform/linux/public/flutter_linux/fl_method_response.h"`
`#include "gtest/gtest.h"`

Go to the source code of this file.

## Functions
| TEST (FlMethodResponseTest, Success)
| TEST (FlMethodResponseTest, Error)
| TEST (FlMethodResponseTest, ErrorMessage)
| TEST (FlMethodResponseTest, ErrorDetails)
| TEST (FlMethodResponseTest, ErrorMessageAndDetails)
| TEST (FlMethodResponseTest, NotImplemented)
| TEST (FlMethodResponseTest, SuccessGetResult)
| TEST (FlMethodResponseTest, ErrorGetResult)
| TEST (FlMethodResponseTest, NotImplementedGetResult)

## Function Documentation

## ◆ TEST() [1/9]

TEST | ( | FlMethodResponseTest | ,
|  | Error |
| ) |  |

Definition at line 17 of file fl_method_response_test.cc.

17 {
18 g_autoptr(FlMethodErrorResponse) response =
19 fl_method_error_response_new("code", nullptr, nullptr);
20 EXPECT_STREQ(fl_method_error_response_get_code(response), "code");
21 EXPECT_EQ(fl_method_error_response_get_message(response), nullptr);
22 EXPECT_EQ(fl_method_error_response_get_details(response), nullptr);
23 }
g_autoptr
g_autoptr(FlEngine) engine
fl_method_error_response_new
G_MODULE_EXPORT FlMethodErrorResponse * fl_method_error_response_new(const gchar *code, const gchar *message, FlValue *details)
Definition: fl_method_response.cc:144
fl_method_error_response_get_code
G_MODULE_EXPORT const gchar * fl_method_error_response_get_code(FlMethodErrorResponse *self)
Definition: fl_method_response.cc:160
fl_method_error_response_get_message
G_MODULE_EXPORT const gchar * fl_method_error_response_get_message(FlMethodErrorResponse *self)
Definition: fl_method_response.cc:166
fl_method_error_response_get_details
G_MODULE_EXPORT FlValue * fl_method_error_response_get_details(FlMethodErrorResponse *self)
Definition: fl_method_response.cc:172

References fl_method_error_response_get_code(), fl_method_error_response_get_details(), fl_method_error_response_get_message(), fl_method_error_response_new(), and g_autoptr().

## ◆ TEST() [2/9]

TEST | ( | FlMethodResponseTest | ,
|  | ErrorDetails |
| ) |  |

Definition at line 33 of file fl_method_response_test.cc.

33 {
34 g_autoptr(FlValue) details = fl_value_new_int(42);
35 g_autoptr(FlMethodErrorResponse) response =
36 fl_method_error_response_new("code", nullptr, details);
37 EXPECT_STREQ(fl_method_error_response_get_code(response), "code");
38 EXPECT_EQ(fl_method_error_response_get_message(response), nullptr);
39 g_autoptr(FlValue) expected_details = fl_value_new_int(42);
40 EXPECT_TRUE(fl_value_equal(fl_method_error_response_get_details(response),
41 expected_details));
42 }
fl_value_equal
G_MODULE_EXPORT bool fl_value_equal(FlValue *a, FlValue *b)
Definition: fl_value.cc:471
fl_value_new_int
G_MODULE_EXPORT FlValue * fl_value_new_int(int64_t value)
Definition: fl_value.cc:262
FlValue
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:42

References fl_method_error_response_get_code(), fl_method_error_response_get_details(), fl_method_error_response_get_message(), fl_method_error_response_new(), fl_value_equal(), fl_value_new_int(), and g_autoptr().

## ◆ TEST() [3/9]

TEST | ( | FlMethodResponseTest | ,
|  | ErrorGetResult |
| ) |  |

Definition at line 76 of file fl_method_response_test.cc.

76 {
77 g_autoptr(FlMethodErrorResponse) response =
78 fl_method_error_response_new("code", nullptr, nullptr);
79 g_autoptr(GError) error = nullptr;
80 g_autoptr(FlValue) result =
81 fl_method_response_get_result(FL_METHOD_RESPONSE(response), &error);
82 EXPECT_EQ(result, nullptr);
83 EXPECT_TRUE(g_error_matches(error, FL_METHOD_RESPONSE_ERROR,
84 FL_METHOD_RESPONSE_ERROR_REMOTE_ERROR));
85 }
fl_method_response_get_result
G_MODULE_EXPORT FlValue * fl_method_response_get_result(FlMethodResponse *self, GError **error)
Definition: fl_method_response.cc:82
FL_METHOD_RESPONSE_ERROR_REMOTE_ERROR
@ FL_METHOD_RESPONSE_ERROR_REMOTE_ERROR
Definition: fl_method_response.h:34
FL_METHOD_RESPONSE_ERROR
#define FL_METHOD_RESPONSE_ERROR
Definition: fl_method_response.h:30
error
const uint8_t uint32_t uint32_t GError ** error
Definition: fl_pixel_buffer_texture_test.cc:40

References error, fl_method_error_response_new(), FL_METHOD_RESPONSE_ERROR, FL_METHOD_RESPONSE_ERROR_REMOTE_ERROR, fl_method_response_get_result(), and g_autoptr().

## ◆ TEST() [4/9]

TEST | ( | FlMethodResponseTest | ,
|  | ErrorMessage |
| ) |  |

Definition at line 25 of file fl_method_response_test.cc.

25 {
26 g_autoptr(FlMethodErrorResponse) response =
27 fl_method_error_response_new("code", "message", nullptr);
28 EXPECT_STREQ(fl_method_error_response_get_code(response), "code");
29 EXPECT_STREQ(fl_method_error_response_get_message(response), "message");
30 EXPECT_EQ(fl_method_error_response_get_details(response), nullptr);
31 }

References fl_method_error_response_get_code(), fl_method_error_response_get_details(), fl_method_error_response_get_message(), fl_method_error_response_new(), and g_autoptr().

## ◆ TEST() [5/9]

TEST | ( | FlMethodResponseTest | ,
|  | ErrorMessageAndDetails |
| ) |  |

Definition at line 44 of file fl_method_response_test.cc.

44 {
45 g_autoptr(FlValue) details = fl_value_new_int(42);
46 g_autoptr(FlMethodErrorResponse) response =
47 fl_method_error_response_new("code", "message", details);
48 EXPECT_STREQ(fl_method_error_response_get_code(response), "code");
49 EXPECT_STREQ(fl_method_error_response_get_message(response), "message");
50 g_autoptr(FlValue) expected_details = fl_value_new_int(42);
51 EXPECT_TRUE(fl_value_equal(fl_method_error_response_get_details(response),
52 expected_details));
53 }

References fl_method_error_response_get_code(), fl_method_error_response_get_details(), fl_method_error_response_get_message(), fl_method_error_response_new(), fl_value_equal(), fl_value_new_int(), and g_autoptr().

## ◆ TEST() [6/9]

TEST | ( | FlMethodResponseTest | ,
|  | NotImplemented |
| ) |  |

Definition at line 55 of file fl_method_response_test.cc.

55 {
56 g_autoptr(FlMethodNotImplementedResponse) response =
57 fl_method_not_implemented_response_new();
58 // Trivial check to stop the compiler deciding that 'response' is an unused
59 // variable.
60 EXPECT_TRUE(FL_IS_METHOD_NOT_IMPLEMENTED_RESPONSE(response));
61 }
fl_method_not_implemented_response_new
G_MODULE_EXPORT FlMethodNotImplementedResponse * fl_method_not_implemented_response_new()
Definition: fl_method_response.cc:179

References fl_method_not_implemented_response_new(), and g_autoptr().

## ◆ TEST() [7/9]

TEST | ( | FlMethodResponseTest | ,
|  | NotImplementedGetResult |
| ) |  |

Definition at line 87 of file fl_method_response_test.cc.

87 {
88 g_autoptr(FlMethodNotImplementedResponse) response =
89 fl_method_not_implemented_response_new();
90 g_autoptr(GError) error = nullptr;
91 g_autoptr(FlValue) result =
92 fl_method_response_get_result(FL_METHOD_RESPONSE(response), &error);
93 EXPECT_EQ(result, nullptr);
94 EXPECT_TRUE(g_error_matches(error, FL_METHOD_RESPONSE_ERROR,
95 FL_METHOD_RESPONSE_ERROR_NOT_IMPLEMENTED));
96 }
FL_METHOD_RESPONSE_ERROR_NOT_IMPLEMENTED
@ FL_METHOD_RESPONSE_ERROR_NOT_IMPLEMENTED
Definition: fl_method_response.h:35

References error, fl_method_not_implemented_response_new(), FL_METHOD_RESPONSE_ERROR, FL_METHOD_RESPONSE_ERROR_NOT_IMPLEMENTED, fl_method_response_get_result(), and g_autoptr().

## ◆ TEST() [8/9]

TEST | ( | FlMethodResponseTest | ,
|  | Success |
| ) |  |

Definition at line 8 of file fl_method_response_test.cc.

8 {
9 g_autoptr(FlValue) result = fl_value_new_int(42);
10 g_autoptr(FlMethodSuccessResponse) response =
11 fl_method_success_response_new(result);
12 g_autoptr(FlValue) expected = fl_value_new_int(42);
13 ASSERT_TRUE(fl_value_equal(fl_method_success_response_get_result(response),
14 expected));
15 }
fl_method_success_response_new
G_MODULE_EXPORT FlMethodSuccessResponse * fl_method_success_response_new(FlValue *result)
Definition: fl_method_response.cc:126
fl_method_success_response_get_result
G_MODULE_EXPORT FlValue * fl_method_success_response_get_result(FlMethodSuccessResponse *self)
Definition: fl_method_response.cc:138

References fl_method_success_response_get_result(), fl_method_success_response_new(), fl_value_equal(), fl_value_new_int(), and g_autoptr().

## ◆ TEST() [9/9]

TEST | ( | FlMethodResponseTest | ,
|  | SuccessGetResult |
| ) |  |

Definition at line 63 of file fl_method_response_test.cc.

63 {
64 g_autoptr(FlValue) r = fl_value_new_int(42);
65 g_autoptr(FlMethodSuccessResponse) response =
66 fl_method_success_response_new(r);
67 g_autoptr(GError) error = nullptr;
68 FlValue* result =
69 fl_method_response_get_result(FL_METHOD_RESPONSE(response), &error);
70 ASSERT_NE(result, nullptr);
71 EXPECT_EQ(error, nullptr);
72 g_autoptr(FlValue) expected = fl_value_new_int(42);
73 ASSERT_TRUE(fl_value_equal(result, expected));
74 }

References error, fl_method_response_get_result(), fl_method_success_response_new(), fl_value_equal(), fl_value_new_int(), and g_autoptr().