summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Fischer <joeljfischer@gmail.com>2018-10-09 09:19:15 -0400
committerGitHub <noreply@github.com>2018-10-09 09:19:15 -0400
commiteb0840220da597a2ec536398b430eb8dba26e6bf (patch)
tree39e61a377f778f35aaa736e8e8eb0b6c747f6778
parent5790c282ac921a5109d2400cc94b3d64f090181d (diff)
parent1d031f0f8cd3ef8e0a2c44190b44f762e7264a59 (diff)
downloadsdl_ios-eb0840220da597a2ec536398b430eb8dba26e6bf.tar.gz
Merge pull request #1098 from smartdevicelink/bugfix/issue_1096_double_spec_file
Fix duplicate test file
-rw-r--r--SmartDeviceLinkTests/SDLStreamingAudioLifecycleManagerSpec.m420
1 files changed, 0 insertions, 420 deletions
diff --git a/SmartDeviceLinkTests/SDLStreamingAudioLifecycleManagerSpec.m b/SmartDeviceLinkTests/SDLStreamingAudioLifecycleManagerSpec.m
deleted file mode 100644
index ecd043840..000000000
--- a/SmartDeviceLinkTests/SDLStreamingAudioLifecycleManagerSpec.m
+++ /dev/null
@@ -1,420 +0,0 @@
-//
-// SDLStreamingAudioLifecycleManagerSpec.m
-// SmartDeviceLink-iOS
-//
-
-#import <Quick/Quick.h>
-#import <Nimble/Nimble.h>
-#import <OCMock/OCMock.h>
-
-#import "SDLConnectionManagerType.h"
-#import "SDLControlFramePayloadAudioStartServiceAck.h"
-#import "SDLControlFramePayloadConstants.h"
-#import "SDLControlFramePayloadNak.h"
-#import "SDLDisplayCapabilities.h"
-#import "SDLGenericResponse.h"
-#import "SDLGetSystemCapability.h"
-#import "SDLGetSystemCapabilityResponse.h"
-#import "SDLGlobals.h"
-#import "SDLFocusableItemLocatorType.h"
-#import "SDLFocusableItemLocator.h"
-#import "SDLHMILevel.h"
-#import "SDLImageResolution.h"
-#import "SDLNotificationConstants.h"
-#import "SDLOnHMIStatus.h"
-#import "SDLProtocol.h"
-#import "SDLRPCNotificationNotification.h"
-#import "SDLRegisterAppInterfaceResponse.h"
-#import "SDLRPCResponseNotification.h"
-#import "SDLScreenParams.h"
-#import "SDLStateMachine.h"
-#import "SDLStreamingMediaConfiguration.h"
-#import "SDLStreamingAudioLifecycleManager.h"
-#import "SDLFakeStreamingManagerDataSource.h"
-#import "SDLSystemCapability.h"
-#import "SDLV2ProtocolHeader.h"
-#import "SDLV2ProtocolMessage.h"
-#import "TestConnectionManager.h"
-
-QuickSpecBegin(SDLStreamingAudioLifecycleManagerSpec)
-
-describe(@"the audio streaming media manager", ^{
- __block SDLStreamingAudioLifecycleManager *streamingLifecycleManager = nil;
- __block SDLStreamingMediaConfiguration *testConfiguration = [SDLStreamingMediaConfiguration insecureConfiguration];
- __block TestConnectionManager *testConnectionManager = nil;
-
- __block void (^sendNotificationForHMILevel)(SDLHMILevel hmiLevel) = ^(SDLHMILevel hmiLevel) {
- SDLOnHMIStatus *hmiStatus = [[SDLOnHMIStatus alloc] init];
- hmiStatus.hmiLevel = hmiLevel;
- SDLRPCNotificationNotification *notification = [[SDLRPCNotificationNotification alloc] initWithName:SDLDidChangeHMIStatusNotification object:self rpcNotification:hmiStatus];
- [[NSNotificationCenter defaultCenter] postNotification:notification];
-
- [NSThread sleepForTimeInterval:0.3];
- };
-
- beforeEach(^{
- testConnectionManager = [[TestConnectionManager alloc] init];
- streamingLifecycleManager = [[SDLStreamingAudioLifecycleManager alloc] initWithConnectionManager:testConnectionManager configuration:testConfiguration];
- });
-
- it(@"should initialize properties", ^{
- expect(streamingLifecycleManager.audioManager).toNot(beNil());
- expect(@(streamingLifecycleManager.isStreamingSupported)).to(equal(@NO));
- expect(@(streamingLifecycleManager.isAudioConnected)).to(equal(@NO));
- expect(@(streamingLifecycleManager.isAudioEncrypted)).to(equal(@NO));
- expect(@(streamingLifecycleManager.requestedEncryptionType)).to(equal(@(SDLStreamingEncryptionFlagNone)));
- expect(streamingLifecycleManager.currentAppState).to(equal(SDLAppStateActive));
- expect(streamingLifecycleManager.currentAudioStreamState).to(equal(SDLAudioStreamStateStopped));
- });
-
- describe(@"when started", ^{
- __block BOOL readyHandlerSuccess = NO;
- __block NSError *readyHandlerError = nil;
-
- __block id protocolMock = OCMClassMock([SDLProtocol class]);
-
- beforeEach(^{
- readyHandlerSuccess = NO;
- readyHandlerError = nil;
-
- [streamingLifecycleManager startWithProtocol:protocolMock];
- });
-
- it(@"should be ready to stream", ^{
- expect(@(streamingLifecycleManager.isStreamingSupported)).to(equal(@NO));
- expect(@(streamingLifecycleManager.isAudioConnected)).to(equal(@NO));
- expect(@(streamingLifecycleManager.isAudioEncrypted)).to(equal(@NO));
- expect(streamingLifecycleManager.currentAppState).to(equal(SDLAppStateActive));
- expect(streamingLifecycleManager.currentAudioStreamState).to(match(SDLAudioStreamStateStopped));
- });
-
- describe(@"after receiving a register app interface notification", ^{
- __block SDLRegisterAppInterfaceResponse *someRegisterAppInterfaceResponse = nil;
- __block SDLDisplayCapabilities *someDisplayCapabilities = nil;
- __block SDLScreenParams *someScreenParams = nil;
- __block SDLImageResolution *someImageResolution = nil;
-
- beforeEach(^{
- someImageResolution = [[SDLImageResolution alloc] init];
- someImageResolution.resolutionWidth = @(600);
- someImageResolution.resolutionHeight = @(100);
-
- someScreenParams = [[SDLScreenParams alloc] init];
- someScreenParams.resolution = someImageResolution;
- });
-
- context(@"that does not support graphics", ^{
- beforeEach(^{
- someDisplayCapabilities = [[SDLDisplayCapabilities alloc] init];
- someDisplayCapabilities.graphicSupported = @NO;
-
- someDisplayCapabilities.screenParams = someScreenParams;
-
- someRegisterAppInterfaceResponse = [[SDLRegisterAppInterfaceResponse alloc] init];
- someRegisterAppInterfaceResponse.displayCapabilities = someDisplayCapabilities;
- SDLRPCResponseNotification *notification = [[SDLRPCResponseNotification alloc] initWithName:SDLDidReceiveRegisterAppInterfaceResponse object:self rpcResponse:someRegisterAppInterfaceResponse];
-
- [[NSNotificationCenter defaultCenter] postNotification:notification];
- [NSThread sleepForTimeInterval:0.1];
- });
-
- it(@"should not support streaming", ^{
- expect(@(streamingLifecycleManager.isStreamingSupported)).to(equal(@NO));
- });
- });
-
- context(@"that supports graphics", ^{
- beforeEach(^{
- someDisplayCapabilities = [[SDLDisplayCapabilities alloc] init];
- someDisplayCapabilities.graphicSupported = @YES;
-
- someDisplayCapabilities.screenParams = someScreenParams;
-
- someRegisterAppInterfaceResponse = [[SDLRegisterAppInterfaceResponse alloc] init];
- someRegisterAppInterfaceResponse.displayCapabilities = someDisplayCapabilities;
- SDLRPCResponseNotification *notification = [[SDLRPCResponseNotification alloc] initWithName:SDLDidReceiveRegisterAppInterfaceResponse object:self rpcResponse:someRegisterAppInterfaceResponse];
-
- [[NSNotificationCenter defaultCenter] postNotification:notification];
- [NSThread sleepForTimeInterval:0.1];
- });
-
- it(@"should support streaming", ^{
- expect(@(streamingLifecycleManager.isStreamingSupported)).to(equal(@YES));
- });
- });
- });
-
- describe(@"if the app state is active", ^{
- __block id streamStub = nil;
-
- beforeEach(^{
- streamStub = OCMPartialMock(streamingLifecycleManager);
-
- OCMStub([streamStub isStreamingSupported]).andReturn(YES);
-
- [streamingLifecycleManager.appStateMachine setToState:SDLAppStateActive fromOldState:nil callEnterTransition:NO];
- });
-
- describe(@"and audio stream is open", ^{
- beforeEach(^{
- [streamingLifecycleManager.audioStreamStateMachine setToState:SDLAudioStreamStateReady fromOldState:nil callEnterTransition:NO];
- });
-
- describe(@"and the hmi state is limited", ^{
- beforeEach(^{
- streamingLifecycleManager.hmiLevel = SDLHMILevelLimited;
- });
-
- describe(@"and the hmi state changes to", ^{
- context(@"none", ^{
- beforeEach(^{
- sendNotificationForHMILevel(SDLHMILevelNone);
- });
-
- it(@"should close audio stream", ^{
- expect(streamingLifecycleManager.currentAudioStreamState).to(equal(SDLAudioStreamStateShuttingDown));
- });
- });
-
- context(@"background", ^{
- beforeEach(^{
- sendNotificationForHMILevel(SDLHMILevelBackground);
- });
-
- it(@"should close audio stream", ^{
- expect(streamingLifecycleManager.currentAudioStreamState).to(equal(SDLAudioStreamStateShuttingDown));
- });
- });
-
- context(@"limited", ^{
- beforeEach(^{
- sendNotificationForHMILevel(SDLHMILevelLimited);
- });
-
- it(@"should not close audio stream", ^{
- expect(streamingLifecycleManager.currentAudioStreamState).to(equal(SDLAudioStreamStateReady));
- });
- });
-
- context(@"full", ^{
- beforeEach(^{
- sendNotificationForHMILevel(SDLHMILevelFull);
- });
-
- it(@"should not close audio stream", ^{
- expect(streamingLifecycleManager.currentAudioStreamState).to(equal(SDLAudioStreamStateReady));
- });
- });
- });
-
- describe(@"and the app state changes to", ^{
- context(@"inactive", ^{
- beforeEach(^{
- [streamingLifecycleManager.appStateMachine setToState:SDLAppStateInactive fromOldState:nil callEnterTransition:YES];
- });
-
- it(@"should shut down the video stream", ^{
- expect(streamingLifecycleManager.currentAudioStreamState).to(equal(SDLAudioStreamStateShuttingDown));
- });
- });
- });
- });
-
- describe(@"and the hmi state is full", ^{
- beforeEach(^{
- streamingLifecycleManager.hmiLevel = SDLHMILevelFull;
- });
-
- context(@"and hmi state changes to none", ^{
- beforeEach(^{
- sendNotificationForHMILevel(SDLHMILevelNone);
- });
-
- it(@"should close audio stream", ^{
- expect(streamingLifecycleManager.currentAudioStreamState).to(equal(SDLAudioStreamStateShuttingDown));
- });
- });
-
- context(@"and hmi state changes to background", ^{
- beforeEach(^{
- sendNotificationForHMILevel(SDLHMILevelBackground);
- });
-
- it(@"should close audio stream", ^{
- expect(streamingLifecycleManager.currentAudioStreamState).to(equal(SDLAudioStreamStateShuttingDown));
- });
- });
-
- context(@"and hmi state changes to limited", ^{
- beforeEach(^{
- sendNotificationForHMILevel(SDLHMILevelLimited);
- });
-
- it(@"should not close audio stream", ^{
- expect(streamingLifecycleManager.currentAudioStreamState).to(equal(SDLAudioStreamStateReady));
- });
- });
-
- context(@"and hmi state changes to full", ^{
- beforeEach(^{
- sendNotificationForHMILevel(SDLHMILevelFull);
- });
-
- it(@"should not close audio stream", ^{
- expect(streamingLifecycleManager.currentAudioStreamState).to(equal(SDLAudioStreamStateReady));
- });
- });
- });
- });
-
- describe(@"and audio stream is closed", ^{
- beforeEach(^{
- [streamingLifecycleManager.audioStreamStateMachine setToState:SDLAudioStreamStateStopped fromOldState:nil callEnterTransition:NO];
- });
-
- describe(@"and the hmi state is none", ^{
- beforeEach(^{
- streamingLifecycleManager.hmiLevel = SDLHMILevelNone;
- });
-
- context(@"and hmi state changes to none", ^{
- beforeEach(^{
- sendNotificationForHMILevel(SDLHMILevelNone);
- });
-
- it(@"should not start audio stream", ^{
- expect(streamingLifecycleManager.currentAudioStreamState).to(equal(SDLAudioStreamStateStopped));
- });
- });
-
- context(@"and hmi state changes to background", ^{
- beforeEach(^{
- sendNotificationForHMILevel(SDLHMILevelBackground);
- });
-
- it(@"should not start audio stream", ^{
- expect(streamingLifecycleManager.currentAudioStreamState).to(equal(SDLAudioStreamStateStopped));
- });
- });
-
- context(@"and hmi state changes to limited", ^{
- beforeEach(^{
- sendNotificationForHMILevel(SDLHMILevelLimited);
- });
-
- it(@"should start audio stream", ^{
- expect(streamingLifecycleManager.currentAudioStreamState).to(equal(SDLAudioStreamStateStarting));
- });
- });
-
- context(@"and hmi state changes to full", ^{
- beforeEach(^{
- sendNotificationForHMILevel(SDLHMILevelFull);
- });
-
- it(@"should start audio stream", ^{
- expect(streamingLifecycleManager.currentAudioStreamState).to(equal(SDLAudioStreamStateStarting));
- });
- });
- });
- });
- });
-
- describe(@"sending a video capabilities request", ^{
- describe(@"after receiving an Audio Start ACK", ^{
- __block SDLProtocolHeader *testAudioHeader = nil;
- __block SDLProtocolMessage *testAudioMessage = nil;
- __block SDLControlFramePayloadAudioStartServiceAck *testAudioStartServicePayload = nil;
- __block int64_t testMTU = 786579;
-
- beforeEach(^{
- [streamingLifecycleManager.audioStreamStateMachine setToState:SDLAudioStreamStateStarting fromOldState:nil callEnterTransition:NO];
-
- testAudioHeader = [[SDLV2ProtocolHeader alloc] initWithVersion:5];
- testAudioHeader.frameType = SDLFrameTypeSingle;
- testAudioHeader.frameData = SDLFrameInfoStartServiceACK;
- testAudioHeader.encrypted = YES;
- testAudioHeader.serviceType = SDLServiceTypeAudio;
-
- testAudioStartServicePayload = [[SDLControlFramePayloadAudioStartServiceAck alloc] initWithMTU:testMTU];
- testAudioMessage = [[SDLV2ProtocolMessage alloc] initWithHeader:testAudioHeader andPayload:testAudioStartServicePayload.data];
- [streamingLifecycleManager handleProtocolStartServiceACKMessage:testAudioMessage];
- });
-
- it(@"should have set all the right properties", ^{
- expect([[SDLGlobals sharedGlobals] mtuSizeForServiceType:SDLServiceTypeAudio]).to(equal(testMTU));
- expect(streamingLifecycleManager.audioEncrypted).to(equal(YES));
- expect(streamingLifecycleManager.currentAudioStreamState).to(equal(SDLAudioStreamStateReady));
- });
- });
-
- describe(@"after receiving an Audio Start NAK", ^{
- __block SDLProtocolHeader *testAudioHeader = nil;
- __block SDLProtocolMessage *testAudioMessage = nil;
-
- beforeEach(^{
- [streamingLifecycleManager.audioStreamStateMachine setToState:SDLAudioStreamStateStarting fromOldState:nil callEnterTransition:NO];
-
- testAudioHeader = [[SDLV2ProtocolHeader alloc] initWithVersion:5];
- testAudioHeader.frameType = SDLFrameTypeSingle;
- testAudioHeader.frameData = SDLFrameInfoStartServiceNACK;
- testAudioHeader.encrypted = NO;
- testAudioHeader.serviceType = SDLServiceTypeAudio;
-
- testAudioMessage = [[SDLV2ProtocolMessage alloc] initWithHeader:testAudioHeader andPayload:nil];
- [streamingLifecycleManager handleProtocolEndServiceACKMessage:testAudioMessage];
- });
-
- it(@"should have set all the right properties", ^{
- expect(streamingLifecycleManager.currentAudioStreamState).to(equal(SDLAudioStreamStateStopped));
- });
- });
-
- describe(@"after receiving a audio end ACK", ^{
- __block SDLProtocolHeader *testAudioHeader = nil;
- __block SDLProtocolMessage *testAudioMessage = nil;
-
- beforeEach(^{
- [streamingLifecycleManager.audioStreamStateMachine setToState:SDLAudioStreamStateStarting fromOldState:nil callEnterTransition:NO];
-
- testAudioHeader = [[SDLV2ProtocolHeader alloc] initWithVersion:5];
- testAudioHeader.frameType = SDLFrameTypeSingle;
- testAudioHeader.frameData = SDLFrameInfoEndServiceACK;
- testAudioHeader.encrypted = NO;
- testAudioHeader.serviceType = SDLServiceTypeAudio;
-
- testAudioMessage = [[SDLV2ProtocolMessage alloc] initWithHeader:testAudioHeader andPayload:nil];
- [streamingLifecycleManager handleProtocolEndServiceACKMessage:testAudioMessage];
- });
-
- it(@"should have set all the right properties", ^{
- expect(streamingLifecycleManager.currentAudioStreamState).to(equal(SDLAudioStreamStateStopped));
- });
- });
-
- describe(@"after receiving a audio end NAK", ^{
- __block SDLProtocolHeader *testAudioHeader = nil;
- __block SDLProtocolMessage *testAudioMessage = nil;
-
- beforeEach(^{
- [streamingLifecycleManager.audioStreamStateMachine setToState:SDLAudioStreamStateStarting fromOldState:nil callEnterTransition:NO];
-
- testAudioHeader = [[SDLV2ProtocolHeader alloc] initWithVersion:5];
- testAudioHeader.frameType = SDLFrameTypeSingle;
- testAudioHeader.frameData = SDLFrameInfoEndServiceNACK;
- testAudioHeader.encrypted = NO;
- testAudioHeader.serviceType = SDLServiceTypeAudio;
-
- testAudioMessage = [[SDLV2ProtocolMessage alloc] initWithHeader:testAudioHeader andPayload:nil];
- [streamingLifecycleManager handleProtocolEndServiceNAKMessage:testAudioMessage];
- });
-
- it(@"should have set all the right properties", ^{
- expect(streamingLifecycleManager.currentAudioStreamState).to(equal(SDLAudioStreamStateStopped));
- });
- });
- });
- });
-});
-
-QuickSpecEnd