summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJackLivio <jack@livio.io>2017-07-18 13:54:37 -0400
committerJackLivio <jack@livio.io>2017-07-18 13:54:37 -0400
commit13a3199045adfde25842fcf7a76a64bb98aecc0e (patch)
tree2d15241a82295aca394b949e29e3a320838c0926
parentf4129a5aea647b0dd4b14f748c169eaf6e081027 (diff)
downloadsdl_core-13a3199045adfde25842fcf7a76a64bb98aecc0e.tar.gz
Unit Tests: UIGetCapabilityResponse
-rw-r--r--src/components/application_manager/test/commands/hmi/ui_get_capabilities_response_test.cc49
-rw-r--r--src/components/application_manager/test/include/application_manager/mock_hmi_capabilities.h7
2 files changed, 56 insertions, 0 deletions
diff --git a/src/components/application_manager/test/commands/hmi/ui_get_capabilities_response_test.cc b/src/components/application_manager/test/commands/hmi/ui_get_capabilities_response_test.cc
index 11162f9a03..b556da603c 100644
--- a/src/components/application_manager/test/commands/hmi/ui_get_capabilities_response_test.cc
+++ b/src/components/application_manager/test/commands/hmi/ui_get_capabilities_response_test.cc
@@ -216,6 +216,55 @@ TEST_F(UIGetCapabilitiesResponseTest, SetPhoneCall_SUCCESS) {
command->Run();
}
+TEST_F(UIGetCapabilitiesResponseTest, SetNavigationCapability_SUCCESS) {
+ MessageSharedPtr command_msg = CreateCommandMsg();
+ (*command_msg)[strings::msg_params][strings::system_capabilities] =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
+
+ (*command_msg)[strings::msg_params][strings::system_capabilities]
+ [strings::navigation_capability]["sendLocationEnabled"] = true;
+
+ (*command_msg)[strings::msg_params][strings::system_capabilities]
+ [strings::navigation_capability]["getWayPointsEnabled"] = true;
+
+ ResponseFromHMIPtr command(
+ CreateCommand<UIGetCapabilitiesResponse>(command_msg));
+
+ EXPECT_CALL(app_mngr_, hmi_capabilities())
+ .WillOnce(ReturnRef(mock_hmi_capabilities_));
+
+ smart_objects::SmartObject navigation_capability_so =
+ (*command_msg)[strings::msg_params][strings::system_capabilities][strings::navigation_capability];
+
+ EXPECT_CALL(mock_hmi_capabilities_,
+ set_navigation_capability(navigation_capability_so));
+
+ command->Run();
+}
+
+TEST_F(UIGetCapabilitiesResponseTest, SetPhonenCapability_SUCCESS) {
+ MessageSharedPtr command_msg = CreateCommandMsg();
+ (*command_msg)[strings::msg_params][strings::system_capabilities] =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
+
+ (*command_msg)[strings::msg_params][strings::system_capabilities]
+ [strings::phone_capability]["dialNumberEnabled"] = true;
+
+ ResponseFromHMIPtr command(
+ CreateCommand<UIGetCapabilitiesResponse>(command_msg));
+
+ EXPECT_CALL(app_mngr_, hmi_capabilities())
+ .WillOnce(ReturnRef(mock_hmi_capabilities_));
+
+ smart_objects::SmartObject phone_capability_so =
+ (*command_msg)[strings::msg_params][strings::system_capabilities][strings::phone_capability];
+
+ EXPECT_CALL(mock_hmi_capabilities_,
+ set_phone_capability(phone_capability_so));
+
+ command->Run();
+}
+
} // namespace ui_get_capabilities_response
} // namespace hmi_commands_test
} // namespace commands_test
diff --git a/src/components/application_manager/test/include/application_manager/mock_hmi_capabilities.h b/src/components/application_manager/test/include/application_manager/mock_hmi_capabilities.h
index a8664f5e2c..020e56c292 100644
--- a/src/components/application_manager/test/include/application_manager/mock_hmi_capabilities.h
+++ b/src/components/application_manager/test/include/application_manager/mock_hmi_capabilities.h
@@ -154,6 +154,13 @@ class MockHMICapabilities : public ::application_manager::HMICapabilities {
MOCK_CONST_METHOD0(phone_call_supported, bool());
MOCK_METHOD1(set_phone_call_supported, void(const bool supported));
+ MOCK_CONST_METHOD0(navigation_capability, const smart_objects::SmartObject*());
+ MOCK_METHOD1(set_navigation_capability, void(const smart_objects::SmartObject& navigation_capability));
+
+ MOCK_CONST_METHOD0(phone_capability, const smart_objects::SmartObject*());
+ MOCK_METHOD1(set_phone_capability, void(const smart_objects::SmartObject& phone_capability));
+
+
MOCK_METHOD1(Init, void(resumption::LastState* last_state));
MOCK_CONST_METHOD0(ccpu_version, const std::string&());