diff options
author | Joel Fischer <joeljfischer@gmail.com> | 2017-09-20 14:48:53 -0400 |
---|---|---|
committer | Joel Fischer <joeljfischer@gmail.com> | 2017-09-20 14:48:53 -0400 |
commit | 4a6603b7201f08553b23b9114a208df23447adc9 (patch) | |
tree | 93e188799e42a9308c2a9ce7655b7870d6ee6f25 | |
parent | 4db3f7937d28310438a989706354d24c088fc4c9 (diff) | |
download | sdl_ios-bugfix/issue_742_fix_tests_xcode9.tar.gz |
Fix lifecycle manager testsbugfix/issue_742_fix_tests_xcode9
-rw-r--r-- | SmartDeviceLink/SDLStateMachine.m | 11 | ||||
-rw-r--r-- | SmartDeviceLinkTests/DevAPISpecs/SDLLifecycleManagerSpec.m | 12 | ||||
-rw-r--r-- | SmartDeviceLinkTests/DevAPISpecs/SDLStreamingMediaConfigurationSpec.m | 2 |
3 files changed, 14 insertions, 11 deletions
diff --git a/SmartDeviceLink/SDLStateMachine.m b/SmartDeviceLink/SDLStateMachine.m index f86a002b2..cc34d99e2 100644 --- a/SmartDeviceLink/SDLStateMachine.m +++ b/SmartDeviceLink/SDLStateMachine.m @@ -117,10 +117,11 @@ SDLStateMachineTransitionFormat const SDLStateMachineTransitionFormatDidEnter = return; } - if (oldState != nil && shouldCall) { + if (oldState != nil) { self.currentState = oldState; - [self transitionToState:state]; - } else if (shouldCall) { + } + + if (shouldCall) { SEL didEnter = NSSelectorFromString([NSString stringWithFormat:SDLStateMachineTransitionFormatDidEnter, state]); #pragma clang diagnostic push #pragma clang diagnostic ignored "-Warc-performSelector-leaks" @@ -128,9 +129,9 @@ SDLStateMachineTransitionFormat const SDLStateMachineTransitionFormatDidEnter = [self.target performSelector:didEnter]; #pragma clang diagnostic pop } - } else { - self.currentState = state; } + + self.currentState = state; } /** diff --git a/SmartDeviceLinkTests/DevAPISpecs/SDLLifecycleManagerSpec.m b/SmartDeviceLinkTests/DevAPISpecs/SDLLifecycleManagerSpec.m index d6a57e8ba..a2b2acb05 100644 --- a/SmartDeviceLinkTests/DevAPISpecs/SDLLifecycleManagerSpec.m +++ b/SmartDeviceLinkTests/DevAPISpecs/SDLLifecycleManagerSpec.m @@ -58,7 +58,7 @@ QuickConfigurationEnd QuickSpecBegin(SDLLifecycleManagerSpec) -fdescribe(@"a lifecycle manager", ^{ +describe(@"a lifecycle manager", ^{ __block SDLLifecycleManager *testManager = nil; __block SDLConfiguration *testConfig = nil; @@ -238,7 +238,8 @@ fdescribe(@"a lifecycle manager", ^{ OCMStub([permissionManagerMock startWithCompletionHandler:([OCMArg invokeBlockWithArgs:@(YES), permissionManagerStartError, nil])]); OCMStub([streamingManagerMock startWithProtocol:protocolMock completionHandler:([OCMArg invokeBlockWithArgs:@(YES), streamingManagerStartError, nil])]); - // Send an RAI response to move the lifecycle forward + // Send an RAI response & make sure we have an HMI status to move the lifecycle forward + testManager.hmiLevel = SDLHMILevelFull; [testManager.lifecycleStateMachine transitionToState:SDLLifecycleStateRegistered]; [NSThread sleepForTimeInterval:0.3]; }); @@ -305,9 +306,10 @@ fdescribe(@"a lifecycle manager", ^{ testHMIStatus.hmiLevel = testHMILevel; [testManager.notificationDispatcher postRPCNotificationNotification:SDLDidChangeHMIStatusNotification notification:testHMIStatus]; - - expect(@(readyHandlerSuccess)).to(equal(@YES)); - expect(readyHandlerError).toNot(beNil()); + + expect(testManager.lifecycleState).toEventually(equal(SDLLifecycleStateReady)); + expect(@(readyHandlerSuccess)).toEventually(equal(@YES)); + expect(readyHandlerError).toEventually(beNil()); }); }); }); diff --git a/SmartDeviceLinkTests/DevAPISpecs/SDLStreamingMediaConfigurationSpec.m b/SmartDeviceLinkTests/DevAPISpecs/SDLStreamingMediaConfigurationSpec.m index de2c356ca..d23c7c48f 100644 --- a/SmartDeviceLinkTests/DevAPISpecs/SDLStreamingMediaConfigurationSpec.m +++ b/SmartDeviceLinkTests/DevAPISpecs/SDLStreamingMediaConfigurationSpec.m @@ -72,7 +72,7 @@ describe(@"a streaming media configuration", ^{ }); it(@"should have properly set properties", ^{ - expect(testConfig.securityManagers).to(contain(testFakeSecurityManager)); + expect(testConfig.securityManagers).to(contain(testFakeSecurityManager.class)); expect(@(testConfig.maximumDesiredEncryption)).to(equal(@(someEncryptionFlag))); expect(testConfig.customVideoEncoderSettings).to(equal(someVideoEncoderSettings)); }); |