7#import <OCMock/OCMock.h>
13#include "gtest/gtest.h"
23 id messenger = OCMProtocolMock(
@protocol(FlutterBinaryMessenger));
26 EXPECT_NE(relay, nil);
27 EXPECT_EQ(messenger, relay.
parent);
30- (void)testPassesCallOn {
31 id messenger = OCMProtocolMock(
@protocol(FlutterBinaryMessenger));
34 char messageData[] = {
'a',
'a',
'r',
'o',
'n'};
35 NSData*
message = [NSData dataWithBytes:messageData length:sizeof(messageData)];
41- (void)testDoesntPassCallOn {
42 id messenger = OCMStrictProtocolMock(
@protocol(FlutterBinaryMessenger));
45 char messageData[] = {
'a',
'a',
'r',
'o',
'n'};
46 NSData*
message = [NSData dataWithBytes:messageData length:sizeof(messageData)];
52- (void)testSetMessageHandlerWithTaskQueue {
53 id messenger = OCMProtocolMock(
@protocol(FlutterBinaryMessenger));
57 NSObject<FlutterTaskQueue>* taskQueue = OCMProtocolMock(
@protocol(FlutterTaskQueueDispatch));
61 OCMVerify([messenger setMessageHandlerOnChannel:
channel
63 taskQueue:taskQueue]);
66- (void)testMakeBackgroundTaskQueue {
67 id messenger = OCMProtocolMock(
@protocol(FlutterBinaryMessenger));
71 OCMVerify([messenger makeBackgroundTaskQueue]);
NS_ASSUME_NONNULL_BEGIN typedef void(^ FlutterBinaryReply)(NSData *_Nullable reply)
void(^ FlutterBinaryMessageHandler)(NSData *_Nullable message, FlutterBinaryReply reply)
TEST(FlutterBinaryMessengerRelayTest, Create)
BOOL FLTThrowsObjcException(dispatch_block_t block)
Returns YES if the block throws an exception.
const gchar FlBinaryMessengerMessageHandler handler
G_BEGIN_DECLS GBytes * message
NSObject< FlutterBinaryMessenger > * parent
NSObject< FlutterTaskQueue > * makeBackgroundTaskQueue()
TODO(gaaclarke): Remove optional when macos supports Background Platform Channels.
void sendOnChannel:message:binaryReply:(NSString *channel,[message] NSData *_Nullable message,[binaryReply] FlutterBinaryReply _Nullable callback)
FlutterBinaryMessengerConnection setMessageHandlerOnChannel:binaryMessageHandler:taskQueue:(NSString *channel,[binaryMessageHandler] FlutterBinaryMessageHandler _Nullable handler,[taskQueue] NSObject< FlutterTaskQueue > *_Nullable taskQueue)