Flutter Engine
The Flutter Engine
Instance Methods | List of all members
FlutterEnginePlatformViewTest Class Reference
Inheritance diagram for FlutterEnginePlatformViewTest:

Instance Methods

(void) - setUp [implementation]
 
(void) - tearDown [implementation]
 
(fml::WeakPtr< flutter::PlatformView >) - platformViewReplacement [implementation]
 
(void) - testCallsNotifyLowMemory [implementation]
 

Detailed Description

Definition at line 61 of file FlutterEnginePlatformViewTest.mm.

Method Documentation

◆ platformViewReplacement

- (WeakPtr<) flutter:
implementation

Definition at line 67 of file FlutterEnginePlatformViewTest.mm.

95 {
96 return weak_factory->GetWeakPtr();
97}
std::unique_ptr< fml::WeakPtrFactory< flutter::PlatformView > > weak_factory

◆ setUp

- (void) setUp
implementation

Definition at line 67 of file FlutterEnginePlatformViewTest.mm.

69 {
71 auto thread_task_runner = fml::MessageLoop::GetCurrent().GetTaskRunner();
72 auto sync_switch = std::make_shared<fml::SyncSwitch>();
73 flutter::TaskRunners runners(/*label=*/self.name.UTF8String,
74 /*platform=*/thread_task_runner,
75 /*raster=*/thread_task_runner,
76 /*ui=*/thread_task_runner,
77 /*io=*/thread_task_runner);
78 platform_view = std::make_unique<flutter::PlatformViewIOS>(
79 /*delegate=*/fake_delegate,
80 /*rendering_api=*/fake_delegate.settings_.enable_impeller
83 /*platform_views_controller=*/nil,
84 /*task_runners=*/runners,
85 /*worker_task_runner=*/nil,
86 /*is_gpu_disabled_sync_switch=*/sync_switch);
87 weak_factory = std::make_unique<fml::WeakPtrFactory<flutter::PlatformView>>(platform_view.get());
88}
flutter::FakeDelegate fake_delegate
std::unique_ptr< flutter::PlatformViewIOS > platform_view
static void EnsureInitializedForCurrentThread()
Definition: message_loop.cc:27
fml::RefPtr< fml::TaskRunner > GetTaskRunner() const
Definition: message_loop.cc:56
static FML_EMBEDDER_ONLY MessageLoop & GetCurrent()
Definition: message_loop.cc:19
DEF_SWITCHES_START aot vmservice shared library name
Definition: switches.h:32

◆ tearDown

- (void) tearDown
implementation

Definition at line 67 of file FlutterEnginePlatformViewTest.mm.

90 {
91 weak_factory.reset();
92 platform_view.reset();
93}

◆ testCallsNotifyLowMemory

- (void) testCallsNotifyLowMemory
implementation

Definition at line 67 of file FlutterEnginePlatformViewTest.mm.

99 {
100 FlutterEngine* engine = [[FlutterEngine alloc] initWithName:@"tester"];
101 XCTAssertNotNil(engine);
102 id mockEngine = OCMPartialMock(engine);
103 OCMStub([mockEngine notifyLowMemory]);
104 OCMStub([mockEngine iosPlatformView]).andReturn(platform_view.get());
105
106 [engine setViewController:nil];
107 OCMVerify([mockEngine notifyLowMemory]);
108 OCMReject([mockEngine notifyLowMemory]);
109
110 XCTNSNotificationExpectation* memoryExpectation = [[XCTNSNotificationExpectation alloc]
111 initWithName:UIApplicationDidReceiveMemoryWarningNotification];
112 [[NSNotificationCenter defaultCenter]
113 postNotificationName:UIApplicationDidReceiveMemoryWarningNotification
114 object:nil];
115 [self waitForExpectations:@[ memoryExpectation ] timeout:5.0];
116 OCMVerify([mockEngine notifyLowMemory]);
117 OCMReject([mockEngine notifyLowMemory]);
118
119 XCTNSNotificationExpectation* backgroundExpectation = [[XCTNSNotificationExpectation alloc]
120 initWithName:UIApplicationDidEnterBackgroundNotification];
121 [[NSNotificationCenter defaultCenter]
122 postNotificationName:UIApplicationDidEnterBackgroundNotification
123 object:nil];
124 [self waitForExpectations:@[ backgroundExpectation ] timeout:5.0];
125
126 OCMVerify([mockEngine notifyLowMemory]);
127}
FlutterEngine engine
Definition: main.cc:68
void setViewController:(FlutterViewController *viewController)

The documentation for this class was generated from the following file: