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 29 of file fl_platform_plugin_test.cc.

Member Typedef Documentation

◆ is_gtest_matcher [1/2]

Definition at line 31 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 33 of file fl_platform_plugin_test.cc.

35  : 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 68 of file fl_platform_plugin_test.cc.

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

◆ 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 61 of file fl_platform_plugin_test.cc.

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

◆ 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 37 of file fl_platform_plugin_test.cc.

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

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