Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/widget support #2218

Merged
merged 13 commits into from
Aug 26, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add script to cover wrong hashId case in resumption
  • Loading branch information
dboltovskyi committed Aug 23, 2019
commit 85d700f62342c62281ce1717da38ee10aebbc12b
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
---------------------------------------------------------------------------------------------------
-- Proposal: https://github.com/smartdevicelink/sdl_evolution/blob/master/proposals/0216-widget-support.md
--
-- Description: Check that SDL restored Main window to FULL level after unexpected disconnect
--
-- Preconditions:
-- 1) SDL and HMI are started
-- 2) App is registered and activated (FULL level)
-- 3) App created a widget which is activated (FULL level)
-- Steps:
-- 1) Unexpected disconnect and reconnect are performed
-- 2) App re-register with wrong HashId
-- SDL does:
-- - does not send UI.CreateWindow(params) request to HMI
-- - does not send CreateWindow response to App
-- 3) HMI sends OnSystemCapabilityUpdated(params) notification to SDL for Main window
-- SDL does:
-- - send OnSystemCapabilityUpdated(params) notification to App for Main window
-- - send OnHMIStatus (NONE level) notification for Main window to App
-- 4) Main window is activated on the HMI and has FULL level
-- 5) App send Show(with WindowID for Main window) request to SDL
-- SDL does:
-- - proceed with request successfully
-- 6) App send Show(with WindowID for Widget window) request to SDL
-- SDL does:
-- - respond to App with (success = false, resultCode = INVALID_ID")
---------------------------------------------------------------------------------------------------
--[[ Required Shared libraries ]]
local common = require('test_scripts/WidgetSupport/common')

--[[ Test Configuration ]]
config.application1.registerAppInterfaceParams.appHMIType = { "MEDIA" }

--[[ Local Variables ]]
local widgetParams = {
windowID = 2,
windowName = "Name",
type = "WIDGET",
associatedServiceType = "MEDIA"
}

--[[ Local Functions ]]
local function createWindow(pParams, pAppId)
if not pAppId then pAppId = 1 end
common.getMobileSession(pAppId):ExpectNotification("OnHashChange")
:Do(function(_, data)
common.setHashId(data.payload.hashID, pAppId)
end)
common.createWindow(pParams, pAppId)
end

local function checkResumption_NONE()
common.getHMIConnection():ExpectRequest("BasicCommunication.ActivateApp")
:Times(0)
common.getHMIConnection():ExpectRequest("UI.CreateWindow")
:Times(0)
common.expCreateWindowResponse()
:Times(0)
common.getMobileSession():ExpectNotification("OnHMIStatus", { windowID = 0, hmiLevel = "NONE" })
common.getMobileSession():ExpectNotification("OnSystemCapabilityUpdated", common.getOnSCUParams({ 0 }))
end

function common.getHashId()
return "wrong_hashId"
end

--[[ Scenario ]]
common.Title("Precondition")
common.Step("Clean environment and Back-up/update PPT", common.precondition)
common.Step("Start SDL, HMI, connect Mobile, start Session", common.start)
common.Step("App registration", common.registerAppWOPTU)
common.Step("App activation", common.activateApp)
common.Step("App creates widget", createWindow, { widgetParams })
common.Step("Widget is activated", common.activateWidgetFromNoneToFULL, { widgetParams.windowID })

common.Title("Test")
common.Step("Unexpected disconnect", common.unexpectedDisconnect)
common.Step("Connect mobile", common.connectMobile)
common.Step("Re-register App resumption data RESUME_FAILED", common.reRegisterAppSuccess,
{ nil, 1, checkResumption_NONE, "RESUME_FAILED" })
common.Step("App activation", common.activateApp)
common.Step("Show RPC to Main window", common.sendShowToWindow, { 0 })
common.Step("Show RPC to Widget window", common.sendShowToWindowUnsuccess, { widgetParams.windowID, "INVALID_ID" })

common.Title("Postconditions")
common.Step("Stop SDL, restore SDL settings and PPT", common.postcondition)
5 changes: 3 additions & 2 deletions test_scripts/WidgetSupport/common.lua
Original file line number Diff line number Diff line change
Expand Up @@ -678,8 +678,9 @@ end
--! pCheckFunc: check function
--! @return: none
--]]
function m.reRegisterAppSuccess(pWidgetParams, pAppId, pCheckFunc)
function m.reRegisterAppSuccess(pWidgetParams, pAppId, pCheckFunc, pResultCode)
if not pAppId then pAppId = 1 end
if not pResultCode then pResultCode = "SUCCESS" end
m.getMobileSession(pAppId):StartService(7)
:Do(function()
local params = m.cloneTable(m.getConfigAppParams(pAppId))
Expand All @@ -691,7 +692,7 @@ function m.reRegisterAppSuccess(pWidgetParams, pAppId, pCheckFunc)
:Do(function()
m.sendOnSCU(m.getOnSCUParams({ 0 }, 0), pAppId)
end)
m.getMobileSession(pAppId):ExpectResponse(corId, { success = true, resultCode = "SUCCESS" })
m.getMobileSession(pAppId):ExpectResponse(corId, { success = true, resultCode = pResultCode })
:Do(function()
m.getMobileSession(pAppId):ExpectNotification("OnPermissionsChange")
end)
Expand Down
1 change: 1 addition & 0 deletions test_sets/widget_support.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
./test_scripts/WidgetSupport/Resumption/003_Resumption_CreateWindows_3_Widgets_IGN_OFF_ON_Cycle.lua
./test_scripts/WidgetSupport/Resumption/004_Resumption_CreateWindow_2_App_Unexpected_Disconnect.lua
./test_scripts/WidgetSupport/Resumption/005_Resumption_CreateWindows_3_Widgets_Unexpected_Disconnect_error_HMI_response.lua
./test_scripts/WidgetSupport/Resumption/006_Resumption_CreateWindow_unexpected_disconnect_invalid_hashId.lua
./test_scripts/WidgetSupport/Policies/001_non-window_specific_RPCs_evaluation.lua
./test_scripts/WidgetSupport/Policies/002_window_specific_RPCs_evaluation.lua
./test_scripts/WidgetSupport/Policies/003_persistence_of_widget_permissions_after_PTU.lua
Expand Down