Skip to content

Commit

Permalink
Merge pull request #1970 from smartdevicelink/feature/driver_distract…
Browse files Browse the repository at this point in the history
…ion_on_registration

Add expectation for OnDriverDistraction on app registration
  • Loading branch information
jacobkeeler authored Jul 13, 2018
2 parents 8a082a7 + eaa8d9d commit b5731db
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,18 @@ config.application2.registerAppInterfaceParams.isMediaApplication = false
config.application2.registerAppInterfaceParams.appHMIType = {"DEFAULT"}

--[[ Local Functions ]]
-- Prepare policy table for policy table update
-- @tparam table tbl table to update
local function ptUpdateFunc(pTbl)
-- make sure that OnDriverDistraction is disallowed in HMILevel NONE
pTbl.policy_table.functional_groupings["Base-4"].rpcs["OnDriverDistraction"].hmi_levels = {
"FULL",
"LIMITED",
"BACKGROUND"
}
end


--! @OnDDinNONE: Processing OnDriverDistraction notification with expectations 0 times
--! @parameters:
--! id - id of session,
Expand Down Expand Up @@ -157,7 +169,7 @@ runner.Step("Clean environment", commonDefects.preconditions)
-- Start SDL and HMI, establish connection between SDL and HMI, open mobile connection via TCP and create mobile session
runner.Step("Start SDL, HMI, connect Mobile, start Session", commonDefects.start)
-- Register application, perform PTU
runner.Step("RAI, PTU", commonDefects.rai_ptu)
runner.Step("RAI, PTU", commonDefects.rai_ptu, {ptUpdateFunc})

runner.Title("Test")
-- Absence of OnDriverDistraction notification on mobile app in NONE HMI level
Expand All @@ -167,9 +179,9 @@ runner.Step("OnDriverDistraction_in_FULL", ActivationAppWithOnDD, {{state = "DD_
runner.Step("UnregisterRegisterApp", commonDefects.unregisterApp, {1})

-- Register first application
runner.Step("RAI_first_app", commonDefects.rai_n, {1})
runner.Step("RAI_first_app", commonDefects.rai_n, {1, false})
-- Register second application
runner.Step("RAI_second_app", commonDefects.rai_ptu_n, {2})
runner.Step("RAI_second_app", commonDefects.rai_ptu_n, {2, ptUpdateFunc})
-- Activate first application
runner.Step("Activate_first_app", commonDefects.activate_app)
-- Receiving OnDriverDistraction notification on mobile app with FULL HMI level
Expand Down
10 changes: 8 additions & 2 deletions test_scripts/Defects/4_5/commonDefects.lua
Original file line number Diff line number Diff line change
Expand Up @@ -410,9 +410,10 @@ end
--! self - test object
--! @return: none
--]]
function commonDefect.rai_n(id, self)
self, id = commonDefect.getSelfAndParams(id, self)
function commonDefect.rai_n(id, expect_dd, self)
self, id, expect_dd = commonDefect.getSelfAndParams(id, expect_dd, self)
if not id then id = 1 end
if expect_dd == nil then expect_dd = true end
self["mobileSession" .. id] = mobile_session.MobileSession(self, self.mobileConnection)
self["mobileSession" .. id]:StartService(7)
:Do(function()
Expand All @@ -429,6 +430,11 @@ function commonDefect.rai_n(id, self)
{ hmiLevel = "NONE", audioStreamingState = "NOT_AUDIBLE", systemContext = "MAIN" })
:Times(AtLeast(1))
self["mobileSession" .. id]:ExpectNotification("OnPermissionsChange")
if expect_dd then
self["mobileSession" .. id]:ExpectNotification("OnDriverDistraction", { state = "DD_OFF" })
else
self["mobileSession" .. id]:ExpectNotification("OnDriverDistraction"):Times(0)
end
end)
end)
end
Expand Down
1 change: 1 addition & 0 deletions test_scripts/Defects/commonDefects.lua
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,7 @@ function commonDefect.rai_n(id, self)
{ hmiLevel = "NONE", audioStreamingState = "NOT_AUDIBLE", systemContext = "MAIN" })
:Times(AtLeast(1))
self["mobileSession" .. id]:ExpectNotification("OnPermissionsChange")
self["mobileSession" .. id]:ExpectNotification("OnDriverDistraction", { state = "DD_OFF" })
end)
end)
end
Expand Down
1 change: 1 addition & 0 deletions test_scripts/RC/commonRC.lua
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ function commonRC.rai_n(id, self)
self["mobileSession" .. id]:ExpectNotification("OnHMIStatus", { hmiLevel = "NONE", audioStreamingState = "NOT_AUDIBLE", systemContext = "MAIN" })
:Times(AtLeast(1)) -- issue with SDL --> notification is sent twice
self["mobileSession" .. id]:ExpectNotification("OnPermissionsChange")
self["mobileSession" .. id]:ExpectNotification("OnDriverDistraction", { state = "DD_OFF" })
end)
end)
end
Expand Down
1 change: 1 addition & 0 deletions test_scripts/Smoke/commonSmoke.lua
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,7 @@ function commonSmoke.registerApp(pAppId, self)
mobSession:ExpectNotification("OnHMIStatus",
{ hmiLevel = "NONE", audioStreamingState = "NOT_AUDIBLE", systemContext = "MAIN" })
mobSession:ExpectNotification("OnPermissionsChange")
mobSession:ExpectNotification("OnDriverDistraction", { state = "DD_OFF" })
end)
end)
end
Expand Down

0 comments on commit b5731db

Please sign in to comment.