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"
26 EXPECT_NE(relay, nil);
27 EXPECT_EQ(messenger, relay.
parent);
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]);
45 char messageData[] = {
'a',
'a',
'r',
'o',
'n'};
46 NSData*
message = [NSData dataWithBytes:messageData length:sizeof(messageData)];
47 NSString* channel =
@"foobar";
56 NSString* channel =
@"foobar";
61 OCMVerify([messenger setMessageHandlerOnChannel:channel
62 binaryMessageHandler:handler
63 taskQueue:taskQueue]);
71 OCMVerify([messenger makeBackgroundTaskQueue]);
TEST(FlutterBinaryMessengerRelayTest, Create)
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.