22// Use of this source code is governed by a BSD-style license that can be
33// found in the LICENSE file.
44
5- // These tests are flaky on arm64.
6- // TODO(dnfield): reenable after fixing https://github.com/flutter/flutter/issues/126013
7- #if !defined(__aarch64__) && !defined(__arm64__)
8-
95#if !__has_feature(objc_arc)
106#error ARC must be enabled!
117#endif
1511#import < OCMock/OCMock.h>
1612#import < XCTest/XCTest.h>
1713
14+ @protocol FlutterTaskQueue <NSObject >
15+ @end
16+
1817@interface MockBinaryMessenger : NSObject <FlutterBinaryMessenger>
1918@property (nonatomic , copy ) NSString * channel;
2019@property (nonatomic , strong ) NSData * message;
@@ -218,7 +217,7 @@ - (void)testBasicMessageChannelTaskQueue {
218217 FlutterBinaryMessengerConnection connection = 123 ;
219218 id binaryMessenger = OCMProtocolMock (@protocol (FlutterBinaryMessenger));
220219 id codec = OCMProtocolMock (@protocol (FlutterMethodCodec));
221- id taskQueue = OCMClassMock ([ NSObject class ] );
220+ id taskQueue = OCMProtocolMock ( @protocol (FlutterTaskQueue) );
222221 FlutterBasicMessageChannel* channel =
223222 [[FlutterBasicMessageChannel alloc ] initWithName: channelName
224223 binaryMessenger: binaryMessenger
@@ -246,7 +245,7 @@ - (void)testBasicMessageChannelInvokeHandlerAfterChannelReleased {
246245 FlutterBinaryMessengerConnection connection = 123 ;
247246 id binaryMessenger = OCMProtocolMock (@protocol (FlutterBinaryMessenger));
248247 id codec = OCMProtocolMock (@protocol (FlutterMessageCodec));
249- id taskQueue = OCMClassMock ([ NSObject class ] );
248+ id taskQueue = OCMProtocolMock ( @protocol (FlutterTaskQueue) );
250249 FlutterBasicMessageChannel* channel =
251250 [[FlutterBasicMessageChannel alloc ] initWithName: channelName
252251 binaryMessenger: binaryMessenger
@@ -283,7 +282,7 @@ - (void)testMethodChannelInvokeHandlerAfterChannelReleased {
283282 @autoreleasepool {
284283 id binaryMessenger = OCMProtocolMock (@protocol (FlutterBinaryMessenger));
285284 id codec = OCMProtocolMock (@protocol (FlutterMethodCodec));
286- id taskQueue = OCMClassMock ([ NSObject class ] );
285+ id taskQueue = OCMProtocolMock ( @protocol (FlutterTaskQueue) );
287286 FlutterMethodChannel* channel = [[FlutterMethodChannel alloc ] initWithName: channelName
288287 binaryMessenger: binaryMessenger
289288 codec: codec
@@ -315,7 +314,7 @@ - (void)testMethodChannelTaskQueue {
315314 FlutterBinaryMessengerConnection connection = 123 ;
316315 id binaryMessenger = OCMProtocolMock (@protocol (FlutterBinaryMessenger));
317316 id codec = OCMProtocolMock (@protocol (FlutterMethodCodec));
318- id taskQueue = OCMClassMock ([ NSObject class ] );
317+ id taskQueue = OCMProtocolMock ( @protocol (FlutterTaskQueue) );
319318 FlutterMethodChannel* channel = [[FlutterMethodChannel alloc ] initWithName: channelName
320319 binaryMessenger: binaryMessenger
321320 codec: codec
@@ -340,7 +339,7 @@ - (void)testEventChannelTaskQueue {
340339 FlutterBinaryMessengerConnection connection = 123 ;
341340 id binaryMessenger = OCMProtocolMock (@protocol (FlutterBinaryMessenger));
342341 id codec = OCMProtocolMock (@protocol (FlutterMethodCodec));
343- id taskQueue = OCMClassMock ([ NSObject class ] );
342+ id taskQueue = OCMProtocolMock ( @protocol (FlutterTaskQueue) );
344343 id handler = OCMProtocolMock (@protocol (FlutterStreamHandler));
345344 FlutterEventChannel* channel = [[FlutterEventChannel alloc ] initWithName: channelName
346345 binaryMessenger: binaryMessenger
@@ -360,5 +359,3 @@ - (void)testEventChannelTaskQueue {
360359}
361360
362361@end
363-
364- #endif // !defined(__arch64__) && !defined(__arm64__)
0 commit comments