5#import "flutter/shell/platform/darwin/common/framework/Source/FlutterBinaryMessengerRelay.h"
7#import <OCMock/OCMock.h>
9#import "flutter/shell/platform/darwin/common/framework/Headers/FlutterMacros.h"
10#import "flutter/shell/platform/darwin/common/framework/Source/FlutterTestUtils.h"
11#import "flutter/shell/platform/darwin/ios/flutter_task_queue_dispatch.h"
12#import "flutter/testing/testing.h"
13#include "gtest/gtest.h"
23 id messenger = OCMProtocolMock(
@protocol(FlutterBinaryMessenger));
26 EXPECT_NE(relay, nil);
27 EXPECT_EQ(messenger, relay.
parent);
31 id messenger = OCMProtocolMock(
@protocol(FlutterBinaryMessenger));
34 char messageData[] = {
'a',
'a',
'r',
'o',
'n'};
35 NSData*
message = [NSData dataWithBytes:messageData length:sizeof(messageData)];
36 NSString* channel =
@"foobar";
38 OCMVerify([messenger sendOnChannel:channel
message:
message binaryReply:nil]);
42 id messenger = OCMStrictProtocolMock(
@protocol(FlutterBinaryMessenger));
45 char messageData[] = {
'a',
'a',
'r',
'o',
'n'};
46 NSData*
message = [NSData dataWithBytes:messageData length:sizeof(messageData)];
47 NSString* channel =
@"foobar";
53 id messenger = OCMProtocolMock(
@protocol(FlutterBinaryMessenger));
56 NSString* channel =
@"foobar";
57 NSObject<FlutterTaskQueue>* taskQueue = OCMProtocolMock(
@protocol(FlutterTaskQueueDispatch));
61 OCMVerify([messenger setMessageHandlerOnChannel:channel
62 binaryMessageHandler:handler
63 taskQueue:taskQueue]);
67 id messenger = OCMProtocolMock(
@protocol(FlutterBinaryMessenger));
71 OCMVerify([messenger makeBackgroundTaskQueue]);
#define TEST(S, s, D, expected)
NS_ASSUME_NONNULL_BEGIN typedef void(^ FlutterBinaryReply)(NSData *_Nullable reply)
void(^ FlutterBinaryMessageHandler)(NSData *_Nullable message, FlutterBinaryReply reply)
BOOL FLTThrowsObjcException(dispatch_block_t block)
Returns YES if the block throws an exception.
static sk_sp< Effect > Create()
void testMakeBackgroundTaskQueue()
void testSetMessageHandlerWithTaskQueue()
void testDoesntPassCallOn()
FlutterBinaryMessengerConnection setMessageHandlerOnChannel:binaryMessageHandler:taskQueue:(NSString *channel, [binaryMessageHandler] FlutterBinaryMessageHandler handler, [taskQueue] NSObject< FlutterTaskQueue > *taskQueue)
NSObject< FlutterBinaryMessenger > * parent
void sendOnChannel:message:binaryReply:(NSString *channel, [message] NSData *message, [binaryReply] FlutterBinaryReply callback)
NSObject< FlutterTaskQueue > * makeBackgroundTaskQueue()
TODO(gaaclarke): Remove optional when macos supports Background Platform Channels.