/
SDLLifecycleManagerSpec.m
974 lines (787 loc) 路 51.7 KB
/
SDLLifecycleManagerSpec.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
#import <Quick/Quick.h>
#import <Nimble/Nimble.h>
#import <OCMock/OCMock.h>
#import "SDLExpect.h"
#import "SDLLifecycleManager.h"
#import <SmartDeviceLink/SmartDeviceLink.h>
#import "SDLConnectionManagerType.h"
#import "SDLEncryptionLifecycleManager.h"
#import "SDLError.h"
#import "SDLGlobals.h"
#import "SDLLifecycleProtocolHandler.h"
#import "SDLLockScreenManager.h"
#import "SDLNotificationDispatcher.h"
#import "SDLProtocol.h"
#import "SDLRPCNotificationNotification.h"
#import "SDLSecondaryTransportManager.h"
#import "SDLStateMachine.h"
@interface SDLStreamingMediaManager ()
@property (strong, nonatomic, nullable) SDLSecondaryTransportManager *secondaryTransportManager;
- (void)startSecondaryTransportWithProtocol:(SDLProtocol *)protocol;
@end
@interface SDLSystemCapabilityManager ()
@property (nullable, strong, nonatomic) NSString *lastDisplayLayoutRequestTemplate;
@end
@interface SDLLifecycleManager ()
// this private property is used for testing
@property (copy, nonatomic) dispatch_queue_t lifecycleQueue;
@property (assign, nonatomic) int32_t lastCorrelationId;
@property (strong, nonatomic) SDLLanguage currentVRLanguage;
@property (strong, nonatomic, nullable) SDLSecondaryTransportManager *secondaryTransportManager;
@property (strong, nonatomic) SDLEncryptionLifecycleManager *encryptionLifecycleManager;
@property (strong, nonatomic, nullable) SDLLifecycleProtocolHandler *protocolHandler;
@property (copy, nonatomic, readwrite, nullable) SDLHMILevel hmiLevel;
@property (copy, nonatomic, readwrite, nullable) SDLAudioStreamingState audioStreamingState;
@property (copy, nonatomic, readwrite, nullable) SDLVideoStreamingState videoStreamingState;
@property (copy, nonatomic, readwrite, nullable) SDLSystemContext systemContext;
@property (strong, nonatomic, readwrite, nullable) SDLRegisterAppInterfaceResponse *registerResponse;
@property (strong, nonatomic, readwrite, nullable) SDLSystemInfo *systemInfo;
- (void)didEnterStateConnected;
@end
@interface SDLLifecycleTestManager : SDLLifecycleManager
- (void)sendConnectionManagerRequest:(__kindof SDLRPCMessage *)request withResponseHandler:(nullable SDLResponseHandler)handler;
@property (strong, nonatomic, nullable) __kindof SDLRPCMessage *testRequest;
@end
@implementation SDLLifecycleTestManager
- (void)sendConnectionManagerRequest:(__kindof SDLRPCMessage *)request withResponseHandler:(nullable SDLResponseHandler)handler {
self.testRequest = request;
}
@end
@interface SDLGlobals ()
@property (copy, nonatomic, readwrite) SDLVersion *protocolVersion;
@end
QuickConfigurationBegin(SendingRPCsConfiguration)
+ (void)configure:(QCKConfiguration *)configuration {
sharedExamples(@"unable to send an RPC", ^(QCKDSLSharedExampleContext exampleContext) {
it(@"cannot publicly send RPCs", ^{
SDLLifecycleManager *testManager = exampleContext()[@"manager"];
SDLShow *testShow = [[SDLShow alloc] initWithMainField1:@"test" mainField2:nil mainField3:nil mainField4:nil alignment:nil statusBar:nil mediaTrack:nil graphic:nil secondaryGraphic:nil softButtons:nil customPresets:nil metadataTags:nil templateTitle:nil windowID:nil templateConfiguration:nil];
[testManager sendRequest:testShow withResponseHandler:^(__kindof SDLRPCRequest * _Nullable request, __kindof SDLRPCResponse * _Nullable response, NSError * _Nullable error) {
expect(error).to(equal([NSError sdl_lifecycle_notReadyError]));
}];
});
});
}
QuickConfigurationEnd
QuickSpecBegin(SDLLifecycleManagerSpec)
// test lifecycle manager internals
describe(@"test lifecycle manager internals", ^{
context(@"init and assign version", ^{
SDLLifecycleTestManager *manager = [[SDLLifecycleTestManager alloc] init];
it(@"expect object to be created", ^{
expect(manager).notTo(beNil());
});
context(@"didEnterStateConnected", ^{
[manager didEnterStateConnected];
it(@"expect request to be of proper kind", ^{
expect([manager.testRequest isKindOfClass:SDLRegisterAppInterface.class]).to(equal(YES));
});
});
});
});
// a lifecycle manager
describe(@"a lifecycle manager", ^{
__block SDLLifecycleManager *testManager = nil;
__block SDLConfiguration *testConfig = nil;
__block SDLProtocol *protocolMock = nil;
__block id sdlManagerDelegateProtocolMock = nil;
__block id lockScreenManagerMock = nil;
__block id fileManagerMock = nil;
__block id permissionManagerMock = nil;
__block id streamingManagerMock = nil;
__block id systemCapabilityMock = nil;
__block id secondaryTransportManagerMock = nil;
__block id encryptionManagerMock = nil;
SDLVehicleType *vehicleType = [[SDLVehicleType alloc] initWithMake:@"Make" model:@"Model" modelYear:@"Model Year" trim:@"Trim"];
NSString *softwareVersion = @"1.1.1.1";
NSString *hardwareVersion = @"2.2.2.2";
void (^transitionToState)(SDLState *) = ^(SDLState *state) {
dispatch_sync(testManager.lifecycleQueue, ^{
[testManager.lifecycleStateMachine transitionToState:state];
});
};
void (^setToStateWithEnterTransition)(SDLState *, SDLState *) = ^(SDLState *oldState, SDLState *newState) {
dispatch_sync(testManager.lifecycleQueue, ^{
[testManager.lifecycleStateMachine setToState:newState fromOldState:oldState callEnterTransition:YES];
});
};
beforeEach(^{
protocolMock = OCMClassMock([SDLProtocol class]);
sdlManagerDelegateProtocolMock = OCMProtocolMock(@protocol(SDLManagerDelegate));
lockScreenManagerMock = OCMClassMock([SDLLockScreenManager class]);
fileManagerMock = OCMClassMock([SDLFileManager class]);
permissionManagerMock = OCMClassMock([SDLPermissionManager class]);
streamingManagerMock = OCMClassMock([SDLStreamingMediaManager class]);
systemCapabilityMock = OCMClassMock([SDLSystemCapabilityManager class]);
secondaryTransportManagerMock = OCMClassMock([SDLSecondaryTransportManager class]);
encryptionManagerMock = OCMClassMock([SDLEncryptionLifecycleManager class]);
SDLLifecycleConfiguration *testLifecycleConfig = [SDLLifecycleConfiguration defaultConfigurationWithAppName:@"Test App" fullAppId:@"TestFullAppID"];
testLifecycleConfig.shortAppName = @"Short Name";
testLifecycleConfig.appType = SDLAppHMITypeNavigation;
testConfig = [[SDLConfiguration alloc] initWithLifecycle:testLifecycleConfig lockScreen:[SDLLockScreenConfiguration disabledConfiguration] logging:[SDLLogConfiguration defaultConfiguration] streamingMedia:[SDLStreamingMediaConfiguration insecureConfiguration] fileManager:[SDLFileManagerConfiguration defaultConfiguration] encryption:[SDLEncryptionConfiguration defaultConfiguration]];
testConfig.lifecycleConfig.languagesSupported = @[SDLLanguageEnUs, SDLLanguageEnGb];
testConfig.lifecycleConfig.language = SDLLanguageEnUs;
testConfig.lifecycleConfig.minimumProtocolVersion = [SDLVersion versionWithMajor:2 minor:0 patch:0];
testConfig.lifecycleConfig.minimumRPCVersion = [SDLVersion versionWithMajor:2 minor:0 patch:0];
testManager = [[SDLLifecycleManager alloc] initWithConfiguration:testConfig delegate:sdlManagerDelegateProtocolMock];
testManager.lockScreenManager = lockScreenManagerMock;
testManager.fileManager = fileManagerMock;
testManager.permissionManager = permissionManagerMock;
testManager.streamManager = streamingManagerMock;
testManager.systemCapabilityManager = systemCapabilityMock;
testManager.secondaryTransportManager = secondaryTransportManagerMock;
testManager.encryptionLifecycleManager = encryptionManagerMock;
[SDLGlobals sharedGlobals].protocolVersion = [SDLVersion versionWithMajor:3 minor:0 patch:0];
[SDLGlobals sharedGlobals].rpcVersion = [SDLVersion versionWithMajor:3 minor:0 patch:0];
});
// should initialize properties
it(@"should initialize properties", ^{
expect(testManager.configuration).toNot(equal(testConfig)); // This is copied
expect(testManager.delegate).toNot(beNil());
expect(testManager.lifecycleState).to(match(SDLLifecycleStateStopped));
expect(@(testManager.lastCorrelationId)).to(equal(@0));
expect(testManager.fileManager).toNot(beNil());
expect(testManager.permissionManager).toNot(beNil());
expect(testManager.streamManager).toNot(beNil());
expect(testManager.registerResponse).to(beNil());
expect(testManager.lockScreenManager).toNot(beNil());
expect(testManager.notificationDispatcher).toNot(beNil());
expect(testManager.responseDispatcher).toNot(beNil());
expect(testManager.streamManager).toNot(beNil());
expect(testManager.systemCapabilityManager).toNot(beNil());
expect(testManager.rpcOperationQueue).toNot(beNil());
expect(@([testManager conformsToProtocol:@protocol(SDLConnectionManagerType)])).to(equal(@YES));
expect(testManager.authToken).to(beNil());
expect(testManager.currentVRLanguage).toNot(beNil());
});
itBehavesLike(@"unable to send an RPC", ^{ return @{ @"manager": testManager }; });
// after receiving an HMI Status
describe(@"after receiving an HMI Status", ^{
__block SDLOnHMIStatus *testHMIStatus = nil;
__block SDLHMILevel testHMILevel = nil;
beforeEach(^{
testHMIStatus = [[SDLOnHMIStatus alloc] init];
});
// a non-none hmi level
context(@"a non-none hmi level", ^{
beforeEach(^{
testHMILevel = SDLHMILevelNone;
testHMIStatus.hmiLevel = testHMILevel;
[testManager.notificationDispatcher postRPCNotificationNotification:SDLDidChangeHMIStatusNotification notification:testHMIStatus];
});
it(@"should set the hmi level", ^{
expect(testManager.hmiLevel).to(equal(testHMILevel));
});
});
// a non-full, non-none hmi level
context(@"a non-full, non-none hmi level", ^{
beforeEach(^{
testHMILevel = SDLHMILevelBackground;
testHMIStatus.hmiLevel = testHMILevel;
[testManager.notificationDispatcher postRPCNotificationNotification:SDLDidChangeHMIStatusNotification notification:testHMIStatus];
});
it(@"should set the hmi level", ^{
expect(testManager.hmiLevel).to(equal(testHMILevel));
});
});
// a full hmi level
context(@"a full hmi level", ^{
beforeEach(^{
testHMILevel = SDLHMILevelFull;
testHMIStatus.hmiLevel = testHMILevel;
[testManager.notificationDispatcher postRPCNotificationNotification:SDLDidChangeHMIStatusNotification notification:testHMIStatus];
});
it(@"should set the hmi level", ^{
expect(testManager.hmiLevel).to(equal(testHMILevel));
});
});
});
// calling stop
describe(@"calling stop", ^{
beforeEach(^{
[testManager stop];
});
it(@"should do nothing", ^{
expect(testManager.lifecycleState).to(match(SDLLifecycleStateStopped));
expect(testManager.lifecycleState).toNot(match(SDLLifecycleStateStarted));
});
});
// when started
describe(@"when started", ^{
__block BOOL readyHandlerSuccess = NO;
__block NSError *readyHandlerError = nil;
beforeEach(^{
readyHandlerSuccess = NO;
readyHandlerError = nil;
[testManager startWithReadyHandler:^(BOOL success, NSError * _Nullable error) {
readyHandlerSuccess = success;
readyHandlerError = error;
}];
testManager.protocolHandler.protocol = protocolMock;
});
it(@"should initialize enter the started state and start the secondary transport", ^{
expect(testManager.lifecycleState).to(match(SDLLifecycleStateStarted));
expect(testManager.secondaryTransportManager).toNot(beNil());
});
// after receiving a connect notification
describe(@"after receiving a connect notification", ^{
// should send a register app interface request and be in the connected state
it(@"should send a register app interface request and be in the connected state", ^{
OCMStub([protocolMock sendRPC:[OCMArg any] error:[OCMArg setTo:nil]]).andReturn(YES);
// When we connect, we should be creating an sending an RAI
[testManager.notificationDispatcher postNotificationName:SDLRPCServiceDidConnect infoObject:nil];
[NSThread sleepForTimeInterval:SDLExpect.timeout];
expect(testManager.lifecycleState).to(equal(SDLLifecycleStateConnected));
});
itBehavesLike(@"unable to send an RPC", ^{ return @{ @"manager": testManager }; });
// when the protocol system info is set
context(@"when the protocol system info is set", ^{
SDLSystemInfo *testSystemInfo = [[SDLSystemInfo alloc] initWithVehicleType:vehicleType softwareVersion:softwareVersion hardwareVersion:hardwareVersion];
it(@"should call the delegate handler", ^{
OCMStub(protocolMock.systemInfo).andReturn(testSystemInfo);
OCMExpect([sdlManagerDelegateProtocolMock didReceiveSystemInfo:[OCMArg isEqual:testSystemInfo]]).andReturn(YES);
[testManager.notificationDispatcher postNotificationName:SDLRPCServiceDidConnect infoObject:nil];
OCMVerifyAllWithDelay(sdlManagerDelegateProtocolMock, 1.0);
});
});
// when the protocol system info is not set
context(@"when the protocol system info is not set", ^{
beforeEach(^{
OCMStub(protocolMock.systemInfo).andReturn(nil);
[testManager.notificationDispatcher postNotificationName:SDLRPCServiceDidConnect infoObject:nil];
});
it(@"should call the delegate handler", ^{
OCMReject([sdlManagerDelegateProtocolMock didReceiveSystemInfo:[OCMArg isNil]]);
});
});
// after receiving a disconnect notification"
describe(@"after receiving a disconnect notification", ^{
beforeEach(^{
OCMStub([protocolMock sendRPC:[OCMArg any] error:[OCMArg setTo:nil]]).andReturn(YES);
[testManager.notificationDispatcher postNotificationName:SDLRPCServiceDidConnect infoObject:nil];
[testManager.notificationDispatcher postNotificationName:SDLTransportDidDisconnect infoObject:nil];
});
it(@"should be in the started state", ^{
expect(testManager.lifecycleState).to(equal(SDLLifecycleStateReconnecting));
});
});
// stopping the manager
describe(@"stopping the manager", ^{
it(@"should simply stop", ^{
[testManager.notificationDispatcher postNotificationName:SDLRPCServiceDidConnect infoObject:nil];
[testManager stop];
expect(testManager.lifecycleState).to(equal(SDLLifecycleStateStopped));
});
});
});
// in the connected state when the minimum protocol version is in effect
describe(@"in the connected state when the minimum protocol version is in effect", ^{
beforeEach(^{
[SDLGlobals sharedGlobals].protocolVersion = [SDLVersion versionWithMajor:1 minor:0 patch:0];
OCMExpect([protocolMock endServiceWithType:SDLServiceTypeRPC]);
[testManager.lifecycleStateMachine setToState:SDLLifecycleStateConnected fromOldState:nil callEnterTransition:YES];
});
it(@"should disconnect", ^{
OCMVerifyAll(protocolMock);
});
});
// in the connected state
describe(@"in the connected state", ^{
beforeEach(^{
[testManager.lifecycleStateMachine setToState:SDLLifecycleStateConnected fromOldState:nil callEnterTransition:NO];
});
// after receiving another connect notification for encryption
describe(@"after receiving another connect notification for encryption", ^{
it(@"should not crash", ^{
expectAction(^{
[testManager.notificationDispatcher postNotificationName:SDLRPCServiceDidConnect infoObject:nil];
}).toNot(raiseException());
});
});
// after receiving a register app interface response
describe(@"after receiving a register app interface response", ^{
it(@"should eventually reach the ready state", ^{
NSError *fileManagerStartError = [NSError errorWithDomain:@"testDomain" code:0 userInfo:nil];
NSError *permissionManagerStartError = [NSError errorWithDomain:@"testDomain" code:0 userInfo:nil];
OCMStub([fileManagerMock startWithCompletionHandler:([OCMArg invokeBlockWithArgs:@(YES), fileManagerStartError, nil])]);
OCMStub([permissionManagerMock startWithCompletionHandler:([OCMArg invokeBlockWithArgs:@(YES), permissionManagerStartError, nil])]);
// Make sure we have an HMI status to move the lifecycle forward
testManager.hmiLevel = SDLHMILevelFull;
transitionToState(SDLLifecycleStateRegistered);
[NSThread sleepForTimeInterval:SDLExpect.timeout];
expect(testManager.lifecycleState).to(equal(SDLLifecycleStateReady));
OCMVerify([(SDLLockScreenManager *)lockScreenManagerMock start]);
OCMVerify([(SDLSystemCapabilityManager *)systemCapabilityMock start]);
OCMVerify([fileManagerMock startWithCompletionHandler:[OCMArg any]]);
OCMVerify([permissionManagerMock startWithCompletionHandler:[OCMArg any]]);
OCMVerify([encryptionManagerMock startWithProtocol:[OCMArg any]]);
});
itBehavesLike(@"unable to send an RPC", ^{ return @{ @"manager": testManager }; });
});
// when the protocol system info is not set
context(@"when the protocol system info is not set", ^{
beforeEach(^{
testManager.systemInfo = nil;
OCMExpect([sdlManagerDelegateProtocolMock didReceiveSystemInfo:[OCMArg isNotNil]]).andReturn(YES);
});
it(@"should call the delegate handler", ^{
SDLRegisterAppInterfaceResponse *response = [[SDLRegisterAppInterfaceResponse alloc] init];
response.resultCode = SDLResultSuccess;
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated"
response.vehicleType = vehicleType;
response.systemSoftwareVersion = softwareVersion;
#pragma clang diagnostic pop
testManager.registerResponse = response;
[testManager.lifecycleStateMachine setToState:SDLLifecycleStateRegistered fromOldState:nil callEnterTransition:YES];
OCMVerifyAllWithDelay(sdlManagerDelegateProtocolMock, 1.0);
});
});
// when the protocol system info is set
context(@"when the protocol system info is set", ^{
SDLSystemInfo *testSystemInfo = [[SDLSystemInfo alloc] initWithVehicleType:vehicleType softwareVersion:softwareVersion hardwareVersion:hardwareVersion];
beforeEach(^{
testManager.systemInfo = testSystemInfo;
});
it(@"should call not the delegate handler", ^{
SDLRegisterAppInterfaceResponse *response = [[SDLRegisterAppInterfaceResponse alloc] init];
response.resultCode = SDLResultSuccess;
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated"
response.vehicleType = vehicleType;
response.systemSoftwareVersion = softwareVersion;
#pragma clang diagnostic pop
[testManager.lifecycleStateMachine setToState:SDLLifecycleStateRegistered fromOldState:nil callEnterTransition:YES];
OCMReject([sdlManagerDelegateProtocolMock didReceiveSystemInfo:[OCMArg isNotNil]]);
});
});
// when the register response returns different language than the one passed with the lifecycle configuration
context(@"when the register response returns different language than the one passed with the lifecycle configuration", ^{
it(@"should should update the configuration when the app supports the head unit language", ^{
SDLRegisterAppInterfaceResponse *registerAppInterfaceResponse = [[SDLRegisterAppInterfaceResponse alloc] init];
registerAppInterfaceResponse.success = @YES;
registerAppInterfaceResponse.resultCode = SDLResultWrongLanguage;
registerAppInterfaceResponse.info = @"Language mismatch";
registerAppInterfaceResponse.language = SDLLanguageEnGb;
registerAppInterfaceResponse.hmiDisplayLanguage = SDLLanguageEnGb;
testManager.registerResponse = registerAppInterfaceResponse;
SDLLifecycleConfigurationUpdate *update = [[SDLLifecycleConfigurationUpdate alloc] initWithAppName:@"EnGb" shortAppName:@"E" ttsName:[SDLTTSChunk textChunksFromString:@"EnGb ttsName"] voiceRecognitionCommandNames:@[@"EnGb", @"Gb"]];
OCMStub([testManager.delegate managerShouldUpdateLifecycleToLanguage:[OCMArg any] hmiLanguage:[OCMArg any]]).andReturn(update);
OCMExpect([protocolMock sendRPC:[OCMArg checkWithBlock:^BOOL(id value) {
SDLChangeRegistration *changeRegistration = (SDLChangeRegistration *)value;
expect(changeRegistration.appName).to(equal(update.appName));
expect(changeRegistration.ngnMediaScreenAppName).to(equal(update.shortAppName));
expect(changeRegistration.ttsName).to(equal(update.ttsName));
expect(changeRegistration.vrSynonyms).to(equal(@[@"EnGb", @"Gb"]));
return [value isKindOfClass:[SDLChangeRegistration class]];
}] error:[OCMArg anyObjectRef]]);
setToStateWithEnterTransition(SDLLifecycleStateRegistered, SDLLifecycleStateUpdatingConfiguration);
OCMVerifyAllWithDelay(protocolMock, 0.5);
expect(testManager.configuration.lifecycleConfig.language).to(equal(SDLLanguageEnGb));
expect(testManager.currentVRLanguage).to(equal(SDLLanguageEnGb));
expect(testManager.configuration.lifecycleConfig.appName).to(equal(@"EnGb"));
expect(testManager.configuration.lifecycleConfig.shortAppName).to(equal(@"E"));
expect(testManager.configuration.lifecycleConfig.ttsName).to(equal([SDLTTSChunk textChunksFromString:@"EnGb ttsName"]));
});
it(@"should not update the configuration when the app does not support the head unit language or display language", ^{
SDLRegisterAppInterfaceResponse *registerAppInterfaceResponse = [[SDLRegisterAppInterfaceResponse alloc] init];
registerAppInterfaceResponse.success = @YES;
registerAppInterfaceResponse.resultCode = SDLResultWrongLanguage;
registerAppInterfaceResponse.info = @"Language mismatch";
registerAppInterfaceResponse.language = SDLLanguageDeDe;
registerAppInterfaceResponse.hmiDisplayLanguage = SDLLanguageDeDe;
testManager.registerResponse = registerAppInterfaceResponse;
OCMStub([testManager.delegate managerShouldUpdateLifecycleToLanguage:[OCMArg any] hmiLanguage:[OCMArg any]]).andReturn(nil);
setToStateWithEnterTransition(SDLLifecycleStateRegistered, SDLLifecycleStateUpdatingConfiguration);
OCMVerifyAllWithDelay(protocolMock, 0.5);
expect(testManager.configuration.lifecycleConfig.language).to(equal(SDLLanguageEnUs));
expect(testManager.currentVRLanguage).to(equal(SDLLanguageEnUs));
expect(testManager.configuration.lifecycleConfig.appName).to(equal(@"Test App"));
expect(testManager.configuration.lifecycleConfig.shortAppName).to(equal(@"Short Name"));
expect(testManager.configuration.lifecycleConfig.ttsName).to(beNil());
});
it(@"should update when the app supports the head unit display language", ^{
SDLRegisterAppInterfaceResponse *registerAppInterfaceResponse = [[SDLRegisterAppInterfaceResponse alloc] init];
registerAppInterfaceResponse.success = @YES;
registerAppInterfaceResponse.resultCode = SDLResultWrongLanguage;
registerAppInterfaceResponse.info = @"Language mismatch";
registerAppInterfaceResponse.language = SDLLanguageEnUs;
registerAppInterfaceResponse.hmiDisplayLanguage = SDLLanguageEnGb;
testManager.registerResponse = registerAppInterfaceResponse;
SDLLifecycleConfigurationUpdate *update = [[SDLLifecycleConfigurationUpdate alloc] initWithAppName:@"EnGb" shortAppName:@"Gb" ttsName:nil voiceRecognitionCommandNames:nil];
OCMStub([testManager.delegate managerShouldUpdateLifecycleToLanguage:registerAppInterfaceResponse.language hmiLanguage:registerAppInterfaceResponse.hmiDisplayLanguage]).andReturn(update);
setToStateWithEnterTransition(SDLLifecycleStateRegistered, SDLLifecycleStateUpdatingConfiguration);
OCMExpect([protocolMock sendRPC:[OCMArg checkWithBlock:^BOOL(id value) {
SDLChangeRegistration *changeRegistration = (SDLChangeRegistration *)value;
expect(changeRegistration.appName).to(equal(update.appName));
expect(changeRegistration.ngnMediaScreenAppName).to(equal(update.shortAppName));
expect(changeRegistration.ttsName).to(beNil());
expect(changeRegistration.vrSynonyms).to(beNil());
return [value isKindOfClass:[SDLChangeRegistration class]];
}] error:[OCMArg anyObjectRef]]);
setToStateWithEnterTransition(SDLLifecycleStateRegistered, SDLLifecycleStateUpdatingConfiguration);
OCMVerifyAllWithDelay(protocolMock, 0.5);
expect(testManager.configuration.lifecycleConfig.language).to(equal(SDLLanguageEnGb));
expect(testManager.currentVRLanguage).to(equal(SDLLanguageEnUs));
expect(testManager.configuration.lifecycleConfig.appName).to(equal(@"EnGb"));
expect(testManager.configuration.lifecycleConfig.shortAppName).to(equal(@"Gb"));
expect(testManager.configuration.lifecycleConfig.ttsName).to(beNil());
});
});
// after receiving a disconnect notification
describe(@"after receiving a disconnect notification", ^{
beforeEach(^{
OCMStub([protocolMock stopWithCompletionHandler:[OCMArg invokeBlock]]);
OCMStub([secondaryTransportManagerMock stopWithCompletionHandler:[OCMArg invokeBlock]]);
[testManager.notificationDispatcher postNotificationName:SDLTransportDidDisconnect infoObject:nil];
});
it(@"should enter the started state", ^{
[NSThread sleepForTimeInterval:SDLExpect.timeout];
expect(testManager.lifecycleState).to(equal(SDLLifecycleStateStarted));
});
});
// stopping the manager
describe(@"stopping the manager", ^{
beforeEach(^{
[testManager stop];
});
it(@"should enter the stopped state", ^{
expect(testManager.lifecycleState).to(equal(SDLLifecycleStateStopped));
});
});
});
// transitioning to the registered state when the minimum RPC version is in effect
describe(@"transitioning to the registered state when the minimum RPC version is in effect", ^{
beforeEach(^{
OCMStub([protocolMock sendRPC:[OCMArg any] error:[OCMArg setTo:nil]]).andReturn(YES);
[SDLGlobals sharedGlobals].rpcVersion = [SDLVersion versionWithMajor:1 minor:0 patch:0];
[testManager.lifecycleStateMachine setToState:SDLLifecycleStateRegistered fromOldState:nil callEnterTransition:YES];
});
it(@"should disconnect", ^{
expect(testManager.lifecycleState).to(equal(SDLLifecycleStateUnregistering));
});
});
// transitioning from setting app icon state to the Setting Up HMI state
describe(@"transitioning from setting app icon state to the Setting Up HMI state", ^{
context(@"before register response is a success", ^{
it(@"ready handler should not be called yet", ^{
SDLRegisterAppInterfaceResponse *response = [[SDLRegisterAppInterfaceResponse alloc] init];
response.resultCode = SDLResultSuccess;
testManager.registerResponse = response;
setToStateWithEnterTransition(nil, SDLLifecycleStateSettingUpHMI);
expect(@(readyHandlerSuccess)).to(equal(@NO));
expect(readyHandlerError).to(beNil());
});
});
context(@"assume hmi status is nil", ^{
it(@"mock notification and ensure state changes to ready", ^{
__block SDLOnHMIStatus *testHMIStatus = nil;
__block SDLHMILevel testHMILevel = nil;
testHMIStatus = [[SDLOnHMIStatus alloc] init];
SDLRegisterAppInterfaceResponse *response = [[SDLRegisterAppInterfaceResponse alloc] init];
response.resultCode = SDLResultSuccess;
testManager.registerResponse = response;
setToStateWithEnterTransition(nil, SDLLifecycleStateSettingUpHMI);
testHMILevel = SDLHMILevelFull;
testHMIStatus.hmiLevel = testHMILevel;
[testManager.notificationDispatcher postRPCNotificationNotification:SDLDidChangeHMIStatusNotification notification:testHMIStatus];
expect(testManager.lifecycleState).to(equal(SDLLifecycleStateReady));
expect(@(readyHandlerSuccess)).to(equal(@YES));
expect(readyHandlerError).to(beNil());
});
});
});
// transitioning from the registered state to the ready state
describe(@"transitioning from the registered state to the ready state", ^{
beforeEach(^{
[testManager.lifecycleStateMachine setToState:SDLLifecycleStateRegistered fromOldState:nil callEnterTransition:NO];
});
// when the register response is a success
context(@"when the register response is a success", ^{
it(@"should call the ready handler with success", ^{
SDLRegisterAppInterfaceResponse *response = [[SDLRegisterAppInterfaceResponse alloc] init];
response.resultCode = SDLResultSuccess;
testManager.registerResponse = response;
setToStateWithEnterTransition(nil, SDLLifecycleStateReady);
expect(@(readyHandlerSuccess)).to(equal(@YES));
expect(readyHandlerError).to(beNil());
});
});
// when the register response is a warning
context(@"when the register response is a warning", ^{
it(@"should call the ready handler with success but error", ^{
SDLRegisterAppInterfaceResponse *response = [[SDLRegisterAppInterfaceResponse alloc] init];
response.resultCode = SDLResultWarnings;
response.info = @"some info";
testManager.registerResponse = response;
setToStateWithEnterTransition(nil, SDLLifecycleStateReady);
expect(@(readyHandlerSuccess)).to(equal(@YES));
expect(readyHandlerError).toNot(beNil());
expect(@(readyHandlerError.code)).to(equal(@(SDLManagerErrorRegistrationSuccessWithWarning)));
expect(readyHandlerError.userInfo[NSLocalizedFailureReasonErrorKey]).to(match(response.info));
});
});
});
// in the ready state
describe(@"in the ready state", ^{
beforeEach(^{
[testManager.lifecycleStateMachine setToState:SDLLifecycleStateReady fromOldState:nil callEnterTransition:NO];
});
// after receiving another connect notification for encryption
describe(@"after receiving another connect notification for encryption", ^{
it(@"should not crash and remain in the same state", ^{
expectAction(^{
[testManager.notificationDispatcher postNotificationName:SDLRPCServiceDidConnect infoObject:nil];
}).toNot(raiseException());
expect(testManager.lifecycleState).to(equal(SDLLifecycleStateReady));
});
});
describe(@"when sending a request RPC", ^{
it(@"can send the RPC", ^{
SDLShow *testShow = [[SDLShow alloc] initWithMainField1:@"test" mainField2:nil mainField3:nil mainField4:nil alignment:nil statusBar:nil mediaTrack:nil graphic:nil secondaryGraphic:nil softButtons:nil customPresets:nil metadataTags:nil templateTitle:nil windowID:nil templateConfiguration:nil];
OCMExpect([protocolMock sendRPC:testShow error:[OCMArg anyObjectRef]]);
[testManager sendRPC:testShow];
OCMVerifyAllWithDelay(protocolMock, 0.1);
});
describe(@"when sending a SetDisplayLayout request", ^{
beforeEach(^{
OCMExpect([systemCapabilityMock setLastDisplayLayoutRequestTemplate:[OCMArg isKindOfClass:NSString.class]]);
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated"
SDLSetDisplayLayout *request = [[SDLSetDisplayLayout alloc] initWithPredefinedLayout:SDLPredefinedLayoutMedia];
#pragma clang diagnostic pop
[testManager sendRequest:request withResponseHandler:nil];
});
it(@"should update the System Capability Manager with the next template type", ^{
OCMVerifyAllWithDelay(systemCapabilityMock, 0.3);
});
});
});
it(@"should call the callback if the protocol fails to send a request", ^{
NSError *testError = [NSError sdl_lifecycle_notReadyError];
OCMStub([protocolMock sendRPC:[OCMArg any] error:[OCMArg setTo:testError]]).andReturn(NO);
SDLShow *testShow = [[SDLShow alloc] init];
testShow.mainField1 = @"Test";
__block SDLRPCRequest *returnRequest = nil;
__block SDLRPCResponse *returnResponse = nil;
__block NSError *returnError = nil;
[testManager sendRequest:testShow withResponseHandler:^(__kindof SDLRPCRequest * _Nullable request, __kindof SDLRPCResponse * _Nullable response, NSError * _Nullable error) {
returnRequest = request;
returnResponse = response;
returnError = error;
}];
[NSThread sleepForTimeInterval:SDLExpect.timeout + 3];
expect(returnRequest).toNot(beNil());
expect(returnRequest).to(beAnInstanceOf([SDLShow class]));
expect(returnResponse).to(beNil());
expect(returnError).toNot(beNil());
});
it(@"can send an RPC of type Response", ^{
SDLPerformAppServiceInteractionResponse *testResponse = [[SDLPerformAppServiceInteractionResponse alloc] init];
OCMExpect([protocolMock sendRPC:testResponse error:[OCMArg anyObjectRef]]);
[testManager sendRPC:testResponse];
testResponse.correlationID = @(2);
testResponse.success = @(true);
testResponse.resultCode = SDLResultSuccess;
testResponse.info = @"testResponse info";
OCMVerifyAllWithDelay(protocolMock, 0.1);
});
it(@"can send an RPC of type Notification", ^{
SDLOnAppServiceData *testNotification = [[SDLOnAppServiceData alloc] initWithServiceData:[[SDLAppServiceData alloc] init]];
OCMExpect([protocolMock sendRPC:testNotification error:[OCMArg anyObjectRef]]);
[testManager sendRPC:testNotification];
OCMVerifyAllWithDelay(protocolMock, 0.1);
});
it(@"should throw an exception if the RPC is not of type `Request`, `Response` or `Notification`", ^{
SDLRPCMessage *testMessage = [[SDLRPCMessage alloc] init];
expectAction(^{
[testManager sendRPC:testMessage];
}).to(raiseException());
});
describe(@"stopping the manager on certain SDLAppInterfaceUnregisteredReason", ^{
it(@"should attempt to stop the manager when a PROTOCOL_VIOLATION notification is recieved", ^{
SDLOnAppInterfaceUnregistered *unreg = [[SDLOnAppInterfaceUnregistered alloc] init];
unreg.reason = SDLAppInterfaceUnregisteredReasonProtocolViolation;
SDLRPCNotificationNotification *notification = [[SDLRPCNotificationNotification alloc] initWithName:SDLDidReceiveAppUnregisteredNotification object:testManager.notificationDispatcher rpcNotification:unreg];
[[NSNotificationCenter defaultCenter] postNotification:notification];
expect(testManager.lifecycleState).to(equal(SDLLifecycleStateStopped));
});
it(@"should attempt to stop the manager when an APP_UNAUTHORIZED notification is recieved", ^{
SDLOnAppInterfaceUnregistered *unreg = [[SDLOnAppInterfaceUnregistered alloc] init];
unreg.reason = SDLAppInterfaceUnregisteredReasonAppUnauthorized;
SDLRPCNotificationNotification *notification = [[SDLRPCNotificationNotification alloc] initWithName:SDLDidReceiveAppUnregisteredNotification object:testManager.notificationDispatcher rpcNotification:unreg];
[[NSNotificationCenter defaultCenter] postNotification:notification];
expect(testManager.lifecycleState).to(equal(SDLLifecycleStateStopped));
});
});
describe(@"stopping the manager", ^{
beforeEach(^{
OCMStub([protocolMock sendRPC:[OCMArg any] error:[OCMArg setTo:nil]]).andReturn(YES);
[testManager stop];
});
it(@"should attempt to unregister", ^{
OCMVerify([protocolMock sendRPC:[OCMArg isKindOfClass:[SDLUnregisterAppInterface class]] error:[OCMArg anyObjectRef]]);
expect(testManager.lifecycleState).to(match(SDLLifecycleStateUnregistering));
});
describe(@"when receiving an unregister response", ^{
__block SDLUnregisterAppInterfaceResponse *testUnregisterResponse = nil;
beforeEach(^{
testUnregisterResponse = [[SDLUnregisterAppInterfaceResponse alloc] init];
testUnregisterResponse.success = @YES;
testUnregisterResponse.correlationID = @(testManager.lastCorrelationId);
// This should run on `com.sdl.rpcProcessingQueue` to simulate the real case.
[testManager.notificationDispatcher postRPCResponseNotification:SDLDidReceiveUnregisterAppInterfaceResponse response:testUnregisterResponse];
});
it(@"should stop", ^{
expect(testManager.lifecycleState).to(match(SDLLifecycleStateStopped));
});
});
});
describe(@"receiving an HMI level change", ^{
__block SDLOnHMIStatus *testHMIStatus = nil;
__block SDLHMILevel testHMILevel = nil;
__block SDLHMILevel oldHMILevel = nil;
beforeEach(^{
oldHMILevel = testManager.hmiLevel;
testHMIStatus = [[SDLOnHMIStatus alloc] init];
});
context(@"a full hmi level", ^{
beforeEach(^{
testHMILevel = SDLHMILevelFull;
testHMIStatus.hmiLevel = testHMILevel;
[testManager.notificationDispatcher postRPCNotificationNotification:SDLDidChangeHMIStatusNotification notification:testHMIStatus];
});
it(@"should set the hmi level", ^{
expect(testManager.hmiLevel).to(equal(testHMILevel));
});
it(@"should call the delegate", ^{
// Since notifications are sent to SDLManagerDelegate observers on the main thread, force the block to execute manually on the main thread. If this is not done, the test case may fail.
[[NSRunLoop mainRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:0.01]];
OCMVerify([testManager.delegate hmiLevel:[OCMArg any] didChangeToLevel:[OCMArg any]]);
});
});
});
describe(@"receiving an audio state change", ^{
__block SDLOnHMIStatus *testHMIStatus = nil;
__block SDLAudioStreamingState testAudioStreamingState = nil;
__block SDLAudioStreamingState oldAudioStreamingState = nil;
beforeEach(^{
oldAudioStreamingState = testManager.audioStreamingState;
testHMIStatus = [[SDLOnHMIStatus alloc] init];
});
context(@"a not audible audio state", ^{
beforeEach(^{
testAudioStreamingState = SDLAudioStreamingStateNotAudible;
testHMIStatus.audioStreamingState = testAudioStreamingState;
[testManager.notificationDispatcher postRPCNotificationNotification:SDLDidChangeHMIStatusNotification notification:testHMIStatus];
});
it(@"should set the audio state", ^{
expect(testManager.audioStreamingState).to(equal(testAudioStreamingState));
});
it(@"should call the delegate", ^{
// Since notifications are sent to SDLManagerDelegate observers on the main thread, force the block to execute manually on the main thread. If this is not done, the test case may fail.
[[NSRunLoop mainRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:0.01]];
OCMVerify([testManager.delegate audioStreamingState:oldAudioStreamingState didChangeToState:testAudioStreamingState]);
});
});
});
describe(@"receiving a video state change", ^{
__block SDLOnHMIStatus *testHMIStatus = nil;
__block SDLVideoStreamingState testVideoStreamingState = nil;
__block SDLAudioStreamingState oldVideoStreamingState = nil;
beforeEach(^{
oldVideoStreamingState = testManager.videoStreamingState;
testHMIStatus = [[SDLOnHMIStatus alloc] init];
});
context(@"a not audible audio state", ^{
beforeEach(^{
testVideoStreamingState = SDLVideoStreamingStateNotStreamable;
testHMIStatus.videoStreamingState = testVideoStreamingState;
[testManager.notificationDispatcher postRPCNotificationNotification:SDLDidChangeHMIStatusNotification notification:testHMIStatus];
});
it(@"should set the audio state", ^{
expect(testManager.videoStreamingState).to(equal(testVideoStreamingState));
});
it(@"should call the delegate", ^{
// Since notifications are sent to SDLManagerDelegate observers on the main thread, force the block to execute manually on the main thread. If this is not done, the test case may fail.
[[NSRunLoop mainRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:0.01]];
OCMVerify([testManager.delegate videoStreamingState:oldVideoStreamingState didChangetoState:testVideoStreamingState]);
});
});
});
describe(@"receiving a system context change", ^{
__block SDLOnHMIStatus *testHMIStatus = nil;
__block SDLSystemContext testSystemContext = nil;
__block SDLSystemContext oldSystemContext = nil;
beforeEach(^{
oldSystemContext = testManager.systemContext;
testHMIStatus = [[SDLOnHMIStatus alloc] init];
});
context(@"a alert system context state", ^{
beforeEach(^{
expect(testManager.lifecycleStateMachine.currentState).to(equal(SDLLifecycleStateReady));
expect(testManager.systemContext).to(beNil());
testSystemContext = SDLSystemContextAlert;
testHMIStatus.systemContext = testSystemContext;
[testManager.notificationDispatcher postRPCNotificationNotification:SDLDidChangeHMIStatusNotification notification:testHMIStatus];
});
it(@"should set the system context", ^{
expect(testManager.systemContext).to(equal(testSystemContext));
});
it(@"should call the delegate", ^{
// Since notifications are sent to SDLManagerDelegate observers on the main thread, force the block to execute manually on the main thread. If this is not done, the test case may fail.
[[NSRunLoop mainRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:0.01]];
OCMVerify([testManager.delegate systemContext:[OCMArg any] didChangeToContext:[OCMArg any]]);
});
afterEach(^{
expect(testManager.delegate).toNot(beNil());
});
});
});
});
});
describe(@"configuring the lifecycle manager", ^{
__block SDLLifecycleConfiguration *lifecycleConfig = nil;
__block SDLLifecycleManager *testManager = nil;
beforeEach(^{
lifecycleConfig = [SDLLifecycleConfiguration defaultConfigurationWithAppName:@"Test app" fullAppId:@"Test ID"];
});
context(@"if secondary transport is not allowed", ^{
beforeEach(^{
lifecycleConfig.allowedSecondaryTransports = SDLSecondaryTransportsNone;
SDLConfiguration *config = [[SDLConfiguration alloc] initWithLifecycle:lifecycleConfig lockScreen:[SDLLockScreenConfiguration disabledConfiguration] logging:[SDLLogConfiguration defaultConfiguration] fileManager:[SDLFileManagerConfiguration defaultConfiguration] encryption:[SDLEncryptionConfiguration defaultConfiguration]];
testManager = [[SDLLifecycleManager alloc] initWithConfiguration:config delegate:nil];
[testManager.lifecycleStateMachine setToState:SDLLifecycleStateStarted fromOldState:nil callEnterTransition:YES];
});
it(@"should not create a secondary transport manager", ^{
expect(testManager.secondaryTransportManager).to(beNil());
});
});
context(@"if a secondary transport is allowed but app is NOT a navigation or projection app", ^{
beforeEach(^{
lifecycleConfig.allowedSecondaryTransports = SDLSecondaryTransportsTCP;
lifecycleConfig.appType = SDLAppHMITypeSocial;
SDLConfiguration *config = [[SDLConfiguration alloc] initWithLifecycle:lifecycleConfig lockScreen:[SDLLockScreenConfiguration disabledConfiguration] logging:[SDLLogConfiguration defaultConfiguration] fileManager:[SDLFileManagerConfiguration defaultConfiguration] encryption:[SDLEncryptionConfiguration defaultConfiguration]];
testManager = [[SDLLifecycleManager alloc] initWithConfiguration:config delegate:nil];
[testManager.lifecycleStateMachine setToState:SDLLifecycleStateStarted fromOldState:nil callEnterTransition:YES];
});
it(@"should not create a secondary transport manager", ^{
expect(testManager.secondaryTransportManager).to(beNil());
});
});
context(@"if a secondary transport is allowed and app is a navigation or projection app", ^{
beforeEach(^{
lifecycleConfig.allowedSecondaryTransports = SDLSecondaryTransportsTCP;
lifecycleConfig.appType = SDLAppHMITypeProjection;
SDLConfiguration *config = [[SDLConfiguration alloc] initWithLifecycle:lifecycleConfig lockScreen:[SDLLockScreenConfiguration disabledConfiguration] logging:[SDLLogConfiguration defaultConfiguration] streamingMedia:[SDLStreamingMediaConfiguration insecureConfiguration] fileManager:[SDLFileManagerConfiguration defaultConfiguration] encryption:[SDLEncryptionConfiguration defaultConfiguration]];
testManager = [[SDLLifecycleManager alloc] initWithConfiguration:config delegate:nil];
[testManager.lifecycleStateMachine setToState:SDLLifecycleStateStarted fromOldState:nil callEnterTransition:YES];
});
it(@"should create a secondary transport manager", ^{
expect(testManager.streamManager).toNot(beNil());
expect(testManager.secondaryTransportManager).toNot(beNil());
});
});
});
});
QuickSpecEnd