5 #import <OCMock/OCMock.h>
6 #import <XCTest/XCTest.h>
20 XCTAssertNotNil(delegate);
23 #if not APPLICATION_EXTENSION_API_ONLY
24 - (void)testDidEnterBackground {
25 XCTNSNotificationExpectation* expectation = [[XCTNSNotificationExpectation alloc]
26 initWithName:UIApplicationDidEnterBackgroundNotification];
30 [[NSNotificationCenter defaultCenter]
31 postNotificationName:UIApplicationDidEnterBackgroundNotification
34 [
self waitForExpectations:@[ expectation ] timeout:5.0];
35 OCMVerify([plugin applicationDidEnterBackground:[UIApplication sharedApplication]]);
38 - (void)testWillEnterForeground {
39 XCTNSNotificationExpectation* expectation = [[XCTNSNotificationExpectation alloc]
40 initWithName:UIApplicationWillEnterForegroundNotification];
45 [[NSNotificationCenter defaultCenter]
46 postNotificationName:UIApplicationWillEnterForegroundNotification
48 [
self waitForExpectations:@[ expectation ] timeout:5.0];
49 OCMVerify([plugin applicationWillEnterForeground:[UIApplication sharedApplication]]);
52 - (void)testWillResignActive {
53 XCTNSNotificationExpectation* expectation =
54 [[XCTNSNotificationExpectation alloc] initWithName:UIApplicationWillResignActiveNotification];
59 [[NSNotificationCenter defaultCenter]
60 postNotificationName:UIApplicationWillResignActiveNotification
62 [
self waitForExpectations:@[ expectation ] timeout:5.0];
63 OCMVerify([plugin applicationWillResignActive:[UIApplication sharedApplication]]);
66 - (void)testDidBecomeActive {
67 XCTNSNotificationExpectation* expectation =
68 [[XCTNSNotificationExpectation alloc] initWithName:UIApplicationDidBecomeActiveNotification];
73 [[NSNotificationCenter defaultCenter]
74 postNotificationName:UIApplicationDidBecomeActiveNotification
76 [
self waitForExpectations:@[ expectation ] timeout:5.0];
77 OCMVerify([plugin applicationDidBecomeActive:[UIApplication sharedApplication]]);
80 - (void)testWillTerminate {
81 XCTNSNotificationExpectation* expectation =
82 [[XCTNSNotificationExpectation alloc] initWithName:UIApplicationWillTerminateNotification];
87 [[NSNotificationCenter defaultCenter] postNotificationName:UIApplicationWillTerminateNotification
89 [
self waitForExpectations:@[ expectation ] timeout:5.0];
90 OCMVerify([plugin applicationWillTerminate:[UIApplication sharedApplication]]);