From d7160549c5bf22050dc16f2abf46e6a463dc02ce Mon Sep 17 00:00:00 2001 From: Satbir Tanda Date: Thu, 18 Jul 2019 17:25:11 -0700 Subject: Remove SDLOnLockScreenStatus tests Remove SDLOnLockScreenStatus notification obeservation from SDLLockscreenManagerSpec --- SmartDeviceLink-iOS.xcodeproj/project.pbxproj | 4 - .../DevAPISpecs/SDLLockScreenManagerSpec.m | 146 --------------------- .../NotificationSpecs/SDLOnLockScreenStatusSpec.m | 63 --------- 3 files changed, 213 deletions(-) delete mode 100644 SmartDeviceLinkTests/RPCSpecs/NotificationSpecs/SDLOnLockScreenStatusSpec.m diff --git a/SmartDeviceLink-iOS.xcodeproj/project.pbxproj b/SmartDeviceLink-iOS.xcodeproj/project.pbxproj index 562670db2..311b0a32c 100644 --- a/SmartDeviceLink-iOS.xcodeproj/project.pbxproj +++ b/SmartDeviceLink-iOS.xcodeproj/project.pbxproj @@ -85,7 +85,6 @@ 162E83171A9BDE8B00906325 /* SDLOnHMIStatusSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = 162E82311A9BDE8A00906325 /* SDLOnHMIStatusSpec.m */; }; 162E83181A9BDE8B00906325 /* SDLOnKeyboardInputSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = 162E82321A9BDE8A00906325 /* SDLOnKeyboardInputSpec.m */; }; 162E83191A9BDE8B00906325 /* SDLOnLanguageChangeSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = 162E82331A9BDE8A00906325 /* SDLOnLanguageChangeSpec.m */; }; - 162E831A1A9BDE8B00906325 /* SDLOnLockScreenStatusSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = 162E82341A9BDE8A00906325 /* SDLOnLockScreenStatusSpec.m */; }; 162E831B1A9BDE8B00906325 /* SDLOnPermissionsChangeSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = 162E82351A9BDE8A00906325 /* SDLOnPermissionsChangeSpec.m */; }; 162E831C1A9BDE8B00906325 /* SDLOnSyncPDataSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = 162E82361A9BDE8A00906325 /* SDLOnSyncPDataSpec.m */; }; 162E831D1A9BDE8B00906325 /* SDLOnSystemRequestSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = 162E82371A9BDE8A00906325 /* SDLOnSystemRequestSpec.m */; }; @@ -1693,7 +1692,6 @@ 162E82311A9BDE8A00906325 /* SDLOnHMIStatusSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDLOnHMIStatusSpec.m; sourceTree = ""; }; 162E82321A9BDE8A00906325 /* SDLOnKeyboardInputSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDLOnKeyboardInputSpec.m; sourceTree = ""; }; 162E82331A9BDE8A00906325 /* SDLOnLanguageChangeSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDLOnLanguageChangeSpec.m; sourceTree = ""; }; - 162E82341A9BDE8A00906325 /* SDLOnLockScreenStatusSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDLOnLockScreenStatusSpec.m; sourceTree = ""; }; 162E82351A9BDE8A00906325 /* SDLOnPermissionsChangeSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDLOnPermissionsChangeSpec.m; sourceTree = ""; }; 162E82361A9BDE8A00906325 /* SDLOnSyncPDataSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDLOnSyncPDataSpec.m; sourceTree = ""; }; 162E82371A9BDE8A00906325 /* SDLOnSystemRequestSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDLOnSystemRequestSpec.m; sourceTree = ""; }; @@ -3363,7 +3361,6 @@ 1EE8C4531F38762E00FDC2CF /* SDLOnInteriorVehicleDataSpec.m */, 162E82321A9BDE8A00906325 /* SDLOnKeyboardInputSpec.m */, 162E82331A9BDE8A00906325 /* SDLOnLanguageChangeSpec.m */, - 162E82341A9BDE8A00906325 /* SDLOnLockScreenStatusSpec.m */, 162E82351A9BDE8A00906325 /* SDLOnPermissionsChangeSpec.m */, 1EAA470D2032BF1D000FE74B /* SDLOnRCStatusSpec.m */, 162E82361A9BDE8A00906325 /* SDLOnSyncPDataSpec.m */, @@ -7707,7 +7704,6 @@ 1E89B0DE2031636000A47992 /* SDLSeatControlDataSpec.m in Sources */, 88A4A0FA22242AB400C6F01D /* SDLNavigationServiceDataSpec.m in Sources */, 8831FA3D220207DA00B8FFB7 /* SDLServiceUpdateReasonSpec.m in Sources */, - 162E831A1A9BDE8B00906325 /* SDLOnLockScreenStatusSpec.m in Sources */, 162E83431A9BDE8B00906325 /* SDLSyncPDataSpec.m in Sources */, 167ED9461A9BCE5D00797BE5 /* SwiftSpec.swift in Sources */, 162E838B1A9BDE8B00906325 /* SDLSoftButtonCapabilitiesSpec.m in Sources */, diff --git a/SmartDeviceLinkTests/DevAPISpecs/SDLLockScreenManagerSpec.m b/SmartDeviceLinkTests/DevAPISpecs/SDLLockScreenManagerSpec.m index a2e6eaaa7..e501ccc1d 100644 --- a/SmartDeviceLinkTests/DevAPISpecs/SDLLockScreenManagerSpec.m +++ b/SmartDeviceLinkTests/DevAPISpecs/SDLLockScreenManagerSpec.m @@ -9,7 +9,6 @@ #import "SDLLockScreenViewController.h" #import "SDLNotificationConstants.h" #import "SDLNotificationDispatcher.h" -#import "SDLOnLockScreenStatus.h" #import "SDLOnDriverDistraction.h" #import "SDLRPCNotificationNotification.h" @@ -19,7 +18,6 @@ QuickSpecBegin(SDLLockScreenManagerSpec) describe(@"a lock screen manager", ^{ __block SDLLockScreenManager *testManager = nil; __block SDLFakeViewControllerPresenter *fakePresenter = nil; - __block SDLNotificationDispatcher *testNotificationDispatcher = nil; beforeEach(^{ fakePresenter = [[SDLFakeViewControllerPresenter alloc] init]; @@ -45,21 +43,6 @@ describe(@"a lock screen manager", ^{ expect(@(fakePresenter.presented)).to(beFalsy()); expect(testManager.lockScreenViewController).to(beNil()); }); - - describe(@"when the lock screen status becomes REQUIRED", ^{ - __block SDLOnLockScreenStatus *testRequiredStatus = nil; - - beforeEach(^{ - testRequiredStatus = [[SDLOnLockScreenStatus alloc] init]; - testRequiredStatus.lockScreenStatus = SDLLockScreenStatusRequired; - - [testNotificationDispatcher postNotificationName:SDLDidChangeLockScreenStatusNotification infoObject:testRequiredStatus]; - }); - - it(@"should not have presented the lock screen", ^{ - expect(@(fakePresenter.presented)).to(beFalsy()); - }); - }); }); }); @@ -83,120 +66,6 @@ describe(@"a lock screen manager", ^{ expect(testManager.lockScreenViewController).toNot(beNil()); expect(testManager.lockScreenViewController).to(beAnInstanceOf([SDLLockScreenViewController class])); }); - - describe(@"when the lock screen status becomes REQUIRED", ^{ - __block SDLOnLockScreenStatus *testRequiredStatus = nil; - __block SDLOnDriverDistraction *testDriverDistraction = nil; - - beforeEach(^{ - testRequiredStatus = [[SDLOnLockScreenStatus alloc] init]; - testRequiredStatus.lockScreenStatus = SDLLockScreenStatusRequired; - - SDLRPCNotificationNotification *testLockStatusNotification = [[SDLRPCNotificationNotification alloc] initWithName:SDLDidChangeLockScreenStatusNotification object:nil rpcNotification:testRequiredStatus]; - [[NSNotificationCenter defaultCenter] postNotification:testLockStatusNotification]; - }); - - it(@"should have presented the lock screen", ^{ - expect(@(fakePresenter.presented)).to(beTruthy()); - }); - - it(@"should not have a vehicle icon", ^{ - expect(((SDLLockScreenViewController *)testManager.lockScreenViewController).vehicleIcon).to(beNil()); - }); - - describe(@"when a vehicle icon is received", ^{ - __block UIImage *testIcon = nil; - - beforeEach(^{ - testIcon = [UIImage imageNamed:@"testImagePNG" inBundle:[NSBundle bundleForClass:self.class] compatibleWithTraitCollection:nil]; - [[NSNotificationCenter defaultCenter] postNotificationName:SDLDidReceiveLockScreenIcon object:nil userInfo:@{ SDLNotificationUserInfoObject: testIcon }]; - }); - - it(@"should have a vehicle icon", ^{ - expect(((SDLLockScreenViewController *)testManager.lockScreenViewController).vehicleIcon).toNot(beNil()); - expect(((SDLLockScreenViewController *)testManager.lockScreenViewController).vehicleIcon).to(equal(testIcon)); - }); - }); - - describe(@"when a driver distraction notification is posted with lockScreenDismissableEnabled 1 bit", ^{ - __block SDLRPCNotificationNotification *testDriverDistractionNotification = nil; - - beforeEach(^{ - testDriverDistraction = [[SDLOnDriverDistraction alloc] init]; - testDriverDistraction.lockScreenDismissalEnabled = @1; - - testDriverDistractionNotification = [[SDLRPCNotificationNotification alloc] initWithName:SDLDidChangeDriverDistractionStateNotification object:nil rpcNotification:testDriverDistraction]; - - [[NSNotificationCenter defaultCenter] postNotification:testDriverDistractionNotification]; - }); - - it(@"should be able to be dismissed", ^{ - expect(testManager.lockScreenDismissableEnabled).toEventually(equal(YES)); - }); - - }); - - describe(@"when a driver distraction notification is posted with lockScreenDismissableEnabled 0 bit", ^{ - __block SDLRPCNotificationNotification *testDriverDistractionNotification = nil; - - beforeEach(^{ - testDriverDistraction = [[SDLOnDriverDistraction alloc] init]; - testDriverDistraction.lockScreenDismissalEnabled = @0; - - testDriverDistractionNotification = [[SDLRPCNotificationNotification alloc] initWithName:SDLDidChangeDriverDistractionStateNotification object:nil rpcNotification:testDriverDistraction]; - - [[NSNotificationCenter defaultCenter] postNotification:testDriverDistractionNotification]; - }); - - it(@"should not be able to be dismissed", ^{ - expect(testManager.lockScreenDismissableEnabled).toEventually(equal(NO)); - }); - - }); - - describe(@"when a driver distraction notification is posted with lockScreenDismissableEnabled nil bit", ^{ - __block SDLRPCNotificationNotification *testDriverDistractionNotification = nil; - - beforeEach(^{ - testDriverDistraction = [[SDLOnDriverDistraction alloc] init]; - - testDriverDistractionNotification = [[SDLRPCNotificationNotification alloc] initWithName:SDLDidChangeDriverDistractionStateNotification object:nil rpcNotification:testDriverDistraction]; - - [[NSNotificationCenter defaultCenter] postNotification:testDriverDistractionNotification]; - }); - - it(@"should not be able to be dismissed", ^{ - expect(testManager.lockScreenDismissableEnabled).toEventually(equal(NO)); - }); - - }); - - describe(@"then the manager is stopped", ^{ - beforeEach(^{ - [testManager stop]; - }); - - it(@"should have dismissed the lock screen", ^{ - expect(@(fakePresenter.presented)).to(beFalsy()); - }); - }); - - describe(@"then the status becomes OFF", ^{ - __block SDLOnLockScreenStatus *testOffStatus = nil; - - beforeEach(^{ - testOffStatus = [[SDLOnLockScreenStatus alloc] init]; - testOffStatus.lockScreenStatus = SDLLockScreenStatusOff; - - SDLRPCNotificationNotification *testLockStatusNotification = [[SDLRPCNotificationNotification alloc] initWithName:SDLDidChangeLockScreenStatusNotification object:nil rpcNotification:testOffStatus]; - [[NSNotificationCenter defaultCenter] postNotification:testLockStatusNotification]; - }); - - it(@"should have dismissed the lock screen", ^{ - expect(@(fakePresenter.presented)).to(beFalsy()); - }); - }); - }); }); }); @@ -262,16 +131,9 @@ describe(@"a lock screen manager", ^{ __block SDLLockScreenManager *testLockScreenManager = nil; __block SDLLockScreenConfiguration *testLockScreenConfig = nil; __block id mockViewControllerPresenter = nil; - __block SDLRPCNotificationNotification *testLockStatusNotification = nil; beforeEach(^{ mockViewControllerPresenter = OCMClassMock([SDLFakeViewControllerPresenter class]); - - SDLOnLockScreenStatus *testOptionalStatus = [[SDLOnLockScreenStatus alloc] init]; - testOptionalStatus.lockScreenStatus = SDLLockScreenStatusOptional; - testLockStatusNotification = [[SDLRPCNotificationNotification alloc] initWithName:SDLDidChangeLockScreenStatusNotification object:nil rpcNotification:testOptionalStatus]; - - testLockScreenConfig = [SDLLockScreenConfiguration enabledConfiguration]; }); context(@"showInOptionalState is true", ^{ @@ -286,10 +148,6 @@ describe(@"a lock screen manager", ^{ it(@"should present the lock screen if not already presented", ^{ OCMStub([mockViewControllerPresenter lockViewController]).andReturn([OCMArg any]); OCMStub([mockViewControllerPresenter presented]).andReturn(false); - - [[NSNotificationCenter defaultCenter] postNotification:testLockStatusNotification]; - - OCMVerify([mockViewControllerPresenter present]); }); }); @@ -305,10 +163,6 @@ describe(@"a lock screen manager", ^{ it(@"should dismiss the lock screen if already presented", ^{ OCMStub([mockViewControllerPresenter lockViewController]).andReturn([OCMArg any]); OCMStub([mockViewControllerPresenter presented]).andReturn(true); - - [[NSNotificationCenter defaultCenter] postNotification:testLockStatusNotification]; - - OCMVerify([mockViewControllerPresenter dismiss]); }); }); }); diff --git a/SmartDeviceLinkTests/RPCSpecs/NotificationSpecs/SDLOnLockScreenStatusSpec.m b/SmartDeviceLinkTests/RPCSpecs/NotificationSpecs/SDLOnLockScreenStatusSpec.m deleted file mode 100644 index cd12a3d46..000000000 --- a/SmartDeviceLinkTests/RPCSpecs/NotificationSpecs/SDLOnLockScreenStatusSpec.m +++ /dev/null @@ -1,63 +0,0 @@ -// -// SDLOnLockScreenStatusSpec.m -// SmartDeviceLink - - -#import - -#import -#import - -#import "SDLOnLockScreenStatus.h" -#import "SDLHMILevel.h" -#import "SDLLockScreenStatus.h" -#import "SDLRPCParameterNames.h" -#import "SDLRPCFunctionNames.h" - -QuickSpecBegin(SDLOnLockScreenStatusSpec) - -describe(@"Getter/Setter Tests", ^ { - it(@"Should set and get correctly", ^ { - SDLOnLockScreenStatus* testNotification = [[SDLOnLockScreenStatus alloc] init]; - - testNotification.driverDistractionStatus = @NO; - testNotification.userSelected = @3; - testNotification.lockScreenStatus = SDLLockScreenStatusRequired; - testNotification.hmiLevel = SDLHMILevelNone; - - expect(testNotification.driverDistractionStatus).to(equal(@NO)); - expect(testNotification.userSelected).to(equal(@3)); - expect(testNotification.lockScreenStatus).to(equal(SDLLockScreenStatusRequired)); - expect(testNotification.hmiLevel).to(equal(SDLHMILevelNone)); - }); - - it(@"Should get correctly when initialized", ^ { - NSMutableDictionary* dict = [@{SDLRPCParameterNameNotification: - @{SDLRPCParameterNameParameters: - @{@"driverDistractionStatus":@NO, - @"userSelected":@3, - @"OnLockScreenStatus":SDLLockScreenStatusRequired, - @"hmiLevel":SDLHMILevelNone}, - SDLRPCParameterNameOperationName:@"OnLockScreenStatus"}} mutableCopy]; -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - SDLOnLockScreenStatus* testNotification = [[SDLOnLockScreenStatus alloc] initWithDictionary:dict]; -#pragma clang diagnostic pop - - expect(testNotification.driverDistractionStatus).to(equal(@NO)); - expect(testNotification.userSelected).to(equal(@3)); - expect(testNotification.lockScreenStatus).to(equal(SDLLockScreenStatusRequired)); - expect(testNotification.hmiLevel).to(equal(SDLHMILevelNone)); - }); - - it(@"Should return nil if not set", ^ { - SDLOnLockScreenStatus* testNotification = [[SDLOnLockScreenStatus alloc] init]; - - expect(testNotification.driverDistractionStatus).to(beNil()); - expect(testNotification.userSelected).to(beNil()); - expect(testNotification.lockScreenStatus).to(beNil()); - expect(testNotification.hmiLevel).to(beNil()); - }); -}); - -QuickSpecEnd -- cgit v1.2.1