Flutter Linux Embedder
MethodCallMatcher Class Reference

Public Types

using is_gtest_matcher = void
 
using is_gtest_matcher = void
 

Public Member Functions

 MethodCallMatcher (::testing::Matcher< std::string > name, ::testing::Matcher< FlValue * > args)
 
bool MatchAndExplain (GBytes *method_call, ::testing::MatchResultListener *result_listener) const
 
void DescribeTo (std::ostream *os) const
 
void DescribeNegationTo (std::ostream *os) const
 
 MethodCallMatcher (::testing::Matcher< std::string > name, ::testing::Matcher< FlValue * > args)
 
bool MatchAndExplain (GBytes *method_call, ::testing::MatchResultListener *result_listener) const
 
void DescribeTo (std::ostream *os) const
 
void DescribeNegationTo (std::ostream *os) const
 

Detailed Description

Definition at line 31 of file fl_platform_plugin_test.cc.

Member Typedef Documentation

◆ is_gtest_matcher [1/2]

Definition at line 33 of file fl_platform_plugin_test.cc.

◆ is_gtest_matcher [2/2]

Definition at line 45 of file fl_text_input_plugin_test.cc.

Constructor & Destructor Documentation

◆ MethodCallMatcher() [1/2]

MethodCallMatcher::MethodCallMatcher ( ::testing::Matcher< std::string >  name,
::testing::Matcher< FlValue * >  args 
)
inlineexplicit

Definition at line 35 of file fl_platform_plugin_test.cc.

37  : name_(std::move(name)), args_(std::move(args)) {}

◆ MethodCallMatcher() [2/2]

MethodCallMatcher::MethodCallMatcher ( ::testing::Matcher< std::string >  name,
::testing::Matcher< FlValue * >  args 
)
inlineexplicit

Definition at line 47 of file fl_text_input_plugin_test.cc.

49  : name_(std::move(name)), args_(std::move(args)) {}

Member Function Documentation

◆ DescribeNegationTo() [1/2]

void MethodCallMatcher::DescribeNegationTo ( std::ostream *  os) const
inline

Definition at line 70 of file fl_platform_plugin_test.cc.

70  {
71  *os << "method name ";
72  name_.DescribeNegationTo(os);
73  *os << " or args ";
74  args_.DescribeNegationTo(os);
75  }

◆ DescribeNegationTo() [2/2]

void MethodCallMatcher::DescribeNegationTo ( std::ostream *  os) const
inline

Definition at line 82 of file fl_text_input_plugin_test.cc.

82  {
83  *os << "method name ";
84  name_.DescribeNegationTo(os);
85  *os << " or args ";
86  args_.DescribeNegationTo(os);
87  }

◆ DescribeTo() [1/2]

void MethodCallMatcher::DescribeTo ( std::ostream *  os) const
inline

Definition at line 63 of file fl_platform_plugin_test.cc.

63  {
64  *os << "method name ";
65  name_.DescribeTo(os);
66  *os << " and args ";
67  args_.DescribeTo(os);
68  }

◆ DescribeTo() [2/2]

void MethodCallMatcher::DescribeTo ( std::ostream *  os) const
inline

Definition at line 75 of file fl_text_input_plugin_test.cc.

75  {
76  *os << "method name ";
77  name_.DescribeTo(os);
78  *os << " and args ";
79  args_.DescribeTo(os);
80  }

◆ MatchAndExplain() [1/2]

bool MethodCallMatcher::MatchAndExplain ( GBytes *  method_call,
::testing::MatchResultListener *  result_listener 
) const
inline

Definition at line 39 of file fl_platform_plugin_test.cc.

40  {
41  g_autoptr(FlJsonMethodCodec) codec = fl_json_method_codec_new();
42  g_autoptr(GError) error = nullptr;
43  g_autofree gchar* name = nullptr;
44  g_autoptr(FlValue) args = nullptr;
46  FL_METHOD_CODEC(codec), method_call, &name, &args, &error);
47  if (!result) {
48  *result_listener << ::testing::PrintToString(error->message);
49  return false;
50  }
51  if (!name_.MatchAndExplain(name, result_listener)) {
52  *result_listener << " where the name doesn't match: \"" << name << "\"";
53  return false;
54  }
55  if (!args_.MatchAndExplain(args, result_listener)) {
56  *result_listener << " where the args don't match: "
57  << ::testing::PrintToString(args);
58  return false;
59  }
60  return true;
61  }

References args, error, fl_json_method_codec_new(), fl_method_codec_decode_method_call(), method_call, and result.

◆ MatchAndExplain() [2/2]

bool MethodCallMatcher::MatchAndExplain ( GBytes *  method_call,
::testing::MatchResultListener *  result_listener 
) const
inline

Definition at line 51 of file fl_text_input_plugin_test.cc.

52  {
53  g_autoptr(FlJsonMethodCodec) codec = fl_json_method_codec_new();
54  g_autoptr(GError) error = nullptr;
55  g_autofree gchar* name = nullptr;
56  g_autoptr(FlValue) args = nullptr;
58  FL_METHOD_CODEC(codec), method_call, &name, &args, &error);
59  if (!result) {
60  *result_listener << ::testing::PrintToString(error->message);
61  return false;
62  }
63  if (!name_.MatchAndExplain(name, result_listener)) {
64  *result_listener << " where the name doesn't match: \"" << name << "\"";
65  return false;
66  }
67  if (!args_.MatchAndExplain(args, result_listener)) {
68  *result_listener << " where the args don't match: "
69  << ::testing::PrintToString(args);
70  return false;
71  }
72  return true;
73  }

References args, error, fl_json_method_codec_new(), fl_method_codec_decode_method_call(), method_call, and result.


The documentation for this class was generated from the following files:
fl_json_method_codec_new
G_MODULE_EXPORT FlJsonMethodCodec * fl_json_method_codec_new()
Definition: fl_json_method_codec.cc:205
FlValue
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:40
method_call
G_BEGIN_DECLS G_MODULE_EXPORT FlMethodCall * method_call
Definition: fl_method_channel.h:120
fl_method_codec_decode_method_call
gboolean fl_method_codec_decode_method_call(FlMethodCodec *self, GBytes *message, gchar **name, FlValue **args, GError **error)
Definition: fl_method_codec.cc:27
result
GAsyncResult * result
Definition: fl_text_input_plugin.cc:106
args
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
Definition: fl_event_channel.h:89
error
const uint8_t uint32_t uint32_t GError ** error
Definition: fl_pixel_buffer_texture_test.cc:40