5 #include <Carbon/Carbon.h>
6 #import <Foundation/Foundation.h>
7 #import <OCMock/OCMock.h>
9 #include "flutter/common/constants.h"
14 #import "flutter/testing/testing.h"
15 #include "third_party/googletest/googletest/include/gtest/gtest.h"
19 TEST(FlutterViewEngineProviderUnittests, GetViewReturnsTheCorrectView) {
22 __block
id mockFlutterViewController;
23 OCMStub([mockEngine viewControllerForIdentifier:0])
24 .ignoringNonObjectArgs()
25 .andDo(^(NSInvocation* invocation) {
27 [invocation getArgument:&viewIdentifier atIndex:2];
28 if (viewIdentifier == kFlutterImplicitViewId) {
29 if (mockFlutterViewController != nil) {
30 [invocation setReturnValue:&mockFlutterViewController];
37 EXPECT_EQ([viewProvider viewForIdentifier:0], nil);
41 id mockView = OCMStrictClassMock([
FlutterView class]);
42 OCMStub([mockFlutterViewController flutterView]).andReturn(mockView);
43 EXPECT_EQ([viewProvider viewForIdentifier:0], mockView);