diff options
author | Joel Fischer <joeljfischer@gmail.com> | 2017-08-29 14:04:21 -0400 |
---|---|---|
committer | Joel Fischer <joeljfischer@gmail.com> | 2017-08-29 14:04:21 -0400 |
commit | 50c96a76f061ab715af473b4552fe3ec56906d09 (patch) | |
tree | d0aaab15734187f0bfa676050c619450f91db15f | |
parent | 850387a08193a08627c4e9c7cdbfb2d38b3ea947 (diff) | |
parent | e357d3d60a3f8ab681e94686a9e84ccd9d700247 (diff) | |
download | sdl_ios-50c96a76f061ab715af473b4552fe3ec56906d09.tar.gz |
Merge branch 'bugfix/ack_parse_data_error' into develop
14 files changed, 102 insertions, 7 deletions
diff --git a/SmartDeviceLink/SDLControlFramePayloadAudioStartServiceAck.m b/SmartDeviceLink/SDLControlFramePayloadAudioStartServiceAck.m index ac969d07b..be5460bb4 100644 --- a/SmartDeviceLink/SDLControlFramePayloadAudioStartServiceAck.m +++ b/SmartDeviceLink/SDLControlFramePayloadAudioStartServiceAck.m @@ -37,7 +37,7 @@ NS_ASSUME_NONNULL_BEGIN _mtu = SDLControlFrameInt64NotFound; - if (data != nil) { + if (data.length > 0) { [self sdl_parse:data]; } diff --git a/SmartDeviceLink/SDLControlFramePayloadEndService.m b/SmartDeviceLink/SDLControlFramePayloadEndService.m index 8399da517..372400e7d 100644 --- a/SmartDeviceLink/SDLControlFramePayloadEndService.m +++ b/SmartDeviceLink/SDLControlFramePayloadEndService.m @@ -37,7 +37,7 @@ NS_ASSUME_NONNULL_BEGIN _hashId = SDLControlFrameInt32NotFound; - if (data != nil) { + if (data.length > 0) { [self sdl_parse:data]; } diff --git a/SmartDeviceLink/SDLControlFramePayloadNak.m b/SmartDeviceLink/SDLControlFramePayloadNak.m index 4402dea47..15f5c517c 100644 --- a/SmartDeviceLink/SDLControlFramePayloadNak.m +++ b/SmartDeviceLink/SDLControlFramePayloadNak.m @@ -35,7 +35,7 @@ NS_ASSUME_NONNULL_BEGIN self = [super init]; if (!self) return nil; - if (data != nil) { + if (data.length > 0) { [self sdl_parse:data]; } diff --git a/SmartDeviceLink/SDLControlFramePayloadRPCStartService.m b/SmartDeviceLink/SDLControlFramePayloadRPCStartService.m index 222370d24..95245e93e 100644 --- a/SmartDeviceLink/SDLControlFramePayloadRPCStartService.m +++ b/SmartDeviceLink/SDLControlFramePayloadRPCStartService.m @@ -36,7 +36,7 @@ NS_ASSUME_NONNULL_BEGIN self = [super init]; if (!self) return nil; - if (data != nil) { + if (data.length > 0) { [self sdl_parse:data]; } diff --git a/SmartDeviceLink/SDLControlFramePayloadRPCStartServiceAck.m b/SmartDeviceLink/SDLControlFramePayloadRPCStartServiceAck.m index e4b8347fa..cc2c2c3a5 100644 --- a/SmartDeviceLink/SDLControlFramePayloadRPCStartServiceAck.m +++ b/SmartDeviceLink/SDLControlFramePayloadRPCStartServiceAck.m @@ -43,7 +43,7 @@ NS_ASSUME_NONNULL_BEGIN _hashId = SDLControlFrameInt32NotFound; _mtu = SDLControlFrameInt64NotFound; - if (data != nil) { + if (data.length > 0) { [self sdl_parse:data]; } diff --git a/SmartDeviceLink/SDLControlFramePayloadVideoStartService.m b/SmartDeviceLink/SDLControlFramePayloadVideoStartService.m index caa6a24a2..94f498d2b 100644 --- a/SmartDeviceLink/SDLControlFramePayloadVideoStartService.m +++ b/SmartDeviceLink/SDLControlFramePayloadVideoStartService.m @@ -46,7 +46,7 @@ NS_ASSUME_NONNULL_BEGIN _height = SDLControlFrameInt32NotFound; _width = SDLControlFrameInt32NotFound; - if (data != nil) { + if (data.length > 0) { [self sdl_parse:data]; } diff --git a/SmartDeviceLink/SDLControlFramePayloadVideoStartServiceAck.m b/SmartDeviceLink/SDLControlFramePayloadVideoStartServiceAck.m index e30fe1af7..dfb896b73 100644 --- a/SmartDeviceLink/SDLControlFramePayloadVideoStartServiceAck.m +++ b/SmartDeviceLink/SDLControlFramePayloadVideoStartServiceAck.m @@ -47,7 +47,7 @@ _height = SDLControlFrameInt32NotFound; _width = SDLControlFrameInt32NotFound; - if (data != nil) { + if (data.length > 0) { [self sdl_parse:data]; } diff --git a/SmartDeviceLinkTests/ProtocolSpecs/ControlFramePayloadSpecs/SDLControlFramePayloadNakSpec.m b/SmartDeviceLinkTests/ProtocolSpecs/ControlFramePayloadSpecs/SDLControlFramePayloadNakSpec.m index ef0d8fae2..df7bd1305 100644 --- a/SmartDeviceLinkTests/ProtocolSpecs/ControlFramePayloadSpecs/SDLControlFramePayloadNakSpec.m +++ b/SmartDeviceLinkTests/ProtocolSpecs/ControlFramePayloadSpecs/SDLControlFramePayloadNakSpec.m @@ -54,4 +54,18 @@ describe(@"Test decoding data", ^{ }); }); +describe(@"Test nil data", ^{ + __block SDLControlFramePayloadNak *testPayload = nil; + __block NSData *testData = nil; + + beforeEach(^{ + testPayload = [[SDLControlFramePayloadNak alloc] initWithData:testData]; + }); + + it(@"should output the correct params", ^{ + expect(testPayload.rejectedParams).to(beNil()); + }); +}); + + QuickSpecEnd diff --git a/SmartDeviceLinkTests/ProtocolSpecs/ControlFramePayloadSpecs/SDLControlFramePayloadVideoStartServiceSpec.m b/SmartDeviceLinkTests/ProtocolSpecs/ControlFramePayloadSpecs/SDLControlFramePayloadVideoStartServiceSpec.m index 1a5e9cc9d..8816d6813 100644 --- a/SmartDeviceLinkTests/ProtocolSpecs/ControlFramePayloadSpecs/SDLControlFramePayloadVideoStartServiceSpec.m +++ b/SmartDeviceLinkTests/ProtocolSpecs/ControlFramePayloadSpecs/SDLControlFramePayloadVideoStartServiceSpec.m @@ -77,4 +77,17 @@ describe(@"Test decoding data", ^{ }); }); +describe(@"Test nil data", ^{ + __block SDLControlFramePayloadVideoStartService *testPayload = nil; + __block NSData *testData = nil; + + beforeEach(^{ + testPayload = [[SDLControlFramePayloadVideoStartService alloc] initWithData:testData]; + }); + + it(@"should output the correct params", ^{ + expect(testPayload.data.length).to(equal(0)); + }); +}); + QuickSpecEnd diff --git a/SmartDeviceLinkTests/ProtocolSpecs/ControlFramePayloadSpecs/SDLControlFrameVideoStartServiceAckSpec.m b/SmartDeviceLinkTests/ProtocolSpecs/ControlFramePayloadSpecs/SDLControlFrameVideoStartServiceAckSpec.m index b52740312..586a2b886 100644 --- a/SmartDeviceLinkTests/ProtocolSpecs/ControlFramePayloadSpecs/SDLControlFrameVideoStartServiceAckSpec.m +++ b/SmartDeviceLinkTests/ProtocolSpecs/ControlFramePayloadSpecs/SDLControlFrameVideoStartServiceAckSpec.m @@ -83,4 +83,17 @@ describe(@"Test decoding data", ^{ }); }); +describe(@"Test nil data", ^{ + __block SDLControlFramePayloadVideoStartServiceAck *testPayload = nil; + __block NSData *testData = nil; + + beforeEach(^{ + testPayload = [[SDLControlFramePayloadVideoStartServiceAck alloc] initWithData:testData]; + }); + + it(@"should output the correct params", ^{ + expect(testPayload.data.length).to(equal(0)); + }); +}); + QuickSpecEnd diff --git a/SmartDeviceLinkTests/ProtocolSpecs/SDLControlFramePayloadAudioStartServiceAckSpec.m b/SmartDeviceLinkTests/ProtocolSpecs/SDLControlFramePayloadAudioStartServiceAckSpec.m index a168fc39d..548110d0d 100644 --- a/SmartDeviceLinkTests/ProtocolSpecs/SDLControlFramePayloadAudioStartServiceAckSpec.m +++ b/SmartDeviceLinkTests/ProtocolSpecs/SDLControlFramePayloadAudioStartServiceAckSpec.m @@ -57,4 +57,18 @@ describe(@"Test decoding data", ^{ }); }); +describe(@"Test nil data", ^{ + __block SDLControlFramePayloadAudioStartServiceAck *testPayload = nil; + __block NSData *testData = nil; + + beforeEach(^{ + testPayload = [[SDLControlFramePayloadAudioStartServiceAck alloc] initWithData:testData]; + }); + + it(@"should output the correct params", ^{ + expect(testPayload.mtu).to(equal(-1)); + expect(testPayload.data.length).to(equal(0)); + }); +}); + QuickSpecEnd diff --git a/SmartDeviceLinkTests/ProtocolSpecs/SDLControlFramePayloadEndServiceSpec.m b/SmartDeviceLinkTests/ProtocolSpecs/SDLControlFramePayloadEndServiceSpec.m index 8f7a0c3d2..a59c95811 100644 --- a/SmartDeviceLinkTests/ProtocolSpecs/SDLControlFramePayloadEndServiceSpec.m +++ b/SmartDeviceLinkTests/ProtocolSpecs/SDLControlFramePayloadEndServiceSpec.m @@ -55,4 +55,18 @@ describe(@"Test decoding data", ^{ }); }); +describe(@"Test nil data", ^{ + __block SDLControlFramePayloadEndService *testPayload = nil; + __block NSData *testData = nil; + + beforeEach(^{ + testPayload = [[SDLControlFramePayloadEndService alloc] initWithData:testData]; + }); + + it(@"should output the correct params", ^{ + expect(testPayload.hashId).to(equal(-1)); + expect(testPayload.data.length).to(equal(0)); + }); +}); + QuickSpecEnd diff --git a/SmartDeviceLinkTests/ProtocolSpecs/SDLControlFramePayloadRPCStartServiceAckSpec.m b/SmartDeviceLinkTests/ProtocolSpecs/SDLControlFramePayloadRPCStartServiceAckSpec.m index ee6793249..7397f5713 100644 --- a/SmartDeviceLinkTests/ProtocolSpecs/SDLControlFramePayloadRPCStartServiceAckSpec.m +++ b/SmartDeviceLinkTests/ProtocolSpecs/SDLControlFramePayloadRPCStartServiceAckSpec.m @@ -68,4 +68,17 @@ describe(@"Test decoding data", ^{ }); }); +describe(@"Test nil data", ^{ + __block SDLControlFramePayloadRPCStartServiceAck *testPayload = nil; + __block NSData *testData = nil; + + beforeEach(^{ + testPayload = [[SDLControlFramePayloadRPCStartServiceAck alloc] initWithData:testData]; + }); + + it(@"should output the correct params", ^{ + expect(testPayload.data.length).to(equal(0)); + }); +}); + QuickSpecEnd diff --git a/SmartDeviceLinkTests/ProtocolSpecs/SDLControlFramePayloadRPCStartServiceSpec.m b/SmartDeviceLinkTests/ProtocolSpecs/SDLControlFramePayloadRPCStartServiceSpec.m index e8e773c8a..f39204330 100644 --- a/SmartDeviceLinkTests/ProtocolSpecs/SDLControlFramePayloadRPCStartServiceSpec.m +++ b/SmartDeviceLinkTests/ProtocolSpecs/SDLControlFramePayloadRPCStartServiceSpec.m @@ -57,4 +57,18 @@ describe(@"Test decoding data", ^{ }); }); +describe(@"Test nil data", ^{ + __block SDLControlFramePayloadRPCStartService *testPayload = nil; + __block NSData *testData = nil; + + beforeEach(^{ + testPayload = [[SDLControlFramePayloadRPCStartService alloc] initWithData:testData]; + }); + + it(@"should output the correct params", ^{ + expect(testPayload.protocolVersion).to(beNil()); + expect(testPayload.data.length).to(equal(0)); + }); +}); + QuickSpecEnd |