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

Instance Methods

(void) - testCreate [implementation]
 
(void) - testDidEnterBackground [implementation]
 
(void) - testWillEnterForeground [implementation]
 
(void) - testWillResignActive [implementation]
 
(void) - testDidBecomeActive [implementation]
 
(void) - testWillTerminate [implementation]
 
(void) - testReleasesPluginOnDealloc [implementation]
 

Detailed Description

Definition at line 19 of file FlutterPluginAppLifeCycleDelegateTest.mm.

Method Documentation

◆ testCreate

- (void) testCreate
implementation

◆ testDidBecomeActive

- (void) testDidBecomeActive
implementation

Definition at line 11 of file FlutterPluginAppLifeCycleDelegateTest.mm.

72 {
73 XCTNSNotificationExpectation* expectation =
74 [[XCTNSNotificationExpectation alloc] initWithName:UIApplicationDidBecomeActiveNotification];
75
77 id plugin = OCMProtocolMock(@protocol(FlutterPlugin));
78 [delegate addDelegate:plugin];
79 [[NSNotificationCenter defaultCenter]
80 postNotificationName:UIApplicationDidBecomeActiveNotification
81 object:nil];
82 [self waitForExpectations:@[ expectation ] timeout:5.0];
83 OCMVerify([plugin applicationDidBecomeActive:[UIApplication sharedApplication]]);
84}
void addDelegate:(NSObject< FlutterApplicationLifeCycleDelegate > *delegate)

◆ testDidEnterBackground

- (void) testDidEnterBackground
implementation

Definition at line 11 of file FlutterPluginAppLifeCycleDelegateTest.mm.

30 {
31 XCTNSNotificationExpectation* expectation = [[XCTNSNotificationExpectation alloc]
32 initWithName:UIApplicationDidEnterBackgroundNotification];
34 id plugin = OCMProtocolMock(@protocol(FlutterPlugin));
35 [delegate addDelegate:plugin];
36 [[NSNotificationCenter defaultCenter]
37 postNotificationName:UIApplicationDidEnterBackgroundNotification
38 object:nil];
39
40 [self waitForExpectations:@[ expectation ] timeout:5.0];
41 OCMVerify([plugin applicationDidEnterBackground:[UIApplication sharedApplication]]);
42}

◆ testReleasesPluginOnDealloc

- (void) testReleasesPluginOnDealloc
implementation

Definition at line 11 of file FlutterPluginAppLifeCycleDelegateTest.mm.

99 {
100 __weak id<FlutterApplicationLifeCycleDelegate> weakPlugin;
101 __weak FlutterPluginAppLifeCycleDelegate* weakDelegate;
102 @autoreleasepool {
103 FakePlugin* fakePlugin = [[FakePlugin alloc] init];
104 weakPlugin = fakePlugin;
106 [delegate addDelegate:fakePlugin];
107 weakDelegate = delegate;
108 }
109 XCTAssertNil(weakPlugin);
110 XCTAssertNil(weakDelegate);
111}

◆ testWillEnterForeground

- (void) testWillEnterForeground
implementation

Definition at line 11 of file FlutterPluginAppLifeCycleDelegateTest.mm.

44 {
45 XCTNSNotificationExpectation* expectation = [[XCTNSNotificationExpectation alloc]
46 initWithName:UIApplicationWillEnterForegroundNotification];
47
49 id plugin = OCMProtocolMock(@protocol(FlutterPlugin));
50 [delegate addDelegate:plugin];
51 [[NSNotificationCenter defaultCenter]
52 postNotificationName:UIApplicationWillEnterForegroundNotification
53 object:nil];
54 [self waitForExpectations:@[ expectation ] timeout:5.0];
55 OCMVerify([plugin applicationWillEnterForeground:[UIApplication sharedApplication]]);
56}

◆ testWillResignActive

- (void) testWillResignActive
implementation

Definition at line 11 of file FlutterPluginAppLifeCycleDelegateTest.mm.

58 {
59 XCTNSNotificationExpectation* expectation =
60 [[XCTNSNotificationExpectation alloc] initWithName:UIApplicationWillResignActiveNotification];
61
63 id plugin = OCMProtocolMock(@protocol(FlutterPlugin));
64 [delegate addDelegate:plugin];
65 [[NSNotificationCenter defaultCenter]
66 postNotificationName:UIApplicationWillResignActiveNotification
67 object:nil];
68 [self waitForExpectations:@[ expectation ] timeout:5.0];
69 OCMVerify([plugin applicationWillResignActive:[UIApplication sharedApplication]]);
70}

◆ testWillTerminate

- (void) testWillTerminate
implementation

Definition at line 11 of file FlutterPluginAppLifeCycleDelegateTest.mm.

86 {
87 XCTNSNotificationExpectation* expectation =
88 [[XCTNSNotificationExpectation alloc] initWithName:UIApplicationWillTerminateNotification];
89
91 id plugin = OCMProtocolMock(@protocol(FlutterPlugin));
92 [delegate addDelegate:plugin];
93 [[NSNotificationCenter defaultCenter] postNotificationName:UIApplicationWillTerminateNotification
94 object:nil];
95 [self waitForExpectations:@[ expectation ] timeout:5.0];
96 OCMVerify([plugin applicationWillTerminate:[UIApplication sharedApplication]]);
97}

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