-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cfb26a8
commit 7fc419c
Showing
2 changed files
with
85 additions
and
0 deletions.
There are no files selected for viewing
84 changes: 84 additions & 0 deletions
84
...a/GpsShiftSupport/009_GetInteriorVehicleData_stationLocation_shift_after_subscription.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
--------------------------------------------------------------------------------------------------- | ||
-- Proposal: | ||
-- https://github.com/smartdevicelink/sdl_evolution/blob/master/proposals/0199-Adding-GPS-Shift-support.md | ||
-- Description: | ||
-- In case: | ||
-- 1) Mobile sends GetInteriorVehicleData request with subscribe=true | ||
-- 2) SDL transfers this request to HMI | ||
-- 3) HMI sends "shifted" item in "stationLocation" parameter of "moduleData" parameter of GetInteriorVehicleData | ||
-- response | ||
-- 4) Mobile sends another GetInteriorVehicleData request without subscribe parameter | ||
-- SDL does: | ||
-- 1) Cut all parameters except longitudeDegrees, latitudeDegrees, altitude from stationLocation and | ||
-- send GetInteriorVehicleData response to mobile without "shifted" item in "stationLocation" structure of | ||
-- "moduleData" parameter for the first request | ||
-- 2) Send a GetInteriorVehicleData response without "shifted" item for the second request | ||
--------------------------------------------------------------------------------------------------- | ||
--[[ Required Shared libraries ]] | ||
local runner = require('user_modules/script_runner') | ||
local common = require('test_scripts/API/VehicleData/GpsShiftSupport/commonGpsShift') | ||
local commonRC = require("test_scripts/RC/commonRC") | ||
|
||
-- [[ Test Configuration ]] | ||
runner.testSettings.isSelfIncluded = false | ||
|
||
-- [[ Local Functions ]] | ||
local function getInteriorVehicleData(pShiftValue) | ||
common.radioData.radioControlData.sisData.stationLocation.shifted = pShiftValue | ||
local cid = common.getMobileSession():SendRPC("GetInteriorVehicleData", { | ||
moduleType = "RADIO", | ||
subscribe = true | ||
}) | ||
EXPECT_HMICALL("RC.GetInteriorVehicleData", { | ||
moduleType = "RADIO" | ||
}) | ||
:Do(function(_, data) | ||
common.getHMIConnection():SendResponse(data.id, data.method, "SUCCESS", { | ||
moduleData = common.radioData, | ||
isSubscribed = true | ||
}) | ||
end) | ||
|
||
local expectedRadioData = common.cloneTable(common.radioData) | ||
expectedRadioData.radioControlData.sisData.stationLocation.shifted = nil | ||
common.getMobileSession():ExpectResponse(cid, { success = true, resultCode = "SUCCESS", | ||
isSubscribed = true, | ||
moduleData = expectedRadioData | ||
}) | ||
:ValidIf(function(_, data) | ||
return common.checkShifted(data.payload.moduleData.radioControlData.sisData.stationLocation.shifted, nil) | ||
end) | ||
end | ||
|
||
local function getInteriorVehicleDataSubscribed() | ||
local cid = common.getMobileSession():SendRPC("GetInteriorVehicleData", { | ||
moduleType = "RADIO" | ||
}) | ||
EXPECT_HMICALL("RC.GetInteriorVehicleData", { | ||
moduleType = "RADIO" | ||
}) | ||
:Times(0) | ||
|
||
local expectedRadioData = common.cloneTable(common.radioData) | ||
expectedRadioData.radioControlData.sisData.stationLocation.shifted = nil | ||
common.getMobileSession():ExpectResponse(cid, { success = true, resultCode = "SUCCESS", | ||
moduleData = expectedRadioData | ||
}) | ||
:ValidIf(function(_, data) | ||
return common.checkShifted(data.payload.moduleData.radioControlData.sisData.stationLocation.shifted, nil) | ||
end) | ||
end | ||
|
||
--[[ Scenario ]] | ||
runner.Title("Preconditions") | ||
runner.Step("Clean environment", commonRC.preconditions) | ||
runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) | ||
runner.Step("Register App", common.registerAppWOPTU) | ||
runner.Step("Activate App", common.activateApp) | ||
|
||
runner.Title("Test") | ||
runner.Step("GetInteriorVehicleData subscription RADIO module, shifted true", getInteriorVehicleData, { true }) | ||
runner.Step("GetInteriorVehicleData RADIO module subscribed, without shifted", getInteriorVehicleDataSubscribed) | ||
|
||
runner.Title("Postconditions") | ||
runner.Step("Stop SDL", common.postconditions) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters