summaryrefslogtreecommitdiff
path: root/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands
diff options
context:
space:
mode:
authorJacob Keeler <jacob.keeler@livioradio.com>2019-10-30 10:53:49 -0400
committerGitHub <noreply@github.com>2019-10-30 10:53:49 -0400
commit891497bc9fb23434242dbe92e1f13dd1273fcb21 (patch)
treea96314794e50c047b580a0e313e62164ae2998a6 /src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands
parentea5960280585d11ee02542b0ab183d4400ed691d (diff)
parent4d283e625dfa09d166d572fa7bf6e98e91f05050 (diff)
downloadsdl_core-891497bc9fb23434242dbe92e1f13dd1273fcb21.tar.gz
Merge pull request #3100 from smartdevicelink/release/6.0.06.0.0
Release 6.0.0
Diffstat (limited to 'src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands')
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/activate_app_request_test.cc6
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/add_statistics_info_notification_test.cc12
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/allow_all_apps_response_test.cc6
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/allow_app_response_test.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/basic_communication_get_system_time_request_test.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/basic_communication_get_system_time_response_test.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/button_get_capabilities_response_test.cc9
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/close_popup_response_test.cc10
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/dummy_hmi_commands_test.cc324
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/get_system_info_request_test.cc10
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/get_system_info_response_test.cc18
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/get_urls_test.cc334
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/hmi_notifications_test.cc235
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/mixing_audio_supported_request_test.cc10
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/mixing_audio_supported_response_test.cc20
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/navi_audio_start_stream_request_test.cc10
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/navi_is_ready_request_test.cc14
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/navi_is_ready_response_test.cc6
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/navi_set_video_config_request_test.cc12
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/navi_set_video_config_response_test.cc6
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/navi_start_stream_request_test.cc8
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/navi_stop_stream_requests_test.cc11
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/on_bc_system_capability_updated_notification_from_hmi_test.cc159
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/on_bc_system_capability_updated_notification_test.cc118
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/on_driver_distraction_notification_test.cc285
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/on_service_status_update_notification_test.cc (renamed from src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/get_urls_response_test.cc)74
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/on_system_time_ready_notification_test.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/rc_get_capabilities_response_test.cc11
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/rc_is_ready_request_test.cc12
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/rc_is_ready_response_test.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/response_from_hmi_test.cc12
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_activate_app_request_test.cc27
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_activate_app_response_test.cc10
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_get_list_of_permisssions_request_test.cc8
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_get_policy_configuration_data_request_test.cc180
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_get_status_update_request_test.cc6
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_get_user_friendly_message_request_test.cc14
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/simple_notifications_test.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/simple_request_from_hmi_test.cc18
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/simple_requests_to_hmi_test.cc56
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/simple_response_from_hmi_test.cc56
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/simple_response_to_hmi_test.cc13
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/tts_get_capabilities_response_test.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/tts_get_language_response_test.cc7
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/tts_get_supported_languages_response_test.cc21
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/tts_is_ready_response_test.cc20
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_get_capabilities_response_test.cc82
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_get_language_response_test.cc10
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_get_supported_languages_response_test.cc15
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_is_ready_request_test.cc18
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_is_ready_response_test.cc8
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/update_device_list_request_test.cc28
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/update_sdl_request_test.cc10
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/update_sdl_response_test.cc10
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_get_capabilities_response_test.cc12
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_get_language_response_test.cc10
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_get_supported_languages_response_test.cc15
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_is_ready_request_test.cc12
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_is_ready_response_test.cc8
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/add_command_request_test.cc28
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/add_sub_menu_request_test.cc12
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/alert_maneuver_request_test.cc22
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/alert_request_test.cc49
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/change_registration_test.cc28
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/create_interaction_choice_set_test.cc32
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/create_window_request_test.cc460
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_command_request_test.cc18
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_file_test.cc44
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_interaction_choice_set_test.cc16
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_sub_menu_test.cc16
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_window_request_test.cc278
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/dial_number_request_test.cc16
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/dummy_mobile_commands_test.cc20
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/end_audio_pass_thru_request_test.cc18
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/get_system_capability_request_test.cc124
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/get_way_points_request_test.cc23
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/list_files_request_test.cc25
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_button_notification_commands_test.cc20
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_command_notification_test.cc6
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_hash_change_notification_test.cc10
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_hmi_status_notification_from_mobile_test.cc12
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_hmi_status_notification_test.cc12
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_keyboard_input_notification_test.cc20
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_system_capability_updated_notification_test.cc236
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_system_request_notification_test.cc39
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_tbt_client_state_notification_test.cc12
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_touch_event_notification_test.cc6
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_way_point_change_notification_test.cc6
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/perform_audio_pass_thru_test.cc46
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/perform_interaction_test.cc26
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/put_file_test.cc27
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/register_app_interface_request_test.cc330
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/reset_global_properties_test.cc85
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/scrollable_message_test.cc20
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/send_haptic_data_test.cc6
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/send_location_request_test.cc8
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/set_app_icon_test.cc18
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/set_display_layout_test.cc77
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/set_global_properties_test.cc220
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/set_media_clock_timer_test.cc12
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/show_test.cc461
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/simple_notification_commands_test.cc8
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/simple_response_commands_test.cc44
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/slider_test.cc14
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/speak_request_test.cc26
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/subscribe_button_request_test.cc86
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/subscribe_way_points_request_test.cc21
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/system_request_test.cc69
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/unregister_app_interface_request_test.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/unsubscribe_button_request_test.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/unsubscribe_way_points_request_test.cc14
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/update_turn_list_request_test.cc42
112 files changed, 4125 insertions, 1583 deletions
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/activate_app_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/activate_app_request_test.cc
index 50b7aae42a..7dadad59fe 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/activate_app_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/activate_app_request_test.cc
@@ -30,12 +30,12 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include "gtest/gtest.h"
#include "hmi/activate_app_request.h"
-#include "smart_objects/smart_object.h"
#include "application_manager/commands/command_impl.h"
#include "application_manager/commands/commands_test.h"
#include "application_manager/mock_application.h"
+#include "gtest/gtest.h"
+#include "smart_objects/smart_object.h"
namespace test {
namespace components {
@@ -47,9 +47,9 @@ using ::testing::_;
namespace am = ::application_manager;
namespace strings = ::application_manager::strings;
+using am::commands::CommandImpl;
using am::commands::MessageSharedPtr;
using sdl_rpc_plugin::commands::ActivateAppRequest;
-using am::commands::CommandImpl;
using ::test::components::application_manager_test::MockApplication;
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/add_statistics_info_notification_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/add_statistics_info_notification_test.cc
index a5707488dd..01487284a4 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/add_statistics_info_notification_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/add_statistics_info_notification_test.cc
@@ -30,15 +30,15 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include "gtest/gtest.h"
#include "hmi/add_statistics_info_notification.h"
+#include "gtest/gtest.h"
-#include "smart_objects/smart_object.h"
#include "application_manager/commands/commands_test.h"
#include "application_manager/mock_application.h"
-#include "application_manager/smart_object_keys.h"
-#include "application_manager/policies/policy_handler.h"
#include "application_manager/policies/mock_policy_handler_interface.h"
+#include "application_manager/policies/policy_handler.h"
+#include "application_manager/smart_object_keys.h"
+#include "smart_objects/smart_object.h"
namespace test {
namespace components {
@@ -49,11 +49,11 @@ namespace add_statistics_info_notification {
namespace am = ::application_manager;
namespace strings = ::application_manager::strings;
namespace hmi_notification = ::application_manager::hmi_notification;
-using am::commands::MessageSharedPtr;
-using sdl_rpc_plugin::commands::AddStatisticsInfoNotification;
using am::commands::CommandImpl;
+using am::commands::MessageSharedPtr;
using policy::PolicyHandler;
using policy_test::MockPolicyHandlerInterface;
+using sdl_rpc_plugin::commands::AddStatisticsInfoNotification;
using ::testing::_;
using ::testing::Return;
using ::testing::ReturnRef;
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/allow_all_apps_response_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/allow_all_apps_response_test.cc
index a2fcf8f605..251fe230fc 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/allow_all_apps_response_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/allow_all_apps_response_test.cc
@@ -30,13 +30,13 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include "gtest/gtest.h"
#include "hmi/allow_all_apps_response.h"
+#include "gtest/gtest.h"
-#include "smart_objects/smart_object.h"
#include "application_manager/commands/command_impl.h"
#include "application_manager/commands/commands_test.h"
#include "application_manager/mock_application.h"
+#include "smart_objects/smart_object.h"
namespace test {
namespace components {
namespace commands_test {
@@ -53,7 +53,7 @@ typedef std::shared_ptr<AllowAllAppsResponse> ResponsePtr;
namespace {
const bool kResponseIsAllowed = true;
-} //
+} // namespace
class AllowAllAppsResponseTest
: public CommandsTest<CommandsTestMocks::kIsNice> {};
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/allow_app_response_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/allow_app_response_test.cc
index 2ce400542a..a0e23d7b9d 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/allow_app_response_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/allow_app_response_test.cc
@@ -30,8 +30,8 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include "gtest/gtest.h"
#include "hmi/allow_app_response.h"
+#include "gtest/gtest.h"
#include "application_manager/commands/commands_test.h"
#include "application_manager/mock_application.h"
@@ -53,7 +53,7 @@ namespace hmi_response = ::application_manager::hmi_response;
namespace {
const uint32_t kConnectionKey = 1u;
const bool kIsResponseAllowed = true;
-}
+} // namespace
typedef std::shared_ptr<AllowAppResponse> ResponsePtr;
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/basic_communication_get_system_time_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/basic_communication_get_system_time_request_test.cc
index a3f0ab6933..9cd87b053d 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/basic_communication_get_system_time_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/basic_communication_get_system_time_request_test.cc
@@ -28,7 +28,7 @@
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
-*/
+ */
#include "hmi/basic_communication_get_system_time_request.h"
@@ -60,7 +60,7 @@ TEST_F(BasicCommunicationGetSystemTimeRequestTest, OnTimeout) {
ON_CALL(app_mngr_, protocol_handler())
.WillByDefault(ReturnRef(mock_protocol_handler));
- EXPECT_CALL(mock_protocol_handler, NotifyOnFailedHandshake());
+ EXPECT_CALL(mock_protocol_handler, NotifyOnGetSystemTimeFailed());
command->onTimeOut();
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/basic_communication_get_system_time_response_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/basic_communication_get_system_time_response_test.cc
index 8f56c6462c..0c8e986fc6 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/basic_communication_get_system_time_response_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/basic_communication_get_system_time_response_test.cc
@@ -30,12 +30,12 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include "gtest/gtest.h"
-#include "application_manager/commands/commands_test.h"
#include "hmi/basic_communication_get_system_time_response.h"
+#include "application_manager/commands/commands_test.h"
#include "application_manager/mock_application_manager.h"
#include "application_manager/mock_event_dispatcher.h"
#include "application_manager/smart_object_keys.h"
+#include "gtest/gtest.h"
#include "interfaces/HMI_API.h"
namespace test {
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/button_get_capabilities_response_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/button_get_capabilities_response_test.cc
index 6ed15bebeb..7d9ed899a6 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/button_get_capabilities_response_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/button_get_capabilities_response_test.cc
@@ -30,13 +30,13 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include "gtest/gtest.h"
#include "hmi/button_get_capabilities_response.h"
+#include "gtest/gtest.h"
-#include "smart_objects/smart_object.h"
#include "application_manager/commands/commands_test.h"
#include "application_manager/mock_application.h"
#include "application_manager/mock_hmi_capabilities.h"
+#include "smart_objects/smart_object.h"
namespace test {
namespace components {
namespace commands_test {
@@ -45,8 +45,8 @@ namespace button_get_capabilities_response {
using application_manager::commands::MessageSharedPtr;
using sdl_rpc_plugin::commands::ButtonGetCapabilitiesResponse;
-using ::testing::ReturnRef;
using ::testing::NiceMock;
+using ::testing::ReturnRef;
namespace strings = ::application_manager::strings;
namespace hmi_response = ::application_manager::hmi_response;
@@ -100,7 +100,8 @@ TEST_F(ButtonGetCapabilitiesResponseTest, Run_CodeAborted_SUCCESS) {
EXPECT_CALL(mock_hmi_capabilities_, set_button_capabilities(capabilities_))
.Times(0);
EXPECT_CALL(mock_hmi_capabilities_,
- set_preset_bank_capabilities(preset_bank_capabilities_)).Times(0);
+ set_preset_bank_capabilities(preset_bank_capabilities_))
+ .Times(0);
command->Run();
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/close_popup_response_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/close_popup_response_test.cc
index 6914a4ca7e..087109c871 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/close_popup_response_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/close_popup_response_test.cc
@@ -35,13 +35,13 @@
#include "gtest/gtest.h"
-#include "smart_objects/smart_object.h"
-#include "application_manager/smart_object_keys.h"
#include "application_manager/commands/command.h"
-#include "application_manager/commands/response_from_hmi.h"
-#include "hmi/close_popup_response.h"
#include "application_manager/commands/commands_test.h"
+#include "application_manager/commands/response_from_hmi.h"
#include "application_manager/mock_application.h"
+#include "application_manager/smart_object_keys.h"
+#include "hmi/close_popup_response.h"
+#include "smart_objects/smart_object.h"
namespace test {
namespace components {
@@ -50,9 +50,9 @@ namespace hmi_commands_test {
namespace close_popup_response {
namespace am = ::application_manager;
+using am::commands::CommandImpl;
using application_manager::commands::ResponseFromHMI;
using sdl_rpc_plugin::commands::ClosePopupResponse;
-using am::commands::CommandImpl;
typedef std::shared_ptr<ResponseFromHMI> ResponseFromHMIPtr;
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/dummy_hmi_commands_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/dummy_hmi_commands_test.cc
index 874d27b4b0..c66cb81141 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/dummy_hmi_commands_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/dummy_hmi_commands_test.cc
@@ -37,194 +37,191 @@
#include <vector>
#include "gtest/gtest.h"
+#include "hmi/activate_app_request.h"
+#include "hmi/activate_app_response.h"
+#include "hmi/add_statistics_info_notification.h"
#include "hmi/allow_all_apps_request.h"
#include "hmi/allow_all_apps_response.h"
#include "hmi/allow_app_request.h"
#include "hmi/allow_app_response.h"
+#include "hmi/basic_communication_system_request.h"
+#include "hmi/basic_communication_system_response.h"
+#include "hmi/bc_get_file_path_request.h"
+#include "hmi/bc_get_file_path_response.h"
+#include "hmi/button_get_capabilities_request.h"
+#include "hmi/button_get_capabilities_response.h"
+#include "hmi/close_popup_request.h"
+#include "hmi/close_popup_response.h"
+#include "hmi/dial_number_request.h"
+#include "hmi/dial_number_response.h"
+#include "hmi/get_system_info_request.h"
+#include "hmi/get_system_info_response.h"
+#include "hmi/mixing_audio_supported_request.h"
+#include "hmi/mixing_audio_supported_response.h"
+#include "hmi/navi_alert_maneuver_request.h"
+#include "hmi/navi_alert_maneuver_response.h"
#include "hmi/navi_audio_start_stream_request.h"
#include "hmi/navi_audio_start_stream_response.h"
#include "hmi/navi_audio_stop_stream_request.h"
#include "hmi/navi_audio_stop_stream_response.h"
-#include "hmi/update_device_list_request.h"
-#include "hmi/update_device_list_response.h"
-#include "hmi/on_update_device_list.h"
-#include "hmi/on_start_device_discovery.h"
-#include "hmi/update_app_list_request.h"
-#include "hmi/update_app_list_response.h"
-#include "hmi/on_find_applications.h"
-#include "hmi/sdl_get_list_of_permissions_request.h"
-#include "hmi/sdl_get_list_of_permissions_response.h"
-#include "hmi/sdl_get_user_friendly_message_request.h"
-#include "hmi/sdl_get_user_friendly_message_response.h"
-#include "hmi/sdl_get_status_update_request.h"
-#include "hmi/sdl_get_status_update_response.h"
-#include "hmi/on_status_update_notification.h"
-#include "hmi/update_sdl_request.h"
-#include "hmi/update_sdl_response.h"
-#include "hmi/activate_app_request.h"
-#include "hmi/activate_app_response.h"
-#include "hmi/mixing_audio_supported_request.h"
-#include "hmi/mixing_audio_supported_response.h"
+#include "hmi/navi_get_way_points_request.h"
+#include "hmi/navi_get_way_points_response.h"
+#include "hmi/navi_is_ready_request.h"
+#include "hmi/navi_is_ready_response.h"
+#include "hmi/navi_send_location_request.h"
+#include "hmi/navi_send_location_response.h"
+#include "hmi/navi_show_constant_tbt_request.h"
+#include "hmi/navi_show_constant_tbt_response.h"
+#include "hmi/navi_start_stream_request.h"
+#include "hmi/navi_start_stream_response.h"
+#include "hmi/navi_stop_stream_request.h"
+#include "hmi/navi_stop_stream_response.h"
+#include "hmi/navi_subscribe_way_points_request.h"
+#include "hmi/navi_subscribe_way_points_response.h"
+#include "hmi/navi_unsubscribe_way_points_request.h"
+#include "hmi/navi_unsubscribe_way_points_response.h"
+#include "hmi/navi_update_turn_list_request.h"
+#include "hmi/navi_update_turn_list_response.h"
#include "hmi/on_allow_sdl_functionality_notification.h"
+#include "hmi/on_app_activated_notification.h"
+#include "hmi/on_app_deactivated_notification.h"
#include "hmi/on_app_permission_changed_notification.h"
#include "hmi/on_app_permission_consent_notification.h"
-#include "hmi/on_app_activated_notification.h"
+#include "hmi/on_app_registered_notification.h"
+#include "hmi/on_app_unregistered_notification.h"
#include "hmi/on_audio_data_streaming_notification.h"
-#include "hmi/on_video_data_streaming_notification.h"
-#include "hmi/on_sdl_consent_needed_notification.h"
+#include "hmi/on_button_event_notification.h"
+#include "hmi/on_button_press_notification.h"
+#include "hmi/on_button_subscription_notification.h"
+#include "hmi/on_device_chosen_notification.h"
+#include "hmi/on_device_state_changed_notification.h"
+#include "hmi/on_driver_distraction_notification.h"
+#include "hmi/on_event_changed_notification.h"
#include "hmi/on_exit_all_applications_notification.h"
#include "hmi/on_exit_application_notification.h"
+#include "hmi/on_file_removed_notification.h"
+#include "hmi/on_find_applications.h"
+#include "hmi/on_ignition_cycle_over_notification.h"
+#include "hmi/on_navi_tbt_client_state_notification.h"
+#include "hmi/on_navi_way_point_change_notification.h"
+#include "hmi/on_policy_update.h"
#include "hmi/on_put_file_notification.h"
+#include "hmi/on_ready_notification.h"
+#include "hmi/on_received_policy_update.h"
+#include "hmi/on_record_start_notification.h"
#include "hmi/on_resume_audio_source_notification.h"
-#include "hmi/on_ignition_cycle_over_notification.h"
+#include "hmi/on_sdl_close_notification.h"
+#include "hmi/on_sdl_consent_needed_notification.h"
+#include "hmi/on_sdl_persistence_complete_notification.h"
+#include "hmi/on_start_device_discovery.h"
+#include "hmi/on_status_update_notification.h"
+#include "hmi/on_system_context_notification.h"
+#include "hmi/on_system_error_notification.h"
#include "hmi/on_system_info_changed_notification.h"
-#include "hmi/get_system_info_request.h"
-#include "hmi/get_system_info_response.h"
-#include "hmi/close_popup_request.h"
-#include "hmi/close_popup_response.h"
-#include "hmi/button_get_capabilities_request.h"
-#include "hmi/button_get_capabilities_response.h"
+#include "hmi/on_system_request_notification.h"
+#include "hmi/on_tts_language_change_notification.h"
+#include "hmi/on_tts_reset_timeout_notification.h"
+#include "hmi/on_tts_started_notification.h"
+#include "hmi/on_tts_stopped_notification.h"
+#include "hmi/on_ui_command_notification.h"
+#include "hmi/on_ui_keyboard_input_notification.h"
+#include "hmi/on_ui_language_change_notification.h"
+#include "hmi/on_ui_reset_timeout_notification.h"
+#include "hmi/on_ui_touch_event_notification.h"
+#include "hmi/on_update_device_list.h"
+#include "hmi/on_video_data_streaming_notification.h"
+#include "hmi/on_vr_command_notification.h"
+#include "hmi/on_vr_language_change_notification.h"
+#include "hmi/on_vr_started_notification.h"
+#include "hmi/on_vr_stopped_notification.h"
+#include "hmi/sdl_activate_app_request.h"
+#include "hmi/sdl_activate_app_response.h"
+#include "hmi/sdl_get_list_of_permissions_request.h"
+#include "hmi/sdl_get_list_of_permissions_response.h"
+#include "hmi/sdl_get_status_update_request.h"
+#include "hmi/sdl_get_status_update_response.h"
+#include "hmi/sdl_get_user_friendly_message_request.h"
+#include "hmi/sdl_get_user_friendly_message_response.h"
+#include "hmi/sdl_policy_update.h"
+#include "hmi/sdl_policy_update_response.h"
+#include "hmi/tts_change_registration_request.h"
+#include "hmi/tts_change_registration_response.h"
+#include "hmi/tts_get_capabilities_request.h"
+#include "hmi/tts_get_capabilities_response.h"
+#include "hmi/tts_get_language_request.h"
+#include "hmi/tts_get_language_response.h"
+#include "hmi/tts_get_supported_languages_request.h"
+#include "hmi/tts_get_supported_languages_response.h"
+#include "hmi/tts_is_ready_request.h"
+#include "hmi/tts_is_ready_response.h"
+#include "hmi/tts_set_global_properties_request.h"
+#include "hmi/tts_set_global_properties_response.h"
+#include "hmi/tts_speak_request.h"
+#include "hmi/tts_speak_response.h"
+#include "hmi/tts_stop_speaking_request.h"
+#include "hmi/tts_stop_speaking_response.h"
#include "hmi/ui_add_command_request.h"
#include "hmi/ui_add_command_response.h"
-#include "hmi/ui_delete_command_request.h"
-#include "hmi/ui_delete_command_response.h"
#include "hmi/ui_add_submenu_request.h"
#include "hmi/ui_add_submenu_response.h"
+#include "hmi/ui_alert_request.h"
+#include "hmi/ui_alert_response.h"
+#include "hmi/ui_change_registration_request.h"
+#include "hmi/ui_change_registration_response.h"
+#include "hmi/ui_delete_command_request.h"
+#include "hmi/ui_delete_command_response.h"
#include "hmi/ui_delete_submenu_request.h"
#include "hmi/ui_delete_submenu_response.h"
-#include "hmi/ui_get_supported_languages_request.h"
-#include "hmi/ui_get_supported_languages_response.h"
-#include "hmi/ui_get_language_request.h"
-#include "hmi/ui_get_language_response.h"
+#include "hmi/ui_end_audio_pass_thru_request.h"
+#include "hmi/ui_end_audio_pass_thru_response.h"
#include "hmi/ui_get_capabilities_request.h"
#include "hmi/ui_get_capabilities_response.h"
-#include "hmi/ui_change_registration_request.h"
-#include "hmi/ui_change_registration_response.h"
-#include "hmi/ui_show_request.h"
-#include "hmi/ui_show_response.h"
-#include "hmi/ui_alert_request.h"
-#include "hmi/ui_alert_response.h"
+#include "hmi/ui_get_language_request.h"
+#include "hmi/ui_get_language_response.h"
+#include "hmi/ui_get_supported_languages_request.h"
+#include "hmi/ui_get_supported_languages_response.h"
#include "hmi/ui_is_ready_request.h"
#include "hmi/ui_is_ready_response.h"
-#include "hmi/ui_slider_request.h"
-#include "hmi/ui_slider_response.h"
-#include "hmi/ui_set_media_clock_timer_request.h"
-#include "hmi/ui_set_media_clock_timer_response.h"
-#include "hmi/ui_set_global_properties_request.h"
-#include "hmi/ui_set_global_properties_response.h"
+#include "hmi/ui_perform_audio_pass_thru_request.h"
+#include "hmi/ui_perform_audio_pass_thru_response.h"
+#include "hmi/ui_perform_interaction_request.h"
+#include "hmi/ui_perform_interaction_response.h"
#include "hmi/ui_scrollable_message_request.h"
#include "hmi/ui_scrollable_message_response.h"
#include "hmi/ui_set_app_icon_request.h"
#include "hmi/ui_set_app_icon_response.h"
-#include "hmi/ui_perform_audio_pass_thru_response.h"
-#include "hmi/ui_perform_audio_pass_thru_request.h"
-#include "hmi/ui_end_audio_pass_thru_request.h"
-#include "hmi/ui_end_audio_pass_thru_response.h"
-#include "hmi/ui_perform_interaction_request.h"
-#include "hmi/ui_perform_interaction_response.h"
-#include "hmi/vr_is_ready_request.h"
-#include "hmi/vr_is_ready_response.h"
+#include "hmi/ui_set_display_layout_request.h"
+#include "hmi/ui_set_display_layout_response.h"
+#include "hmi/ui_set_global_properties_request.h"
+#include "hmi/ui_set_global_properties_response.h"
+#include "hmi/ui_set_media_clock_timer_request.h"
+#include "hmi/ui_set_media_clock_timer_response.h"
+#include "hmi/ui_show_request.h"
+#include "hmi/ui_show_response.h"
+#include "hmi/ui_slider_request.h"
+#include "hmi/ui_slider_response.h"
+#include "hmi/update_app_list_request.h"
+#include "hmi/update_app_list_response.h"
+#include "hmi/update_device_list_request.h"
+#include "hmi/update_device_list_response.h"
+#include "hmi/update_sdl_request.h"
+#include "hmi/update_sdl_response.h"
#include "hmi/vr_add_command_request.h"
#include "hmi/vr_add_command_response.h"
-#include "hmi/vr_delete_command_request.h"
-#include "hmi/vr_delete_command_response.h"
#include "hmi/vr_change_registration_request.h"
#include "hmi/vr_change_registration_response.h"
-#include "hmi/vr_get_supported_languages_request.h"
-#include "hmi/vr_get_supported_languages_response.h"
-#include "hmi/vr_get_language_request.h"
-#include "hmi/vr_get_language_response.h"
+#include "hmi/vr_delete_command_request.h"
+#include "hmi/vr_delete_command_response.h"
#include "hmi/vr_get_capabilities_request.h"
#include "hmi/vr_get_capabilities_response.h"
-#include "hmi/tts_is_ready_request.h"
-#include "hmi/tts_is_ready_response.h"
-#include "hmi/tts_change_registration_request.h"
-#include "hmi/tts_change_registration_response.h"
-#include "hmi/tts_get_supported_languages_request.h"
-#include "hmi/tts_get_supported_languages_response.h"
-#include "hmi/tts_get_language_request.h"
-#include "hmi/tts_get_language_response.h"
-#include "hmi/tts_stop_speaking_request.h"
-#include "hmi/tts_stop_speaking_response.h"
-#include "hmi/tts_speak_request.h"
-#include "hmi/tts_speak_response.h"
-#include "hmi/tts_set_global_properties_request.h"
-#include "hmi/tts_set_global_properties_response.h"
-#include "hmi/tts_get_capabilities_request.h"
-#include "hmi/tts_get_capabilities_response.h"
+#include "hmi/vr_get_language_request.h"
+#include "hmi/vr_get_language_response.h"
+#include "hmi/vr_get_supported_languages_request.h"
+#include "hmi/vr_get_supported_languages_response.h"
+#include "hmi/vr_is_ready_request.h"
+#include "hmi/vr_is_ready_response.h"
#include "hmi/vr_perform_interaction_request.h"
#include "hmi/vr_perform_interaction_response.h"
-#include "hmi/sdl_activate_app_request.h"
-#include "hmi/sdl_activate_app_response.h"
-#include "hmi/on_app_permission_changed_notification.h"
-#include "hmi/on_event_changed_notification.h"
-#include "hmi/navi_is_ready_request.h"
-#include "hmi/navi_show_constant_tbt_request.h"
-#include "hmi/navi_show_constant_tbt_response.h"
-#include "hmi/navi_is_ready_response.h"
-#include "hmi/navi_alert_maneuver_request.h"
-#include "hmi/navi_alert_maneuver_response.h"
-#include "hmi/navi_update_turn_list_request.h"
-#include "hmi/navi_update_turn_list_response.h"
-#include "hmi/navi_subscribe_way_points_request.h"
-#include "hmi/navi_subscribe_way_points_response.h"
-#include "hmi/navi_unsubscribe_way_points_request.h"
-#include "hmi/navi_unsubscribe_way_points_response.h"
-#include "hmi/navi_get_way_points_request.h"
-#include "hmi/navi_get_way_points_response.h"
-#include "hmi/on_ready_notification.h"
-#include "hmi/on_device_chosen_notification.h"
-#include "hmi/on_file_removed_notification.h"
-#include "hmi/on_system_context_notification.h"
-#include "hmi/on_app_registered_notification.h"
-#include "hmi/on_app_unregistered_notification.h"
-#include "hmi/on_driver_distraction_notification.h"
-#include "hmi/on_tts_started_notification.h"
-#include "hmi/on_tts_stopped_notification.h"
-#include "hmi/on_vr_started_notification.h"
-#include "hmi/on_vr_stopped_notification.h"
-#include "hmi/on_vr_command_notification.h"
-#include "hmi/on_ui_command_notification.h"
-#include "hmi/on_app_deactivated_notification.h"
-#include "hmi/on_ui_language_change_notification.h"
-#include "hmi/on_vr_language_change_notification.h"
-#include "hmi/on_tts_language_change_notification.h"
-#include "hmi/on_navi_tbt_client_state_notification.h"
-#include "hmi/on_navi_way_point_change_notification.h"
-#include "hmi/on_button_event_notification.h"
-#include "hmi/on_button_press_notification.h"
-#include "hmi/on_button_subscription_notification.h"
-#include "hmi/on_ui_keyboard_input_notification.h"
-#include "hmi/on_ui_touch_event_notification.h"
-#include "hmi/on_ui_reset_timeout_notification.h"
-#include "hmi/navi_start_stream_request.h"
-#include "hmi/navi_start_stream_response.h"
-#include "hmi/navi_stop_stream_request.h"
-#include "hmi/navi_stop_stream_response.h"
-#include "hmi/on_system_request_notification.h"
-#include "hmi/ui_set_display_layout_request.h"
-#include "hmi/ui_set_display_layout_response.h"
-#include "hmi/on_sdl_close_notification.h"
-#include "hmi/on_sdl_persistence_complete_notification.h"
-#include "hmi/on_record_start_notification.h"
-#include "hmi/add_statistics_info_notification.h"
-#include "hmi/on_system_error_notification.h"
-#include "hmi/basic_communication_system_request.h"
-#include "hmi/basic_communication_system_response.h"
-#include "hmi/sdl_policy_update.h"
-#include "hmi/sdl_policy_update_response.h"
-#include "hmi/on_received_policy_update.h"
-#include "hmi/on_policy_update.h"
-#include "hmi/get_urls.h"
-#include "hmi/get_urls_response.h"
-#include "hmi/on_device_state_changed_notification.h"
-#include "hmi/navi_send_location_request.h"
-#include "hmi/navi_send_location_response.h"
-#include "hmi/on_tts_reset_timeout_notification.h"
-#include "hmi/dial_number_request.h"
-#include "hmi/dial_number_response.h"
-#include "hmi/bc_get_file_path_request.h"
-#include "hmi/bc_get_file_path_response.h"
#include "application_manager/commands/commands_test.h"
#include "application_manager/mock_application.h"
@@ -242,16 +239,16 @@ namespace dummy_hmi_commands_test {
namespace commands = sdl_rpc_plugin::commands;
-using ::testing::_;
-using ::testing::NotNull;
-using ::testing::Types;
+using ::application_manager::ApplicationSharedPtr;
using application_manager::commands::MessageSharedPtr;
-using ::test::components::event_engine_test::MockEventDispatcher;
+using ::test::components::application_manager_test::MockApplication;
using ::test::components::application_manager_test::MockApplicationManager;
using ::test::components::application_manager_test::
MockApplicationManagerSettings;
-using ::application_manager::ApplicationSharedPtr;
-using ::test::components::application_manager_test::MockApplication;
+using ::test::components::event_engine_test::MockEventDispatcher;
+using ::testing::_;
+using ::testing::NotNull;
+using ::testing::Types;
template <class Command>
class HMICommandsTest : public components::commands_test::CommandRequestTest<
@@ -321,8 +318,6 @@ typedef Types<commands::OnStartDeviceDiscovery,
commands::SDLActivateAppRequest,
commands::SDLPolicyUpdateResponse,
commands::SDLPolicyUpdate,
- commands::GetUrlsResponse,
- commands::GetUrls,
commands::OnAppPermissionChangedNotification,
commands::SDLGetListOfPermissionsResponse,
commands::SDLGetListOfPermissionsRequest,
@@ -359,7 +354,8 @@ typedef Types<commands::OnStartDeviceDiscovery,
commands::UIGetLanguageRequest,
commands::UIGetCapabilitiesResponse,
commands::UIGetCapabilitiesRequest,
- commands::UIChangeRegistratioResponse> HMICommandsListFirst;
+ commands::UIChangeRegistratioResponse>
+ HMICommandsListFirst;
typedef Types<commands::UIChangeRegistrationRequest,
commands::UIPerformAudioPassThruResponse,
@@ -409,7 +405,8 @@ typedef Types<commands::UIChangeRegistrationRequest,
commands::ClosePopupResponse,
commands::ClosePopupRequest,
commands::UIIsReadyResponse,
- commands::UIIsReadyRequest> HMICommandsListSecond;
+ commands::UIIsReadyRequest>
+ HMICommandsListSecond;
typedef Types<commands::NaviIsReadyResponse,
commands::NaviIsReadyRequest,
@@ -447,7 +444,8 @@ typedef Types<commands::NaviIsReadyResponse,
commands::OnVRStoppedNotification,
commands::OnVRCommandNotification,
commands::OnUICommandNotification,
- commands::OnAppDeactivatedNotification> HMICommandsListThird;
+ commands::OnAppDeactivatedNotification>
+ HMICommandsListThird;
typedef Types<commands::hmi::OnButtonEventNotification,
commands::hmi::OnButtonPressNotification,
@@ -493,14 +491,16 @@ typedef Types<commands::hmi::OnButtonEventNotification,
commands::OnNaviWayPointChangeNotification,
commands::OnUILanguageChangeNotification,
commands::OnVRLanguageChangeNotification,
- commands::OnTTSLanguageChangeNotification> HMICommandsListFourth;
+ commands::OnTTSLanguageChangeNotification>
+ HMICommandsListFourth;
typedef Types<commands::AllowAllAppsRequest,
commands::AllowAllAppsResponse,
commands::AllowAppRequest,
commands::AllowAppResponse,
commands::BCGetFilePathRequest,
- commands::BCGetFilePathResponse> HMICommandsListFifth;
+ commands::BCGetFilePathResponse>
+ HMICommandsListFifth;
TYPED_TEST_CASE(HMICommandsTestFirst, HMICommandsListFirst);
TYPED_TEST_CASE(HMICommandsTestSecond, HMICommandsListSecond);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/get_system_info_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/get_system_info_request_test.cc
index 4cbe7305ea..5b860499dd 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/get_system_info_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/get_system_info_request_test.cc
@@ -35,13 +35,13 @@
#include "gtest/gtest.h"
-#include "smart_objects/smart_object.h"
-#include "application_manager/smart_object_keys.h"
-#include "application_manager/commands/commands_test.h"
#include "application_manager/application.h"
-#include "application_manager/mock_application_manager.h"
+#include "application_manager/commands/commands_test.h"
#include "application_manager/commands/request_to_hmi.h"
+#include "application_manager/mock_application_manager.h"
+#include "application_manager/smart_object_keys.h"
#include "hmi/get_system_info_request.h"
+#include "smart_objects/smart_object.h"
namespace test {
namespace components {
@@ -51,9 +51,9 @@ namespace get_system_info_request {
namespace am = ::application_manager;
namespace strings = ::application_manager::strings;
+using am::commands::CommandImpl;
using am::commands::RequestToHMI;
using sdl_rpc_plugin::commands::GetSystemInfoRequest;
-using am::commands::CommandImpl;
typedef std::shared_ptr<RequestToHMI> RequestToHMIPtr;
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/get_system_info_response_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/get_system_info_response_test.cc
index 6908e21053..11589683be 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/get_system_info_response_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/get_system_info_response_test.cc
@@ -33,32 +33,32 @@
#include <stdint.h>
#include <string>
-#include "gtest/gtest.h"
-#include "smart_objects/smart_object.h"
-#include "application_manager/smart_object_keys.h"
#include "application_manager/application.h"
+#include "application_manager/commands/commands_test.h"
+#include "application_manager/commands/response_from_hmi.h"
+#include "application_manager/mock_application_manager.h"
#include "application_manager/mock_hmi_capabilities.h"
#include "application_manager/mock_message_helper.h"
-#include "application_manager/mock_application_manager.h"
-#include "application_manager/commands/response_from_hmi.h"
-#include "hmi/get_system_info_response.h"
#include "application_manager/policies/mock_policy_handler_interface.h"
-#include "application_manager/commands/commands_test.h"
+#include "application_manager/smart_object_keys.h"
+#include "gtest/gtest.h"
+#include "hmi/get_system_info_response.h"
+#include "smart_objects/smart_object.h"
namespace test {
namespace components {
namespace commands_test {
namespace hmi_commands_test {
namespace get_system_info_response {
-using ::testing::Return;
using ::testing::NiceMock;
+using ::testing::Return;
namespace am = ::application_manager;
namespace strings = ::application_manager::strings;
namespace hmi_response = am::hmi_response;
+using am::commands::CommandImpl;
using application_manager::commands::ResponseFromHMI;
using sdl_rpc_plugin::commands::GetSystemInfoResponse;
using sdl_rpc_plugin::commands::SystemInfo;
-using am::commands::CommandImpl;
typedef std::shared_ptr<ResponseFromHMI> ResponseFromHMIPtr;
typedef NiceMock<
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/get_urls_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/get_urls_test.cc
deleted file mode 100644
index 20a05d8601..0000000000
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/get_urls_test.cc
+++ /dev/null
@@ -1,334 +0,0 @@
-/*
- * Copyright (c) 2018, Ford Motor Company
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of the Ford Motor Company nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <stdint.h>
-#include <string>
-
-#include "gtest/gtest.h"
-#include "application_manager/message.h"
-#include "application_manager/commands/commands_test.h"
-#include "application_manager/mock_application.h"
-#include "application_manager/mock_application_manager.h"
-#include "smart_objects/smart_object.h"
-#include "application_manager/smart_object_keys.h"
-#include "application_manager/commands/command.h"
-#include "hmi/get_urls.h"
-#include "application_manager/policies/policy_handler.h"
-#include "application_manager/policies/mock_policy_handler_interface.h"
-#include "application_manager/commands/command_request_test.h"
-#include "application_manager/commands/request_from_hmi.h"
-#include "policy/mock_policy_manager.h"
-#include "application_manager/event_engine/event_dispatcher.h"
-
-namespace test {
-namespace components {
-namespace commands_test {
-namespace hmi_commands_test {
-namespace get_urls {
-
-using namespace hmi_apis;
-using namespace policy;
-using ::testing::NiceMock;
-using ::testing::_;
-using ::testing::SetArgReferee;
-using ::test::components::application_manager_test::MockApplication;
-namespace am = ::application_manager;
-namespace strings = ::application_manager::strings;
-using am::commands::RequestFromHMI;
-using sdl_rpc_plugin::commands::GetUrls;
-using am::commands::CommandImpl;
-using policy::PolicyHandler;
-using policy_test::MockPolicyHandlerInterface;
-
-typedef std::shared_ptr<RequestFromHMI> RequestFromHMIPtr;
-
-namespace {
-const uint32_t kInvalidAppId_ = 0u;
-const uint32_t kAppIdForSending = 1u;
-const uint32_t kConnectionKey = 2u;
-const uint32_t kServiceType = 0u;
-const std::string kInitialService = "0x0";
-const std::string kPolicyService = "7";
-const std::string kDefaultUrl = "URL is not found";
-const std::string kDefaultId = "default";
-const std::string kPolicyAppId = "policy_app_id";
-} // namespace
-
-class GetUrlsTest : public CommandRequestTest<CommandsTestMocks::kIsNice> {
- public:
- MessageSharedPtr command_msg_;
- RequestFromHMIPtr request_command_;
-
- GetUrlsTest() {
- command_msg_ =
- CreateMessage(ns_smart_device_link::ns_smart_objects::SmartType_Map);
- (*command_msg_)[am::strings::params][am::strings::connection_key] =
- kConnectionKey;
- (*command_msg_)[am::strings::msg_params][am::hmi_request::service] =
- kInitialService;
-
- request_command_ = CreateCommand<GetUrls>(command_msg_);
- }
-};
-
-TEST_F(GetUrlsTest, RUN_SUCCESS) {
- EXPECT_CALL(mock_policy_handler_, PolicyEnabled()).WillOnce(Return(true));
- // EXPECT_CALL(mock_policy_handler_, GetUpdateUrls(_, _));
-
- request_command_->Run();
-}
-
-TEST_F(GetUrlsTest, RUN_PolicyNotEnabled_UNSUCCESS) {
- EXPECT_CALL(mock_policy_handler_, PolicyEnabled()).WillOnce(Return(false));
-
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(command_msg_, _))
- .WillOnce(Return(true));
-
- request_command_->Run();
-
- EXPECT_EQ(am::MessageType::kResponse,
- (*command_msg_)[strings::params][strings::message_type].asInt());
- EXPECT_EQ(Common_Result::DATA_NOT_AVAILABLE,
- (*command_msg_)[strings::params][am::hmi_response::code].asInt());
-}
-
-TEST_F(GetUrlsTest, RUN_EmptyEndpoints_UNSUCCESS) {
- EndpointUrls endpoints_;
- EXPECT_CALL(mock_policy_handler_, GetUpdateUrls(kServiceType, _))
- .WillOnce(SetArgReferee<1>(endpoints_));
- EXPECT_CALL(mock_policy_handler_, PolicyEnabled()).WillOnce(Return(true));
-
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(command_msg_, _))
- .WillOnce(Return(true));
-
- request_command_->Run();
-
- EXPECT_EQ(am::MessageType::kResponse,
- (*command_msg_)[strings::params][strings::message_type].asInt());
- EXPECT_EQ(Common_Result::DATA_NOT_AVAILABLE,
- (*command_msg_)[strings::params][am::hmi_response::code].asInt());
-}
-
-#ifdef EXTENDED_POLICY
-TEST_F(GetUrlsTest, ProcessPolicyServiceURLs_SUCCESS) {
- (*command_msg_)[am::strings::msg_params][am::hmi_request::service] =
- kPolicyService;
-
- EXPECT_CALL(mock_policy_handler_, PolicyEnabled()).WillOnce(Return(true));
-
- EndpointUrls endpoints_;
- EndpointData data(kDefaultUrl);
- endpoints_.push_back(data);
-
- EXPECT_CALL(mock_policy_handler_, GetUpdateUrls(kPolicyService, _))
- .WillOnce(SetArgReferee<1>(endpoints_));
-
- MockAppPtr mock_app = CreateMockApp();
-
- EXPECT_CALL(mock_policy_handler_, GetAppIdForSending())
- .WillOnce(Return(kAppIdForSending));
-
- EXPECT_CALL(app_mngr_, application(kAppIdForSending))
- .WillOnce(Return(mock_app));
- EXPECT_CALL(*mock_app, app_id()).WillOnce(Return(kAppIdForSending));
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(command_msg_, _))
- .WillOnce(Return(true));
-
- request_command_->Run();
-
- EXPECT_FALSE((*command_msg_)[am::strings::msg_params].keyExists(
- am::hmi_request::service));
-
- EXPECT_EQ(am::MessageType::kResponse,
- (*command_msg_)[strings::params][strings::message_type].asInt());
- EXPECT_EQ(Common_Result::SUCCESS,
- (*command_msg_)[strings::params][am::hmi_response::code].asInt());
-
- EXPECT_EQ(kAppIdForSending,
- (*command_msg_)[am::strings::msg_params][am::hmi_response::urls][0]
- [strings::app_id].asInt());
- EXPECT_EQ(kDefaultUrl,
- (*command_msg_)[am::strings::msg_params][am::hmi_response::urls][0]
- [strings::url].asString());
-}
-
-TEST_F(GetUrlsTest, ProcessPolicyServiceURLs_IncorrectIdForSending_UNSUCCESS) {
- (*command_msg_)[am::strings::msg_params][am::hmi_request::service] =
- kPolicyService;
-
- EXPECT_CALL(mock_policy_handler_, PolicyEnabled()).WillOnce(Return(true));
-
- EndpointUrls endpoints_;
- EndpointData data(kDefaultUrl);
- endpoints_.push_back(data);
-
- EXPECT_CALL(mock_policy_handler_, GetUpdateUrls(kPolicyService, _))
- .WillOnce(SetArgReferee<1>(endpoints_));
-
- EXPECT_CALL(mock_policy_handler_, GetAppIdForSending())
- .WillOnce(Return(kInvalidAppId_));
-
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(command_msg_, _))
- .WillOnce(Return(true));
-
- EXPECT_CALL(app_mngr_, application(kInvalidAppId_)).Times(0);
-
- request_command_->Run();
-}
-
-TEST_F(GetUrlsTest, ProcessPolicyServiceURLs_ApplicationIsNotValid_UNSUCCESS) {
- (*command_msg_)[am::strings::msg_params][am::hmi_request::service] =
- kPolicyService;
-
- EXPECT_CALL(mock_policy_handler_, PolicyEnabled()).WillOnce(Return(true));
-
- EndpointUrls endpoints_;
- EndpointData data(kDefaultUrl);
- endpoints_.push_back(data);
-
- EXPECT_CALL(mock_policy_handler_, GetUpdateUrls(kPolicyService, _))
- .WillOnce(SetArgReferee<1>(endpoints_));
-
- MockAppPtr invalid_mock_app;
-
- EXPECT_CALL(mock_policy_handler_, GetAppIdForSending())
- .WillOnce(Return(kAppIdForSending));
-
- EXPECT_CALL(app_mngr_, application(kAppIdForSending))
- .WillOnce(Return(invalid_mock_app));
-
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(command_msg_, _))
- .WillOnce(Return(true));
-
- request_command_->Run();
-
- EXPECT_EQ(am::MessageType::kResponse,
- (*command_msg_)[strings::params][strings::message_type].asInt());
- EXPECT_EQ(Common_Result::DATA_NOT_AVAILABLE,
- (*command_msg_)[strings::params][am::hmi_response::code].asInt());
-}
-
-TEST_F(GetUrlsTest, ProcessPolicyServiceURLs_FoundURLForApplication_SUCCESS) {
- (*command_msg_)[am::strings::msg_params][am::hmi_request::service] =
- kPolicyService;
-
- EXPECT_CALL(mock_policy_handler_, PolicyEnabled()).WillOnce(Return(true));
-
- EndpointUrls endpoints_;
- EndpointData data(kDefaultUrl);
- data.app_id = kPolicyAppId;
- endpoints_.push_back(data);
-
- EXPECT_CALL(mock_policy_handler_, GetUpdateUrls(kPolicyService, _))
- .WillOnce(SetArgReferee<1>(endpoints_));
-
- MockAppPtr mock_app = CreateMockApp();
-
- EXPECT_CALL(mock_policy_handler_, GetAppIdForSending())
- .WillOnce(Return(kAppIdForSending));
-
- EXPECT_CALL(app_mngr_, application(kAppIdForSending))
- .WillOnce(Return(mock_app));
-
- EXPECT_CALL(*mock_app, policy_app_id()).WillOnce(Return(kPolicyAppId));
-
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(command_msg_, _))
- .WillOnce(Return(true));
-
- request_command_->Run();
-
- EXPECT_FALSE((*command_msg_)[am::strings::msg_params].keyExists(
- am::hmi_request::service));
-
- EXPECT_EQ(am::MessageType::kResponse,
- (*command_msg_)[strings::params][strings::message_type].asInt());
- EXPECT_EQ(Common_Result::SUCCESS,
- (*command_msg_)[strings::params][am::hmi_response::code].asInt());
-}
-#endif
-
-TEST_F(GetUrlsTest, DISABLED_ProcessServiceURLs_SUCCESS) {
- (*command_msg_)[am::strings::msg_params][am::hmi_response::urls][0] =
- kDefaultUrl;
- (*command_msg_)[am::strings::msg_params][am::hmi_response::urls][0]
- [am::hmi_response::policy_app_id] = "1";
-
- EXPECT_CALL(mock_policy_handler_, PolicyEnabled()).WillOnce(Return(true));
-
- EndpointUrls endpoints_;
- EndpointData data(kDefaultUrl);
- data.app_id = "1";
- endpoints_.push_back(data);
- EXPECT_CALL(mock_policy_handler_, GetUpdateUrls(kServiceType, _))
- .WillOnce(SetArgReferee<1>(endpoints_));
-
- request_command_->Run();
-
- EXPECT_FALSE((*command_msg_)[am::strings::msg_params].keyExists(
- am::hmi_request::service));
- EXPECT_EQ(kDefaultUrl,
- (*command_msg_)[am::strings::msg_params][am::hmi_response::urls][0]
- [am::strings::url].asString());
- EXPECT_EQ(endpoints_[0].app_id,
- (*command_msg_)[am::strings::msg_params][am::hmi_response::urls][0]
- [am::hmi_response::policy_app_id].asString());
-}
-
-TEST_F(GetUrlsTest, ProcessServiceURLs_PolicyDefaultId_SUCCESS) {
- (*command_msg_)[am::strings::msg_params][am::hmi_response::urls][0] =
- kDefaultUrl;
- (*command_msg_)[am::strings::msg_params][am::hmi_response::urls][0]
- [am::hmi_response::policy_app_id] = kDefaultId;
-
- EXPECT_CALL(mock_policy_handler_, PolicyEnabled()).WillOnce(Return(true));
- EndpointUrls endpoints_;
- EndpointData data(kDefaultUrl);
- endpoints_.push_back(data);
- EXPECT_CALL(mock_policy_handler_, GetUpdateUrls(kServiceType, _))
- .WillOnce(SetArgReferee<1>(endpoints_));
- MockAppPtr mock_app = CreateMockApp();
- EXPECT_CALL(app_mngr_, application_by_policy_id(_))
- .WillOnce(Return(mock_app));
- request_command_->Run();
-
- EXPECT_FALSE((*command_msg_)[am::strings::msg_params].keyExists(
- am::hmi_request::service));
- EXPECT_TRUE(
- (*command_msg_)[am::strings::msg_params][am::hmi_response::urls][0]
- .keyExists(am::hmi_response::policy_app_id));
-}
-
-} // namespace get_urls
-} // namespace hmi_commands_test
-} // namespace commands_test
-} // namespace components
-} // namespace test
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/hmi_notifications_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/hmi_notifications_test.cc
index ca322ea425..26f7a63872 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/hmi_notifications_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/hmi_notifications_test.cc
@@ -33,81 +33,81 @@
#include <stdint.h>
#include <string>
#include <vector>
-#include "gtest/gtest.h"
#include "application_manager/commands/commands_test.h"
-#include "sdl_rpc_plugin/commands/hmi/on_button_event_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_navi_tbt_client_state_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_navi_way_point_change_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_ui_command_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_ui_keyboard_input_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_ui_touch_event_notification.h"
+#include "gtest/gtest.h"
+#include "sdl_rpc_plugin/commands/hmi/on_allow_sdl_functionality_notification.h"
+#include "sdl_rpc_plugin/commands/hmi/on_app_activated_notification.h"
+#include "sdl_rpc_plugin/commands/hmi/on_app_deactivated_notification.h"
#include "sdl_rpc_plugin/commands/hmi/on_app_permission_changed_notification.h"
+#include "sdl_rpc_plugin/commands/hmi/on_app_permission_consent_notification.h"
#include "sdl_rpc_plugin/commands/hmi/on_app_registered_notification.h"
+#include "sdl_rpc_plugin/commands/hmi/on_app_unregistered_notification.h"
#include "sdl_rpc_plugin/commands/hmi/on_audio_data_streaming_notification.h"
+#include "sdl_rpc_plugin/commands/hmi/on_button_event_notification.h"
+#include "sdl_rpc_plugin/commands/hmi/on_button_press_notification.h"
#include "sdl_rpc_plugin/commands/hmi/on_button_subscription_notification.h"
+#include "sdl_rpc_plugin/commands/hmi/on_device_chosen_notification.h"
+#include "sdl_rpc_plugin/commands/hmi/on_device_state_changed_notification.h"
+#include "sdl_rpc_plugin/commands/hmi/on_driver_distraction_notification.h"
+#include "sdl_rpc_plugin/commands/hmi/on_event_changed_notification.h"
+#include "sdl_rpc_plugin/commands/hmi/on_exit_all_applications_notification.h"
+#include "sdl_rpc_plugin/commands/hmi/on_exit_application_notification.h"
#include "sdl_rpc_plugin/commands/hmi/on_file_removed_notification.h"
+#include "sdl_rpc_plugin/commands/hmi/on_ignition_cycle_over_notification.h"
+#include "sdl_rpc_plugin/commands/hmi/on_navi_tbt_client_state_notification.h"
+#include "sdl_rpc_plugin/commands/hmi/on_navi_way_point_change_notification.h"
+#include "sdl_rpc_plugin/commands/hmi/on_policy_update.h"
#include "sdl_rpc_plugin/commands/hmi/on_put_file_notification.h"
+#include "sdl_rpc_plugin/commands/hmi/on_ready_notification.h"
+#include "sdl_rpc_plugin/commands/hmi/on_received_policy_update.h"
+#include "sdl_rpc_plugin/commands/hmi/on_record_start_notification.h"
#include "sdl_rpc_plugin/commands/hmi/on_resume_audio_source_notification.h"
#include "sdl_rpc_plugin/commands/hmi/on_sdl_close_notification.h"
#include "sdl_rpc_plugin/commands/hmi/on_sdl_consent_needed_notification.h"
#include "sdl_rpc_plugin/commands/hmi/on_sdl_persistence_complete_notification.h"
+#include "sdl_rpc_plugin/commands/hmi/on_start_device_discovery.h"
#include "sdl_rpc_plugin/commands/hmi/on_status_update_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_video_data_streaming_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_record_start_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_app_activated_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_app_deactivated_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_app_unregistered_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_button_press_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_event_changed_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_ready_notification.h"
+#include "sdl_rpc_plugin/commands/hmi/on_system_context_notification.h"
+#include "sdl_rpc_plugin/commands/hmi/on_system_error_notification.h"
+#include "sdl_rpc_plugin/commands/hmi/on_system_info_changed_notification.h"
+#include "sdl_rpc_plugin/commands/hmi/on_system_request_notification.h"
+#include "sdl_rpc_plugin/commands/hmi/on_tts_language_change_notification.h"
#include "sdl_rpc_plugin/commands/hmi/on_tts_reset_timeout_notification.h"
#include "sdl_rpc_plugin/commands/hmi/on_tts_started_notification.h"
#include "sdl_rpc_plugin/commands/hmi/on_tts_stopped_notification.h"
+#include "sdl_rpc_plugin/commands/hmi/on_ui_command_notification.h"
+#include "sdl_rpc_plugin/commands/hmi/on_ui_keyboard_input_notification.h"
+#include "sdl_rpc_plugin/commands/hmi/on_ui_language_change_notification.h"
#include "sdl_rpc_plugin/commands/hmi/on_ui_reset_timeout_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_vr_started_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_vr_stopped_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_app_permission_consent_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_ignition_cycle_over_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_policy_update.h"
-#include "sdl_rpc_plugin/commands/hmi/on_received_policy_update.h"
-#include "sdl_rpc_plugin/commands/hmi/on_system_error_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_system_info_changed_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_allow_sdl_functionality_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_device_state_changed_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_exit_all_applications_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_exit_application_notification.h"
+#include "sdl_rpc_plugin/commands/hmi/on_ui_touch_event_notification.h"
+#include "sdl_rpc_plugin/commands/hmi/on_video_data_streaming_notification.h"
#include "sdl_rpc_plugin/commands/hmi/on_vr_command_notification.h"
#include "sdl_rpc_plugin/commands/hmi/on_vr_language_change_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_start_device_discovery.h"
-#include "sdl_rpc_plugin/commands/hmi/on_device_chosen_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_system_context_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_system_request_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_tts_language_change_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_ui_language_change_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_driver_distraction_notification.h"
+#include "sdl_rpc_plugin/commands/hmi/on_vr_started_notification.h"
+#include "sdl_rpc_plugin/commands/hmi/on_vr_stopped_notification.h"
-#include "utils/lock.h"
#include "utils/data_accessor.h"
+#include "utils/lock.h"
#include "utils/signals.h"
-#include "utils/file_system.h"
-#include "smart_objects/smart_object.h"
-#include "application_manager/smart_object_keys.h"
-#include "application_manager/mock_application_manager.h"
-#include "application_manager/mock_rpc_plugin_manager.h"
-#include "application_manager/mock_state_controller.h"
+#include "application_manager/hmi_capabilities_impl.h"
#include "application_manager/mock_application.h"
+#include "application_manager/mock_application_manager.h"
#include "application_manager/mock_event_dispatcher.h"
-#include "application_manager/hmi_capabilities_impl.h"
#include "application_manager/mock_hmi_capabilities.h"
-#include "transport_manager/mock_transport_manager.h"
+#include "application_manager/mock_message_helper.h"
+#include "application_manager/mock_resume_ctrl.h"
+#include "application_manager/mock_rpc_plugin_manager.h"
+#include "application_manager/mock_state_controller.h"
+#include "application_manager/policies/mock_policy_handler_interface.h"
+#include "application_manager/smart_object_keys.h"
#include "connection_handler/mock_connection_handler.h"
#include "connection_handler/mock_connection_handler_settings.h"
-#include "test/application_manager/mock_application_manager_settings.h"
-#include "application_manager/policies/mock_policy_handler_interface.h"
-#include "application_manager/mock_message_helper.h"
#include "protocol_handler/mock_session_observer.h"
-#include "application_manager/mock_resume_ctrl.h"
+#include "smart_objects/smart_object.h"
+#include "test/application_manager/mock_application_manager_settings.h"
+#include "transport_manager/mock_transport_manager.h"
+#include "utils/file_system.h"
namespace am = application_manager;
@@ -117,22 +117,22 @@ namespace commands_test {
namespace hmi_commands_test {
namespace hmi_notifications_test {
-using ::testing::_;
-using ::testing::Test;
-using ::testing::Types;
-using ::testing::Return;
-using ::testing::ReturnRef;
-using ::testing::NiceMock;
-using ::testing::InSequence;
-using ::smart_objects::SmartObject;
+using ::application_manager::ApplicationSharedPtr;
+using ::application_manager::MockMessageHelper;
using ::application_manager::commands::MessageSharedPtr;
+using ::smart_objects::SmartObject;
+using ::test::components::application_manager_test::MockApplication;
using ::test::components::application_manager_test::MockApplicationManager;
using ::test::components::application_manager_test::
MockApplicationManagerSettings;
-using ::application_manager::ApplicationSharedPtr;
-using ::test::components::application_manager_test::MockApplication;
using ::test::components::event_engine_test::MockEventDispatcher;
-using ::application_manager::MockMessageHelper;
+using ::testing::_;
+using ::testing::InSequence;
+using ::testing::NiceMock;
+using ::testing::Return;
+using ::testing::ReturnRef;
+using ::testing::Test;
+using ::testing::Types;
using namespace sdl_rpc_plugin::commands;
using namespace am::commands;
@@ -148,6 +148,11 @@ typedef NiceMock<
#define NAVI true
#define NOT_NAVI false
+namespace {
+const am::WindowID kDefaultWindowId =
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW;
+}
+
ACTION_P(GetEventId, event_id) {
*event_id = arg0.id();
}
@@ -155,8 +160,8 @@ ACTION_P(GetArg, arg) {
*arg = arg0;
}
-ACTION_P(GetArg3, result) {
- arg3 = *result;
+ACTION_P(GetArg4, result) {
+ arg4 = *result;
}
ACTION_P2(GetConnectIdPermissionConsent, connect_id, consent) {
@@ -192,6 +197,14 @@ const int32_t kMobileProtocolType_ = 0;
const int32_t kProtocolVersion_ = 3;
const uint32_t kCorrelationId_ = 1939u;
const uint32_t kAppId_ = 2014u;
+const std::string kDefaultLanguage = "en-us";
+const mobile_apis::Language::eType kMobileLanguage =
+ mobile_apis::Language::EN_US;
+
+// LSDW - lock screen dismissal warning
+const std::string kLockScreenDismissalWarningMessage_en =
+ "Swipe down to dismiss, acknowledging that you are not the driver";
+const uint32_t kConnectionKey = 2u;
} // namespace
class HMICommandsNotificationsTest
@@ -240,6 +253,9 @@ class HMICommandsNotificationsTest
.WillByDefault(ReturnRef(mock_event_dispatcher_));
ON_CALL(app_mngr_, application_by_hmi_app(_)).WillByDefault(Return(app_));
ON_CALL(*app_ptr_, app_id()).WillByDefault(Return(kAppId_));
+ ON_CALL(app_mngr_, application(kConnectionKey)).WillByDefault(Return(app_));
+ ON_CALL(mock_message_helper_, MobileLanguageToString(kMobileLanguage))
+ .WillByDefault(Return(kDefaultLanguage));
}
am::ApplicationSharedPtr ConfigureApp(NiceMock<MockApplication>** app_mock,
@@ -259,6 +275,8 @@ class HMICommandsNotificationsTest
.WillByDefault(Return(vc));
ON_CALL(**app_mock, IsAudioApplication())
.WillByDefault(Return(media || navi || vc));
+ ON_CALL(**app_mock, ui_language())
+ .WillByDefault(ReturnRef(kMobileLanguage));
return app;
}
#if defined(OS_POSIX)
@@ -319,7 +337,8 @@ typedef Types<OnAppPermissionChangedNotification,
OnSDLPersistenceCompleteNotification,
OnStatusUpdateNotification,
OnVideoDataStreamingNotification,
- OnRecordStartdNotification> HMIOnNotificationsListToHMITypes;
+ OnRecordStartdNotification>
+ HMIOnNotificationsListToHMITypes;
typedef Types<
CommandPair<OnAppActivatedNotification,
@@ -1023,7 +1042,8 @@ TEST_F(HMICommandsNotificationsTest,
EXPECT_CALL(app_mngr_, application(kAppId_)).WillRepeatedly(Return(app_));
EXPECT_CALL(mock_message_helper_,
GetOnAppInterfaceUnregisteredNotificationToMobile(
- kAppId_, *it_mobile_reason)).WillOnce(Return(notification));
+ kAppId_, *it_mobile_reason))
+ .WillOnce(Return(notification));
EXPECT_CALL(mock_rpc_service_,
ManageMobileCommand(notification, Command::SOURCE_SDL));
EXPECT_CALL(app_mngr_,
@@ -1088,6 +1108,7 @@ TEST_F(HMICommandsNotificationsTest,
.WillOnce(ReturnRef(mock_state_controller_));
EXPECT_CALL(mock_state_controller_,
SetRegularState(app_,
+ kDefaultWindowId,
mobile_apis::HMILevel::HMI_NONE,
mobile_apis::AudioStreamingState::NOT_AUDIBLE,
mobile_apis::VideoStreamingState::NOT_STREAMABLE,
@@ -1112,12 +1133,7 @@ TEST_F(HMICommandsNotificationsTest,
EXPECT_CALL(app_mngr_, UnregisterApplication(_, _, _, _)).Times(0);
EXPECT_CALL(app_mngr_, state_controller())
.WillOnce(ReturnRef(mock_state_controller_));
- EXPECT_CALL(mock_state_controller_,
- SetRegularState(app_,
- mobile_apis::HMILevel::HMI_NONE,
- mobile_apis::AudioStreamingState::NOT_AUDIBLE,
- mobile_apis::VideoStreamingState::NOT_STREAMABLE,
- false));
+ EXPECT_CALL(mock_state_controller_, ExitDefaultWindow(app_));
command->Run();
}
@@ -1135,7 +1151,8 @@ TEST_F(HMICommandsNotificationsTest,
EXPECT_CALL(app_mngr_, state_controller())
.WillOnce(ReturnRef(mock_state_controller_));
EXPECT_CALL(mock_state_controller_,
- SetRegularState(_, mobile_apis::HMILevel::HMI_FULL, true));
+ SetRegularState(
+ _, kDefaultWindowId, mobile_apis::HMILevel::HMI_FULL, true));
EXPECT_CALL(app_mngr_, get_settings())
.WillOnce(ReturnRef(app_mngr_settings_));
@@ -1336,8 +1353,10 @@ TEST_F(HMICommandsNotificationsTest,
EXPECT_CALL(*app_ptr_, language()).WillRepeatedly(ReturnRef(kLang));
EXPECT_CALL(app_mngr_, state_controller())
.WillOnce(ReturnRef(mock_state_controller_));
- EXPECT_CALL(mock_state_controller_,
- SetRegularState(app_, mobile_apis::HMILevel::HMI_NONE, false));
+ EXPECT_CALL(
+ mock_state_controller_,
+ SetRegularState(
+ app_, kDefaultWindowId, mobile_apis::HMILevel::HMI_NONE, false));
EXPECT_CALL(mock_message_helper_,
GetOnAppInterfaceUnregisteredNotificationToMobile(
kAppId_,
@@ -1377,10 +1396,11 @@ TEST_F(HMICommandsNotificationsTest,
[am::strings::id] = "2014";
std::shared_ptr<Command> command =
CreateCommand<OnDeviceChosenNotification>(message);
- EXPECT_CALL(app_mngr_,
- ConnectToDevice(
- (*message)[am::strings::msg_params][am::strings::device_info]
- [am::strings::id].asString()));
+ EXPECT_CALL(
+ app_mngr_,
+ ConnectToDevice((*message)[am::strings::msg_params]
+ [am::strings::device_info][am::strings::id]
+ .asString()));
command->Run();
}
@@ -1413,7 +1433,8 @@ TEST_F(HMICommandsNotificationsTest,
EXPECT_CALL(app_mngr_, active_application()).WillOnce(Return(app_));
EXPECT_CALL(app_mngr_, state_controller())
.WillOnce(ReturnRef(mock_state_controller_));
- EXPECT_CALL(mock_state_controller_, SetRegularState(app_, *it));
+ EXPECT_CALL(mock_state_controller_,
+ SetRegularState(app_, kDefaultWindowId, *it));
command->Run();
}
}
@@ -1462,7 +1483,8 @@ TEST_F(HMICommandsNotificationsTest,
EXPECT_CALL(app_mngr_, application(_)).WillOnce(Return(app_));
EXPECT_CALL(app_mngr_, state_controller())
.WillOnce(ReturnRef(mock_state_controller_));
- EXPECT_CALL(mock_state_controller_, SetRegularState(app_, *it));
+ EXPECT_CALL(mock_state_controller_,
+ SetRegularState(app_, kDefaultWindowId, *it));
command->Run();
}
}
@@ -1790,11 +1812,26 @@ TEST_F(HMICommandsNotificationsTest, OnDriverDistractionNotificationEmptyData) {
hmi_apis::Common_DriverDistractionState::DD_ON;
MessageSharedPtr message = CreateMessage();
(*message)[am::strings::msg_params][am::hmi_notification::state] = state;
+ (*message)[am::strings::params][am::strings::connection_key] = kConnectionKey;
std::shared_ptr<Command> command =
CreateCommand<hmi::OnDriverDistractionNotification>(message);
EXPECT_CALL(app_mngr_, set_driver_distraction_state(state));
- EXPECT_CALL(app_mngr_, applications()).WillOnce(Return(applications_));
+
+ ON_CALL(app_mngr_, GetPolicyHandler())
+ .WillByDefault(ReturnRef(mock_policy_handler_));
+ typedef boost::optional<bool> OptionalBool;
+
+ ON_CALL(mock_policy_handler_, LockScreenDismissalEnabledState())
+ .WillByDefault(Return(OptionalBool(true)));
+ std::string required_language = "en-us";
+ ON_CALL(mock_policy_handler_,
+ LockScreenDismissalWarningMessage(required_language))
+ .WillByDefault(Return(
+ boost::optional<std::string>(kLockScreenDismissalWarningMessage_en)));
+
+ ON_CALL(app_mngr_, applications()).WillByDefault(Return(applications_));
+
EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _)).Times(0);
EXPECT_CALL(*app_ptr_, app_id()).Times(0);
command->Run();
@@ -1802,16 +1839,28 @@ TEST_F(HMICommandsNotificationsTest, OnDriverDistractionNotificationEmptyData) {
TEST_F(HMICommandsNotificationsTest,
OnDriverDistractionNotificationInvalidApp) {
- const hmi_apis::Common_DriverDistractionState::eType state =
- hmi_apis::Common_DriverDistractionState::DD_ON;
+ const auto state = hmi_apis::Common_DriverDistractionState::DD_ON;
MessageSharedPtr message = CreateMessage();
(*message)[am::strings::msg_params][am::hmi_notification::state] = state;
+ (*message)[am::strings::params][am::strings::connection_key] = kConnectionKey;
std::shared_ptr<Command> command =
CreateCommand<hmi::OnDriverDistractionNotification>(message);
ApplicationSharedPtr invalid_app;
application_set_.insert(invalid_app);
- EXPECT_CALL(app_mngr_, applications()).WillOnce(Return(applications_));
+
+ ON_CALL(app_mngr_, GetPolicyHandler())
+ .WillByDefault(ReturnRef(mock_policy_handler_));
+ typedef boost::optional<bool> OptionalBool;
+ ON_CALL(mock_policy_handler_, LockScreenDismissalEnabledState())
+ .WillByDefault(Return(OptionalBool(true)));
+ std::string required_language = "en-us";
+ ON_CALL(mock_policy_handler_,
+ LockScreenDismissalWarningMessage(required_language))
+ .WillByDefault(Return(
+ boost::optional<std::string>(kLockScreenDismissalWarningMessage_en)));
+ ON_CALL(app_mngr_, applications()).WillByDefault(Return(applications_));
+
EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _)).Times(0);
EXPECT_CALL(*app_ptr_, app_id()).Times(0);
command->Run();
@@ -1822,21 +1871,33 @@ TEST_F(HMICommandsNotificationsTest, OnDriverDistractionNotificationValidApp) {
hmi_apis::Common_DriverDistractionState::DD_ON;
MessageSharedPtr message = CreateMessage();
(*message)[am::strings::msg_params][am::mobile_notification::state] = state;
+ (*message)[am::strings::params][am::strings::connection_key] = kConnectionKey;
std::shared_ptr<Command> command =
CreateCommand<hmi::OnDriverDistractionNotification>(message);
application_set_.insert(app_);
- EXPECT_CALL(app_mngr_, applications()).WillOnce(Return(applications_));
+
+ ON_CALL(app_mngr_, GetPolicyHandler())
+ .WillByDefault(ReturnRef(mock_policy_handler_));
+ typedef boost::optional<bool> OptionalBool;
+ ON_CALL(mock_policy_handler_, LockScreenDismissalEnabledState())
+ .WillByDefault(Return(OptionalBool(true)));
+ std::string required_language = "en-us";
+ ON_CALL(mock_policy_handler_,
+ LockScreenDismissalWarningMessage(required_language))
+ .WillByDefault(Return(
+ boost::optional<std::string>(kLockScreenDismissalWarningMessage_en)));
+ ON_CALL(app_mngr_, applications()).WillByDefault(Return(applications_));
+
policy::CheckPermissionResult result;
result.hmi_level_permitted = policy::kRpcAllowed;
- EXPECT_CALL(app_mngr_, GetPolicyHandler())
- .WillOnce(ReturnRef(mock_policy_handler_));
- EXPECT_CALL(mock_policy_handler_, CheckPermissions(_, _, _, _))
- .WillOnce(GetArg3(&result));
+ EXPECT_CALL(mock_policy_handler_, CheckPermissions(_, _, _, _, _))
+ .WillOnce(GetArg4(&result));
+
EXPECT_CALL(mock_rpc_service_,
ManageMobileCommand(_, Command::CommandSource::SOURCE_SDL))
.WillOnce(GetMessage(message));
- EXPECT_CALL(*app_ptr_, app_id()).WillRepeatedly(Return(kAppId_));
+ ON_CALL(*app_ptr_, app_id()).WillByDefault(Return(kAppId_));
command->Run();
EXPECT_EQ(
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/mixing_audio_supported_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/mixing_audio_supported_request_test.cc
index 8164f957cb..64bf167f83 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/mixing_audio_supported_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/mixing_audio_supported_request_test.cc
@@ -33,13 +33,13 @@
#include <stdint.h>
#include <string>
-#include "gtest/gtest.h"
-#include "smart_objects/smart_object.h"
-#include "application_manager/smart_object_keys.h"
-#include "application_manager/commands/commands_test.h"
#include "application_manager/commands/command_request_test.h"
+#include "application_manager/commands/commands_test.h"
#include "application_manager/commands/request_to_hmi.h"
+#include "application_manager/smart_object_keys.h"
+#include "gtest/gtest.h"
#include "hmi/mixing_audio_supported_request.h"
+#include "smart_objects/smart_object.h"
namespace test {
namespace components {
@@ -51,9 +51,9 @@ using ::testing::_;
using ::testing::Return;
namespace am = ::application_manager;
namespace strings = ::application_manager::strings;
+using am::commands::CommandImpl;
using am::commands::RequestToHMI;
using sdl_rpc_plugin::commands::MixingAudioSupportedRequest;
-using am::commands::CommandImpl;
typedef std::shared_ptr<RequestToHMI> RequestToHMIPtr;
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/mixing_audio_supported_response_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/mixing_audio_supported_response_test.cc
index aa651c2dca..8c2f07a1d6 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/mixing_audio_supported_response_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/mixing_audio_supported_response_test.cc
@@ -33,18 +33,18 @@
#include <stdint.h>
#include <string>
-#include "gtest/gtest.h"
-#include "smart_objects/smart_object.h"
-#include "application_manager/smart_object_keys.h"
#include "application_manager/commands/command.h"
-#include "application_manager/commands/commands_test.h"
#include "application_manager/commands/command_request_test.h"
+#include "application_manager/commands/commands_test.h"
#include "application_manager/commands/response_from_hmi.h"
-#include "interfaces/HMI_API.h"
-#include "interfaces/MOBILE_API.h"
#include "application_manager/mock_application.h"
#include "application_manager/mock_hmi_capabilities.h"
+#include "application_manager/smart_object_keys.h"
+#include "gtest/gtest.h"
+#include "interfaces/HMI_API.h"
+#include "interfaces/MOBILE_API.h"
#include "sdl_rpc_plugin/commands/hmi/mixing_audio_supported_response.h"
+#include "smart_objects/smart_object.h"
namespace test {
namespace components {
@@ -52,15 +52,15 @@ namespace commands_test {
namespace hmi_commands_test {
namespace mixing_audio_supported_response {
+using ::testing::NiceMock;
using ::testing::Return;
using ::testing::ReturnRef;
-using ::testing::NiceMock;
namespace am = ::application_manager;
namespace strings = ::application_manager::strings;
-using sdl_rpc_plugin::commands::MixingAudioSupportedResponse;
-using application_manager::commands::ResponseFromHMI;
-using am::commands::CommandImpl;
using am::HMICapabilities;
+using am::commands::CommandImpl;
+using application_manager::commands::ResponseFromHMI;
+using sdl_rpc_plugin::commands::MixingAudioSupportedResponse;
namespace hmi_response = ::application_manager::hmi_response;
typedef std::shared_ptr<ResponseFromHMI> ResponseFromHMIPtr;
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/navi_audio_start_stream_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/navi_audio_start_stream_request_test.cc
index d8454bb98e..926e51446f 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/navi_audio_start_stream_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/navi_audio_start_stream_request_test.cc
@@ -36,13 +36,13 @@
#include "gtest/gtest.h"
-#include "smart_objects/smart_object.h"
-#include "application_manager/smart_object_keys.h"
#include "application_manager/commands/command_request_test.h"
-#include "application_manager/mock_application_manager.h"
+#include "application_manager/commands/commands_test.h"
#include "application_manager/hmi_interfaces.h"
+#include "application_manager/mock_application_manager.h"
#include "application_manager/mock_hmi_interface.h"
-#include "application_manager/commands/commands_test.h"
+#include "application_manager/smart_object_keys.h"
+#include "smart_objects/smart_object.h"
namespace test {
namespace components {
@@ -54,9 +54,9 @@ using ::testing::_;
using ::testing::ReturnRef;
namespace am = ::application_manager;
namespace commands = am::commands;
+using am::event_engine::Event;
using commands::MessageSharedPtr;
using sdl_rpc_plugin::commands::AudioStartStreamRequest;
-using am::event_engine::Event;
namespace {
const uint32_t kHmiAppId = 13u;
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/navi_is_ready_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/navi_is_ready_request_test.cc
index 1a03ecf523..5e13755a32 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/navi_is_ready_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/navi_is_ready_request_test.cc
@@ -34,15 +34,15 @@
#include "gtest/gtest.h"
-#include "smart_objects/smart_object.h"
-#include "application_manager/smart_object_keys.h"
#include "application_manager/commands/command_request_test.h"
-#include "application_manager/mock_application_manager.h"
-#include "application_manager/hmi_interfaces.h"
+#include "application_manager/commands/commands_test.h"
#include "application_manager/event_engine/event.h"
-#include "application_manager/mock_hmi_interface.h"
+#include "application_manager/hmi_interfaces.h"
+#include "application_manager/mock_application_manager.h"
#include "application_manager/mock_hmi_capabilities.h"
-#include "application_manager/commands/commands_test.h"
+#include "application_manager/mock_hmi_interface.h"
+#include "application_manager/smart_object_keys.h"
+#include "smart_objects/smart_object.h"
namespace test {
namespace components {
@@ -54,8 +54,8 @@ using ::testing::_;
using ::testing::ReturnRef;
namespace am = ::application_manager;
using am::commands::MessageSharedPtr;
-using sdl_rpc_plugin::commands::NaviIsReadyRequest;
using am::event_engine::Event;
+using sdl_rpc_plugin::commands::NaviIsReadyRequest;
namespace {
const hmi_apis::FunctionID::eType kEventID =
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/navi_is_ready_response_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/navi_is_ready_response_test.cc
index 23f01fac3f..e166928348 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/navi_is_ready_response_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/navi_is_ready_response_test.cc
@@ -33,12 +33,12 @@
#include <stdint.h>
#include <string>
-#include "gtest/gtest.h"
-#include "application_manager/commands/commands_test.h"
#include "application_manager/commands/command_request_test.h"
-#include "application_manager/mock_hmi_capabilities.h"
+#include "application_manager/commands/commands_test.h"
#include "application_manager/mock_application_manager.h"
#include "application_manager/mock_event_dispatcher.h"
+#include "application_manager/mock_hmi_capabilities.h"
+#include "gtest/gtest.h"
#include "hmi/navi_is_ready_response.h"
namespace test {
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/navi_set_video_config_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/navi_set_video_config_request_test.cc
index 3110a11fd8..d6ef540bc0 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/navi_set_video_config_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/navi_set_video_config_request_test.cc
@@ -36,14 +36,14 @@
#include "gtest/gtest.h"
-#include "smart_objects/smart_object.h"
-#include "application_manager/smart_object_keys.h"
#include "application_manager/commands/command_request_test.h"
-#include "application_manager/mock_application_manager.h"
-#include "application_manager/hmi_interfaces.h"
-#include "application_manager/mock_hmi_interface.h"
#include "application_manager/event_engine/event.h"
+#include "application_manager/hmi_interfaces.h"
+#include "application_manager/mock_application_manager.h"
#include "application_manager/mock_event_dispatcher.h"
+#include "application_manager/mock_hmi_interface.h"
+#include "application_manager/smart_object_keys.h"
+#include "smart_objects/smart_object.h"
namespace test {
namespace components {
@@ -55,8 +55,8 @@ using ::testing::_;
using ::testing::ReturnRef;
namespace am = ::application_manager;
using am::commands::MessageSharedPtr;
-using sdl_rpc_plugin::commands::NaviSetVideoConfigRequest;
using am::event_engine::Event;
+using sdl_rpc_plugin::commands::NaviSetVideoConfigRequest;
namespace {
const uint32_t kAppId = 1u;
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/navi_set_video_config_response_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/navi_set_video_config_response_test.cc
index 06fa61db29..c4e7976bde 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/navi_set_video_config_response_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/navi_set_video_config_response_test.cc
@@ -30,13 +30,13 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include "gtest/gtest.h"
-#include "application_manager/commands/commands_test.h"
#include "hmi/navi_set_video_config_response.h"
+#include "application_manager/commands/commands_test.h"
#include "application_manager/mock_application_manager.h"
#include "application_manager/mock_event_dispatcher.h"
#include "application_manager/mock_hmi_capabilities.h"
#include "application_manager/smart_object_keys.h"
+#include "gtest/gtest.h"
namespace test {
namespace components {
@@ -47,8 +47,8 @@ namespace navi_set_video_config_response {
using sdl_rpc_plugin::commands::NaviSetVideoConfigResponse;
using test::components::event_engine_test::MockEventDispatcher;
using testing::_;
-using testing::ReturnRef;
using ::testing::NiceMock;
+using testing::ReturnRef;
typedef NiceMock<
::test::components::application_manager_test::MockHMICapabilities>
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/navi_start_stream_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/navi_start_stream_request_test.cc
index a7f50504fb..232d5ab628 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/navi_start_stream_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/navi_start_stream_request_test.cc
@@ -36,12 +36,12 @@
#include "gtest/gtest.h"
-#include "smart_objects/smart_object.h"
-#include "application_manager/smart_object_keys.h"
#include "application_manager/commands/command_request_test.h"
-#include "application_manager/mock_application_manager.h"
#include "application_manager/hmi_interfaces.h"
+#include "application_manager/mock_application_manager.h"
#include "application_manager/mock_hmi_interface.h"
+#include "application_manager/smart_object_keys.h"
+#include "smart_objects/smart_object.h"
namespace test {
namespace components {
@@ -53,9 +53,9 @@ using ::testing::_;
using ::testing::ReturnRef;
namespace am = ::application_manager;
namespace commands = am::commands;
+using am::event_engine::Event;
using commands::MessageSharedPtr;
using sdl_rpc_plugin::commands::NaviStartStreamRequest;
-using am::event_engine::Event;
namespace {
const uint32_t kHmiAppId = 13u;
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/navi_stop_stream_requests_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/navi_stop_stream_requests_test.cc
index e4a79997fd..b32189ce1a 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/navi_stop_stream_requests_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/navi_stop_stream_requests_test.cc
@@ -30,17 +30,17 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include "hmi/navi_stop_stream_request.h"
#include "hmi/navi_audio_stop_stream_request.h"
+#include "hmi/navi_stop_stream_request.h"
#include "gtest/gtest.h"
-#include "smart_objects/smart_object.h"
-#include "application_manager/smart_object_keys.h"
#include "application_manager/commands/command_request_test.h"
-#include "application_manager/mock_application_manager.h"
#include "application_manager/hmi_interfaces.h"
+#include "application_manager/mock_application_manager.h"
#include "application_manager/mock_hmi_interface.h"
+#include "application_manager/smart_object_keys.h"
+#include "smart_objects/smart_object.h"
namespace test {
namespace components {
@@ -76,7 +76,8 @@ class NaviStopStreamRequestsTest
};
typedef testing::Types<commands::AudioStopStreamRequest,
- commands::NaviStopStreamRequest> RequestCommandsList;
+ commands::NaviStopStreamRequest>
+ RequestCommandsList;
TYPED_TEST_CASE(NaviStopStreamRequestsTest, RequestCommandsList);
TYPED_TEST(NaviStopStreamRequestsTest, Run_HmiInterfaceNotAvailable_NoRequest) {
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/on_bc_system_capability_updated_notification_from_hmi_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/on_bc_system_capability_updated_notification_from_hmi_test.cc
new file mode 100644
index 0000000000..f3ed480180
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/on_bc_system_capability_updated_notification_from_hmi_test.cc
@@ -0,0 +1,159 @@
+/*
+ * Copyright (c) 2019, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "hmi/on_bc_system_capability_updated_notification_from_hmi.h"
+
+#include "application_manager/commands/commands_test.h"
+#include "gtest/gtest.h"
+
+namespace test {
+namespace components {
+namespace commands_test {
+namespace hmi_commands_test {
+namespace on_bc_system_capability_updated_notification_from_hmi {
+
+using sdl_rpc_plugin::commands::OnBCSystemCapabilityUpdatedNotificationFromHMI;
+using ::testing::_;
+using ::testing::Return;
+
+typedef std::shared_ptr<OnBCSystemCapabilityUpdatedNotificationFromHMI>
+ OnBCSystemCapabilityUpdatedNotificationFromHMIPtr;
+
+namespace strings = application_manager::strings;
+namespace {
+const uint32_t kAppId = 1u;
+} // namespace
+
+MATCHER(CheckMessageToMobile, "") {
+ const auto function_id = mobile_apis::FunctionID::OnSystemCapabilityUpdatedID;
+
+ const bool is_function_id_matched =
+ function_id == static_cast<am::mobile_api::FunctionID::eType>(
+ (*arg)[strings::params][strings::function_id].asInt());
+ const bool app_id_exist =
+ (*arg)[strings::msg_params].keyExists(strings::app_id);
+ bool is_connection_key_correct = true;
+ if ((*arg)[strings::msg_params].keyExists(strings::connection_key)) {
+ is_connection_key_correct =
+ (*arg)[strings::params][strings::connection_key] == kAppId;
+ }
+ return is_function_id_matched && !app_id_exist && is_connection_key_correct;
+}
+
+MATCHER_P(CheckDisplayCapabilitiesNotChanged, display_capability, "") {
+ return display_capability == arg;
+}
+
+class OnBCSystemCapabilityUpdatedNotificationFromHMITest
+ : public CommandsTest<CommandsTestMocks::kIsNice> {
+ protected:
+ OnBCSystemCapabilityUpdatedNotificationFromHMITest()
+ : message_(CreateMessage())
+ , display_capability_(
+ (*message_)[am::strings::msg_params][strings::system_capability]
+ [strings::display_capabilities]) {
+ command_ =
+ CreateCommand<OnBCSystemCapabilityUpdatedNotificationFromHMI>(message_);
+ mock_app_ = CreateMockApp();
+ }
+
+ OnBCSystemCapabilityUpdatedNotificationFromHMIPtr command_;
+ MockAppPtr mock_app_;
+ MessageSharedPtr message_;
+ const SmartObject display_capability_;
+};
+
+TEST_F(
+ OnBCSystemCapabilityUpdatedNotificationFromHMITest,
+ Run_AppIdNotPresentedInMessage_SetSystemDisplayCapabilitiesToHMICapabilities_SendMessageToMobile) {
+ (*message_)[am::strings::msg_params][strings::system_capability]
+ [am::strings::system_capability_type] =
+ mobile_apis::SystemCapabilityType::DISPLAYS;
+
+ EXPECT_CALL(mock_hmi_capabilities_,
+ set_system_display_capabilities(
+ CheckDisplayCapabilitiesNotChanged(display_capability_)));
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageMobileCommand(
+ CheckMessageToMobile(),
+ ::application_manager::commands::Command::CommandSource::SOURCE_SDL))
+ .WillOnce(Return(true));
+
+ ASSERT_TRUE(command_->Init());
+ command_->Run();
+}
+
+TEST_F(OnBCSystemCapabilityUpdatedNotificationFromHMITest,
+ Run_AppNotRegisteredWithPresentedAppIdInMessage_MessageNotSendToMobile) {
+ (*message_)[am::strings::msg_params][strings::system_capability]
+ [am::strings::system_capability_type] =
+ mobile_apis::SystemCapabilityType::DISPLAYS;
+ (*message_)[strings::msg_params][strings::app_id] = kAppId;
+ ApplicationSharedPtr app; // Empty application shared pointer
+
+ ON_CALL(app_mngr_, application(kAppId)).WillByDefault(Return(app));
+ EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _)).Times(0);
+
+ ASSERT_TRUE(command_->Init());
+ command_->Run();
+}
+
+TEST_F(
+ OnBCSystemCapabilityUpdatedNotificationFromHMITest,
+ Run_AppRegisteredWithPresentedAppIdInMessage_SetDisplayCapabilitiesToApp_SendMessageToMobile) {
+ (*message_)[am::strings::msg_params][strings::system_capability]
+ [am::strings::system_capability_type] =
+ mobile_apis::SystemCapabilityType::DISPLAYS;
+ (*message_)[strings::msg_params][strings::app_id] = kAppId;
+
+ ON_CALL(app_mngr_, application(kAppId)).WillByDefault(Return(mock_app_));
+
+ EXPECT_CALL(*mock_app_,
+ set_display_capabilities(
+ CheckDisplayCapabilitiesNotChanged(display_capability_)));
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageMobileCommand(
+ CheckMessageToMobile(),
+ ::application_manager::commands::Command::CommandSource::SOURCE_SDL))
+ .WillOnce(Return(true));
+
+ ASSERT_TRUE(command_->Init());
+ command_->Run();
+}
+
+} // namespace on_bc_system_capability_updated_notification_from_hmi
+} // namespace hmi_commands_test
+} // namespace commands_test
+} // namespace components
+} // namespace test
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/on_bc_system_capability_updated_notification_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/on_bc_system_capability_updated_notification_test.cc
new file mode 100644
index 0000000000..cb8894749f
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/on_bc_system_capability_updated_notification_test.cc
@@ -0,0 +1,118 @@
+/*
+ * Copyright (c) 2019, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "hmi/on_bc_system_capability_updated_notification.h"
+
+#include "application_manager/commands/commands_test.h"
+#include "gtest/gtest.h"
+
+namespace test {
+namespace components {
+namespace commands_test {
+namespace hmi_commands_test {
+namespace on_bc_system_capability_updated_notification {
+
+using sdl_rpc_plugin::commands::OnBCSystemCapabilityUpdatedNotification;
+using ::testing::_;
+using ::testing::Return;
+
+typedef std::shared_ptr<OnBCSystemCapabilityUpdatedNotification>
+ OnBCSystemCapabilityUpdatedNotificationPtr;
+
+namespace strings = application_manager::strings;
+namespace {
+const uint32_t kConnectionKey = 1u;
+}
+
+MATCHER_P(CheckDisplayCapabilities, display_capabilities, "") {
+ return display_capabilities ==
+ (*arg)[strings::msg_params][strings::system_capability]
+ [strings::display_capabilities];
+}
+
+class OnBCSystemCapabilityUpdatedNotificationTest
+ : public CommandsTest<CommandsTestMocks::kIsNice> {
+ protected:
+ void SetUp() OVERRIDE {
+ message_ = CreateMessage();
+ (*message_)[strings::params][strings::connection_key] = kConnectionKey;
+
+ command_ = CreateCommand<OnBCSystemCapabilityUpdatedNotification>(message_);
+ mock_app_ = CreateMockApp();
+ }
+
+ OnBCSystemCapabilityUpdatedNotificationPtr command_;
+ MockAppPtr mock_app_;
+ MessageSharedPtr message_;
+};
+
+TEST_F(OnBCSystemCapabilityUpdatedNotificationTest,
+ SystemDisplayCapabilities_SUCCESS) {
+ (*message_)[am::strings::msg_params][strings::system_capability]
+ [am::strings::system_capability_type] =
+ mobile_apis::SystemCapabilityType::DISPLAYS;
+
+ smart_objects::SmartObjectSPtr system_display_capabilities =
+ std::make_shared<smart_objects::SmartObject>(
+ smart_objects::SmartType_Null);
+
+ EXPECT_CALL(mock_hmi_capabilities_, system_display_capabilities())
+ .Times(2)
+ .WillRepeatedly(Return(system_display_capabilities));
+
+ EXPECT_CALL(
+ mock_rpc_service_,
+ SendMessageToHMI(CheckDisplayCapabilities(*system_display_capabilities)));
+
+ ASSERT_TRUE(command_->Init());
+ command_->Run();
+}
+
+TEST_F(OnBCSystemCapabilityUpdatedNotificationTest,
+ SystemDisplayCapabilities_DATA_NOT_AVAILABLE) {
+ (*message_)[am::strings::msg_params][strings::system_capability]
+ [am::strings::system_capability_type] =
+ mobile_apis::SystemCapabilityType::DISPLAYS;
+ EXPECT_CALL(mock_hmi_capabilities_, system_display_capabilities())
+ .WillOnce(Return(nullptr));
+
+ EXPECT_CALL(mock_rpc_service_, SendMessageToHMI(_)).Times(0);
+
+ ASSERT_TRUE(command_->Init());
+ command_->Run();
+}
+
+} // namespace on_bc_system_capability_updated_notification
+} // namespace hmi_commands_test
+} // namespace commands_test
+} // namespace components
+} // namespace test
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/on_driver_distraction_notification_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/on_driver_distraction_notification_test.cc
index fc3899e861..fe6ba7c4e3 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/on_driver_distraction_notification_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/on_driver_distraction_notification_test.cc
@@ -33,17 +33,17 @@
#include <stdint.h>
#include <string>
-#include "gtest/gtest.h"
-#include "smart_objects/smart_object.h"
-#include "application_manager/smart_object_keys.h"
-#include "utils/lock.h"
-#include "utils/data_accessor.h"
#include "application_manager/commands/commands_test.h"
#include "application_manager/mock_application.h"
#include "application_manager/mock_application_manager.h"
#include "application_manager/policies/mock_policy_handler_interface.h"
+#include "application_manager/smart_object_keys.h"
+#include "gtest/gtest.h"
#include "hmi/on_driver_distraction_notification.h"
#include "interfaces/MOBILE_API.h"
+#include "smart_objects/smart_object.h"
+#include "utils/data_accessor.h"
+#include "utils/lock.h"
namespace test {
namespace components {
@@ -52,22 +52,65 @@ namespace hmi_commands_test {
namespace on_driver_distraction_notification {
using ::testing::_;
-using ::testing::Return;
+using ::testing::DoAll;
using ::testing::Eq;
+using ::testing::NiceMock;
+using ::testing::Return;
+using ::testing::SaveArg;
+using ::testing::SetArgumentPointee;
+
namespace am = ::application_manager;
using am::commands::MessageSharedPtr;
using sdl_rpc_plugin::commands::hmi::OnDriverDistractionNotification;
using namespace am::commands;
+using test::components::commands_test::MobileResultCodeIs;
+
+namespace {
+const std::string kDefaultLanguage = "en-us";
+const mobile_apis::Language::eType kMobileLanguage =
+ mobile_apis::Language::EN_US;
-typedef std::shared_ptr<OnDriverDistractionNotification> NotificationPtr;
+// LSDW - lock screen dismissal warning
+const std::string kLockScreenDismissalWarningMessage_en =
+ "Swipe down to dismiss, acknowledging that you are not the driver";
+const uint32_t kConnectionKey = 2u;
+} // namespace
class HMIOnDriverDistractionNotificationTest
: public CommandsTest<CommandsTestMocks::kIsNice> {
public:
HMIOnDriverDistractionNotificationTest()
- : app_set_lock_(std::make_shared<sync_primitives::Lock>()) {}
+ : mock_app_(CreateMockApp())
+ , app_set_lock_(std::make_shared<sync_primitives::Lock>())
+ , accessor(app_set_, app_set_lock_) {
+ app_set_.insert(mock_app_);
+ InitMocksRelations();
+ }
+
+ typedef std::shared_ptr<OnDriverDistractionNotification> NotificationPtr;
+ typedef boost::optional<bool> OptionalBool;
+
+ void SetUp() OVERRIDE {
+ ON_CALL(*mock_app_, ui_language())
+ .WillByDefault(ReturnRef(kMobileLanguage));
+ ON_CALL(app_mngr_, application(kConnectionKey))
+ .WillByDefault(Return(mock_app_));
+ ON_CALL(mock_message_helper_, MobileLanguageToString(kMobileLanguage))
+ .WillByDefault(Return(kDefaultLanguage));
+ }
+
+ MockAppPtr mock_app_;
std::shared_ptr<sync_primitives::Lock> app_set_lock_;
- policy_test::MockPolicyHandlerInterface mock_policy_handler_interface_;
+ am::ApplicationSet app_set_;
+ DataAccessor<am::ApplicationSet> accessor;
+ NiceMock<policy_test::MockPolicyHandlerInterface>
+ mock_policy_handler_interface_;
+
+ void InitMocksRelations() {
+ ON_CALL(app_mngr_, applications()).WillByDefault(Return(accessor));
+ ON_CALL(app_mngr_, GetPolicyHandler())
+ .WillByDefault(ReturnRef(mock_policy_handler_interface_));
+ }
};
MATCHER_P2(CheckNotificationParams, function_id, state, "") {
@@ -83,76 +126,238 @@ MATCHER_P2(CheckNotificationParams, function_id, state, "") {
return is_function_id_matched && is_state_matched;
}
-ACTION_P(GetArg3, result) {
- arg3 = *result;
+ACTION_P(GetArg4, result) {
+ arg4 = *result;
}
-TEST_F(HMIOnDriverDistractionNotificationTest, Run_PushMobileMessage_SUCCESS) {
- const hmi_apis::Common_DriverDistractionState::eType state =
- hmi_apis::Common_DriverDistractionState::DD_ON;
+ACTION_P(SetMessage, lockScreenDismissalWarning) {
+ smart_objects::SmartObject& notification = arg0;
+
+ notification[application_manager::strings::msg_params]
+ [application_manager::mobile_notification::
+ lock_screen_dismissal_warning] = lockScreenDismissalWarning;
+}
+
+TEST_F(HMIOnDriverDistractionNotificationTest,
+ Run_SendNotificationToMobile_SUCCESS) {
+ const auto state = hmi_apis::Common_DriverDistractionState::DD_ON;
MessageSharedPtr commands_msg(CreateMessage(smart_objects::SmartType_Map));
(*commands_msg)[am::strings::msg_params][am::hmi_notification::state] = state;
+ (*commands_msg)[am::strings::params][am::strings::connection_key] =
+ kConnectionKey;
NotificationPtr command(
CreateCommand<OnDriverDistractionNotification>(commands_msg));
EXPECT_CALL(app_mngr_, set_driver_distraction_state(Eq(state)));
- MockAppPtr mock_app = CreateMockApp();
- am::ApplicationSet app_set;
- app_set.insert(mock_app);
+ ON_CALL(mock_policy_handler_interface_, LockScreenDismissalEnabledState())
+ .WillByDefault(Return(OptionalBool(true)));
+
+ ON_CALL(mock_policy_handler_interface_, LockScreenDismissalWarningMessage(_))
+ .WillByDefault(Return(kLockScreenDismissalWarningMessage_en));
+
+ policy::CheckPermissionResult result;
+ result.hmi_level_permitted = policy::kRpcAllowed;
+ EXPECT_CALL(mock_policy_handler_interface_, CheckPermissions(_, _, _, _, _))
+ .WillOnce(GetArg4(&result));
+
+ MessageSharedPtr message_to_mobile(
+ CreateMessage(smart_objects::SmartType_Map));
+ EXPECT_CALL(mock_rpc_service_,
+ ManageMobileCommand(
+ CheckNotificationParams(
+ am::mobile_api::FunctionID::OnDriverDistractionID, state),
+ Command::CommandSource::SOURCE_SDL))
+ .WillOnce(DoAll(SaveArg<0>(&message_to_mobile), Return(true)));
+ command->Run();
+
+ ASSERT_TRUE((*message_to_mobile)[am::strings::msg_params].keyExists(
+ am::mobile_notification::lock_screen_dismissal_warning));
+
+ auto LSDW_message =
+ (*message_to_mobile)
+ [am::strings::msg_params]
+ [am::mobile_notification::lock_screen_dismissal_warning]
+ .asString();
+
+ EXPECT_EQ(kLockScreenDismissalWarningMessage_en, LSDW_message);
+}
+
+TEST_F(HMIOnDriverDistractionNotificationTest,
+ Run_PushMobileMessage_If_DisallowedByPolicy) {
+ const auto state = hmi_apis::Common_DriverDistractionState::DD_ON;
+ MessageSharedPtr commands_msg(CreateMessage(smart_objects::SmartType_Map));
+ (*commands_msg)[am::strings::msg_params][am::hmi_notification::state] = state;
+ (*commands_msg)[am::strings::params][am::strings::connection_key] =
+ kConnectionKey;
+ NotificationPtr command(
+ CreateCommand<OnDriverDistractionNotification>(commands_msg));
+
+ ON_CALL(mock_policy_handler_interface_, LockScreenDismissalEnabledState())
+ .WillByDefault(Return(boost::optional<bool>(true)));
+
+ ON_CALL(mock_policy_handler_interface_, LockScreenDismissalWarningMessage(_))
+ .WillByDefault(Return(kLockScreenDismissalWarningMessage_en));
- DataAccessor<am::ApplicationSet> accessor(app_set, app_set_lock_);
- EXPECT_CALL(app_mngr_, applications()).WillOnce(Return(accessor));
policy::CheckPermissionResult result;
result.hmi_level_permitted = policy::kRpcDisallowed;
- EXPECT_CALL(app_mngr_, GetPolicyHandler())
- .WillOnce(ReturnRef(mock_policy_handler_interface_));
- EXPECT_CALL(mock_policy_handler_interface_, CheckPermissions(_, _, _, _))
- .WillOnce(GetArg3(&result));
+ EXPECT_CALL(app_mngr_, GetPolicyHandler()).Times(3);
+ EXPECT_CALL(mock_policy_handler_interface_, CheckPermissions(_, _, _, _, _))
+ .WillOnce(GetArg4(&result));
- EXPECT_CALL(*mock_app,
+ MessageSharedPtr pushed_message(CreateMessage(smart_objects::SmartType_Map));
+ EXPECT_CALL(*mock_app_,
PushMobileMessage(CheckNotificationParams(
- am::mobile_api::FunctionID::OnDriverDistractionID, state)));
+ am::mobile_api::FunctionID::OnDriverDistractionID, state)))
+ .WillOnce(SaveArg<0>(&pushed_message));
+ EXPECT_CALL(app_mngr_, set_driver_distraction_state(Eq(state)));
command->Run();
+
+ ASSERT_TRUE((*pushed_message)[am::strings::msg_params].keyExists(
+ am::mobile_notification::lock_screen_dismissal_warning));
+
+ auto lock_screen_dismissal_warning_message =
+ (*pushed_message)[am::strings::msg_params]
+ [am::mobile_notification::lock_screen_dismissal_warning]
+ .asString();
+
+ EXPECT_EQ(kLockScreenDismissalWarningMessage_en,
+ lock_screen_dismissal_warning_message);
}
TEST_F(HMIOnDriverDistractionNotificationTest,
- Run_SendNotificationToMobile_SUCCESS) {
- const hmi_apis::Common_DriverDistractionState::eType state =
- hmi_apis::Common_DriverDistractionState::DD_ON;
+ Run_SendNotificationIfLockScreenDismissalMissed) {
+ const auto state = hmi_apis::Common_DriverDistractionState::DD_ON;
MessageSharedPtr commands_msg(CreateMessage(smart_objects::SmartType_Map));
(*commands_msg)[am::strings::msg_params][am::hmi_notification::state] = state;
NotificationPtr command(
CreateCommand<OnDriverDistractionNotification>(commands_msg));
+ ON_CALL(mock_policy_handler_interface_, LockScreenDismissalEnabledState())
+ .WillByDefault(Return(boost::optional<bool>()));
+
+ policy::CheckPermissionResult result;
+ result.hmi_level_permitted = policy::kRpcAllowed;
+ ON_CALL(mock_policy_handler_interface_, CheckPermissions(_, _, _, _, _))
+ .WillByDefault(GetArg4(&result));
+
+ MessageSharedPtr command_result;
+ EXPECT_CALL(mock_rpc_service_,
+ ManageMobileCommand(_, Command::CommandSource::SOURCE_SDL))
+ .WillOnce(DoAll(SaveArg<0>(&command_result), Return(true)));
+
+ command->Run();
+
+ auto& msg_params =
+ (*command_result)[application_manager::strings::msg_params];
+ EXPECT_FALSE(msg_params.keyExists(
+ application_manager::mobile_notification::lock_screen_dismissal_enabled));
+ EXPECT_FALSE(msg_params.keyExists(
+ application_manager::mobile_notification::lock_screen_dismissal_warning));
+}
+
+// LSDW - lock screen dimissal
+TEST_F(HMIOnDriverDistractionNotificationTest,
+ Run_SendNotificationToMobile_LSDWMessageIsAbsent_SUCCESS) {
+ const auto state = hmi_apis::Common_DriverDistractionState::DD_ON;
+ MessageSharedPtr commands_msg(CreateMessage(smart_objects::SmartType_Map));
+ (*commands_msg)[am::strings::msg_params][am::hmi_notification::state] = state;
+ (*commands_msg)[am::strings::params][am::strings::connection_key] =
+ kConnectionKey;
+
+ NotificationPtr command(
+ CreateCommand<OnDriverDistractionNotification>(commands_msg));
+
EXPECT_CALL(app_mngr_, set_driver_distraction_state(Eq(state)));
- MockAppPtr mock_app = CreateMockApp();
- am::ApplicationSet app_set;
- app_set.insert(mock_app);
+ ON_CALL(mock_policy_handler_interface_, LockScreenDismissalEnabledState())
+ .WillByDefault(Return(OptionalBool(false)));
- DataAccessor<am::ApplicationSet> accessor(app_set, app_set_lock_);
- EXPECT_CALL(app_mngr_, applications()).WillOnce(Return(accessor));
+ // LockScreenDismissalWarning won't be added to message if value of
+ // LockScreenDismissalEnabledState is false
+ std::string required_language = "en-us";
+ EXPECT_CALL(mock_policy_handler_interface_,
+ LockScreenDismissalWarningMessage(required_language))
+ .Times(0);
policy::CheckPermissionResult result;
result.hmi_level_permitted = policy::kRpcAllowed;
- EXPECT_CALL(app_mngr_, GetPolicyHandler())
- .WillOnce(ReturnRef(mock_policy_handler_interface_));
- EXPECT_CALL(mock_policy_handler_interface_, CheckPermissions(_, _, _, _))
- .WillOnce(GetArg3(&result));
+ MessageSharedPtr message_to_mobile(
+ CreateMessage(smart_objects::SmartType_Map));
+ EXPECT_CALL(app_mngr_, GetPolicyHandler()).Times(2);
+ EXPECT_CALL(mock_policy_handler_interface_, CheckPermissions(_, _, _, _, _))
+ .WillOnce(GetArg4(&result));
EXPECT_CALL(mock_rpc_service_,
ManageMobileCommand(
CheckNotificationParams(
am::mobile_api::FunctionID::OnDriverDistractionID, state),
- Command::CommandSource::SOURCE_SDL));
-
+ Command::CommandSource::SOURCE_SDL))
+ .WillOnce(DoAll(SaveArg<0>(&message_to_mobile), Return(true)));
command->Run();
+
+ EXPECT_FALSE((*message_to_mobile)[am::strings::msg_params].keyExists(
+ am::mobile_notification::lock_screen_dismissal_warning));
}
-} // on_driver_distraction_notification
+TEST_F(HMIOnDriverDistractionNotificationTest,
+ Run_SendNotificationToMobile_SpecifiedLanguageIsAbsent_SUCCESS) {
+ const auto state = hmi_apis::Common_DriverDistractionState::DD_ON;
+ MessageSharedPtr commands_msg(CreateMessage(smart_objects::SmartType_Map));
+ (*commands_msg)[am::strings::msg_params][am::hmi_notification::state] = state;
+ (*commands_msg)[am::strings::params][am::strings::connection_key] =
+ kConnectionKey;
+
+ NotificationPtr command(
+ CreateCommand<OnDriverDistractionNotification>(commands_msg));
+
+ EXPECT_CALL(app_mngr_, set_driver_distraction_state(Eq(state)));
+
+ ON_CALL(mock_policy_handler_interface_, LockScreenDismissalEnabledState())
+ .WillByDefault(Return(OptionalBool(true)));
+
+ ON_CALL(mock_policy_handler_interface_, LockScreenDismissalWarningMessage(_))
+ .WillByDefault(Return(kLockScreenDismissalWarningMessage_en));
+
+ // In case when specified language is absent in policy table, will added
+ // message on default language (en-us)
+ const mobile_apis::Language::eType mobile_language =
+ mobile_apis::Language::FR_FR;
+ std::string required_language = "FR-FR";
+ ON_CALL(*mock_app_, ui_language()).WillByDefault(ReturnRef(mobile_language));
+ ON_CALL(mock_message_helper_, MobileLanguageToString(mobile_language))
+ .WillByDefault(Return(required_language));
+
+ policy::CheckPermissionResult result;
+ result.hmi_level_permitted = policy::kRpcAllowed;
+ EXPECT_CALL(mock_policy_handler_interface_, CheckPermissions(_, _, _, _, _))
+ .WillOnce(GetArg4(&result));
+
+ MessageSharedPtr message_to_mobile(
+ CreateMessage(smart_objects::SmartType_Map));
+ EXPECT_CALL(mock_rpc_service_,
+ ManageMobileCommand(
+ CheckNotificationParams(
+ am::mobile_api::FunctionID::OnDriverDistractionID, state),
+ Command::CommandSource::SOURCE_SDL))
+ .WillOnce(DoAll(SaveArg<0>(&message_to_mobile), Return(true)));
+ command->Run();
+
+ ASSERT_TRUE((*message_to_mobile)[am::strings::msg_params].keyExists(
+ am::mobile_notification::lock_screen_dismissal_warning));
+
+ auto lock_screen_dismissal_warning_message =
+ (*message_to_mobile)
+ [am::strings::msg_params]
+ [am::mobile_notification::lock_screen_dismissal_warning]
+ .asString();
+
+ EXPECT_EQ(kLockScreenDismissalWarningMessage_en,
+ lock_screen_dismissal_warning_message);
+}
+} // namespace on_driver_distraction_notification
} // namespace hmi_commands_test
} // namespace commands_test
} // namespace components
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/get_urls_response_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/on_service_status_update_notification_test.cc
index 339a749909..a9bc97f842 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/get_urls_response_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/on_service_status_update_notification_test.cc
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, Ford Motor Company
+ * Copyright (c) 2019, Ford Motor Company
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -29,59 +29,67 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
-
#include <stdint.h>
-#include <string>
-#include "gtest/gtest.h"
-#include "smart_objects/smart_object.h"
-#include "application_manager/smart_object_keys.h"
-#include "application_manager/commands/command.h"
#include "application_manager/commands/commands_test.h"
-#include "application_manager/application.h"
+#include "application_manager/mock_application.h"
#include "application_manager/mock_application_manager.h"
-#include "application_manager/commands/response_to_hmi.h"
-#include "hmi/get_urls_response.h"
+#include "application_manager/smart_object_keys.h"
+#include "gtest/gtest.h"
+#include "hmi/on_service_update_notification.h"
+#include "smart_objects/smart_object.h"
namespace test {
namespace components {
namespace commands_test {
namespace hmi_commands_test {
-namespace get_urls_response {
+namespace on_service_update_notification {
-using ::testing::_;
-using ::testing::Return;
-namespace am = ::application_manager;
-namespace strings = ::application_manager::strings;
-using sdl_rpc_plugin::commands::GetUrlsResponse;
-using am::commands::ResponseToHMI;
-using am::commands::CommandImpl;
+using namespace application_manager;
+using sdl_rpc_plugin::commands::hmi::OnServiceUpdateNotification;
-typedef std::shared_ptr<ResponseToHMI> ResponseToHMIPtr;
+typedef std::shared_ptr<OnServiceUpdateNotification> NotificationPtr;
+typedef hmi_apis::Common_ServiceType::eType ServiceType;
+typedef hmi_apis::Common_ServiceEvent::eType ServiceEvent;
namespace {
-const uint32_t kConnectionKey = 2u;
+const uint32_t kConnectionKey = 1232u;
+const uint32_t kHmi_app_id = 321u;
} // namespace
-class GetUrlResponseTest : public CommandsTest<CommandsTestMocks::kIsNice> {};
+class OnServiceUpdateNotificationTest
+ : public CommandsTest<CommandsTestMocks::kIsNice> {
+ public:
+ OnServiceUpdateNotificationTest()
+ : message_(CreateMessage(smart_objects::SmartType_Map)) {}
+
+ public:
+ MessageSharedPtr message_;
+ NotificationPtr command_;
+};
+
+TEST_F(OnServiceUpdateNotificationTest, SendNotificationToHMI) {
+ (*message_)[strings::msg_params][hmi_notification::service_type] =
+ ServiceType::AUDIO;
+ (*message_)[strings::msg_params][hmi_notification::service_event] =
+ ServiceEvent::REQUEST_ACCEPTED;
+ (*message_)[strings::msg_params][strings::app_id] = kConnectionKey;
+ command_ = CreateCommand<OnServiceUpdateNotification>(message_);
+
+ EXPECT_CALL(mock_rpc_service_, SendMessageToHMI(message_)).Times(1);
-TEST_F(GetUrlResponseTest, RUN_SendRequest_SUCCESS) {
- MessageSharedPtr command_msg(CreateMessage(smart_objects::SmartType_Map));
- (*command_msg)[strings::msg_params][strings::number] = "123";
- (*command_msg)[strings::params][strings::connection_key] = kConnectionKey;
+ auto mock_app = std::make_shared<NiceMock<MockApplication> >();
- ResponseToHMIPtr command(CreateCommand<GetUrlsResponse>(command_msg));
- EXPECT_CALL(mock_rpc_service_, SendMessageToHMI(command_msg));
+ ON_CALL(app_mngr_, application(kConnectionKey))
+ .WillByDefault(Return(mock_app));
- command->Run();
+ ON_CALL(*mock_app, hmi_app_id()).WillByDefault(Return(kHmi_app_id));
- EXPECT_EQ((*command_msg)[strings::params][strings::protocol_type].asInt(),
- CommandImpl::hmi_protocol_type_);
- EXPECT_EQ((*command_msg)[strings::params][strings::protocol_version].asInt(),
- CommandImpl::protocol_version_);
+ command_->Init();
+ command_->Run();
}
-} // namespace get_urls_response
+} // namespace on_service_update_notification
} // namespace hmi_commands_test
} // namespace commands_test
} // namespace components
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/on_system_time_ready_notification_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/on_system_time_ready_notification_test.cc
index 2d50ec2b72..f9dbbf259f 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/on_system_time_ready_notification_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/on_system_time_ready_notification_test.cc
@@ -30,12 +30,12 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include "gtest/gtest.h"
-#include "application_manager/commands/commands_test.h"
#include "hmi/on_system_time_ready_notification.h"
+#include "application_manager/commands/commands_test.h"
#include "application_manager/mock_application_manager.h"
#include "application_manager/mock_event_dispatcher.h"
#include "application_manager/smart_object_keys.h"
+#include "gtest/gtest.h"
#include "interfaces/HMI_API.h"
namespace test {
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/rc_get_capabilities_response_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/rc_get_capabilities_response_test.cc
index 8e62c1a409..67c36dce9c 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/rc_get_capabilities_response_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/rc_get_capabilities_response_test.cc
@@ -34,13 +34,13 @@
#include "gtest/gtest.h"
-#include "smart_objects/smart_object.h"
-#include "interfaces/MOBILE_API.h"
+#include "application_manager/commands/command_impl.h"
+#include "application_manager/commands/commands_test.h"
#include "application_manager/mock_hmi_capabilities.h"
#include "application_manager/smart_object_keys.h"
-#include "application_manager/commands/commands_test.h"
-#include "application_manager/commands/command_impl.h"
#include "hmi/rc_get_capabilities_response.h"
+#include "interfaces/MOBILE_API.h"
+#include "smart_objects/smart_object.h"
namespace test {
namespace components {
@@ -52,8 +52,8 @@ using ::testing::NiceMock;
namespace am = ::application_manager;
namespace strings = am::strings;
namespace hmi_response = am::hmi_response;
-using sdl_rpc_plugin::commands::RCGetCapabilitiesResponse;
using am::commands::CommandImpl;
+using sdl_rpc_plugin::commands::RCGetCapabilitiesResponse;
typedef std::shared_ptr<RCGetCapabilitiesResponse> RCGetCapabilitiesResponsePtr;
typedef NiceMock<
@@ -139,6 +139,7 @@ TEST_F(RCGetCapabilitiesResponseTest, RUN_SUCCESSS) {
radio_control_capability["hdChannelAvailable"] = true;
radio_control_capability["rdsDataAvailable"] = true;
radio_control_capability["availableHDsAvailable"] = true;
+ radio_control_capability["availableHdChannelsAvailable"] = true;
radio_control_capability["stateAvailable"] = true;
radio_control_capability["signalStrengthAvailable"] = true;
radio_control_capability["signalChangeThresholdAvailable"] = true;
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/rc_is_ready_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/rc_is_ready_request_test.cc
index c7fbdb663b..539c0efeb3 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/rc_is_ready_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/rc_is_ready_request_test.cc
@@ -34,15 +34,15 @@
#include "gtest/gtest.h"
-#include "smart_objects/smart_object.h"
-#include "application_manager/smart_object_keys.h"
#include "application_manager/commands/command_request_test.h"
-#include "application_manager/mock_application_manager.h"
+#include "application_manager/event_engine/event.h"
#include "application_manager/hmi_interfaces.h"
-#include "application_manager/mock_hmi_interface.h"
+#include "application_manager/mock_application_manager.h"
#include "application_manager/mock_hmi_capabilities.h"
+#include "application_manager/mock_hmi_interface.h"
#include "application_manager/mock_message_helper.h"
-#include "application_manager/event_engine/event.h"
+#include "application_manager/smart_object_keys.h"
+#include "smart_objects/smart_object.h"
namespace test {
namespace components {
@@ -54,8 +54,8 @@ using ::testing::_;
using ::testing::ReturnRef;
namespace am = ::application_manager;
using am::commands::MessageSharedPtr;
-using sdl_rpc_plugin::commands::RCIsReadyRequest;
using am::event_engine::Event;
+using sdl_rpc_plugin::commands::RCIsReadyRequest;
typedef std::shared_ptr<RCIsReadyRequest> RCIsReadyRequestPtr;
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/rc_is_ready_response_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/rc_is_ready_response_test.cc
index a1a8c1c87e..4224e82b5f 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/rc_is_ready_response_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/rc_is_ready_response_test.cc
@@ -35,11 +35,11 @@
#include "gtest/gtest.h"
-#include "smart_objects/smart_object.h"
#include "application_manager/commands/commands_test.h"
+#include "application_manager/mock_event_dispatcher.h"
#include "application_manager/mock_hmi_capabilities.h"
#include "hmi/rc_is_ready_response.h"
-#include "application_manager/mock_event_dispatcher.h"
+#include "smart_objects/smart_object.h"
namespace test {
namespace components {
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/response_from_hmi_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/response_from_hmi_test.cc
index 25abefb010..3e7e6e6f59 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/response_from_hmi_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/response_from_hmi_test.cc
@@ -32,24 +32,24 @@
#include <stdint.h>
-#include "gtest/gtest.h"
-#include "smart_objects/smart_object.h"
+#include "application_manager/commands/command.h"
+#include "application_manager/commands/response_from_hmi.h"
#include "application_manager/smart_object_keys.h"
#include "application_manager/test/include/application_manager/commands/commands_test.h"
-#include "application_manager/commands/command.h"
#include "application_manager/test/include/application_manager/mock_event_dispatcher.h"
-#include "application_manager/commands/response_from_hmi.h"
+#include "gtest/gtest.h"
+#include "smart_objects/smart_object.h"
namespace test {
namespace components {
namespace commands_test {
namespace hmi_commands_test {
namespace response_from_hmi {
+using ::test::components::event_engine_test::MockEventDispatcher;
using ::testing::_;
+using ::testing::DoAll;
using ::testing::Return;
using ::testing::SaveArg;
-using ::testing::DoAll;
-using ::test::components::event_engine_test::MockEventDispatcher;
namespace am = ::application_manager;
using application_manager::commands::ResponseFromHMI;
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_activate_app_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_activate_app_request_test.cc
index 917de81fb3..93344f1a0d 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_activate_app_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_activate_app_request_test.cc
@@ -32,19 +32,19 @@
#include <stdint.h>
-#include "gtest/gtest.h"
-#include "utils/lock.h"
-#include "utils/helpers.h"
-#include "hmi/sdl_activate_app_request.h"
-#include "application_manager/mock_application.h"
#include "application_manager/application_manager.h"
-#include "application_manager/policies/mock_policy_handler_interface.h"
#include "application_manager/commands/command_request_test.h"
-#include "application_manager/mock_message_helper.h"
#include "application_manager/event_engine/event.h"
+#include "application_manager/mock_application.h"
#include "application_manager/mock_event_dispatcher.h"
+#include "application_manager/mock_message_helper.h"
#include "application_manager/mock_state_controller.h"
+#include "application_manager/policies/mock_policy_handler_interface.h"
#include "connection_handler/mock_connection_handler.h"
+#include "gtest/gtest.h"
+#include "hmi/sdl_activate_app_request.h"
+#include "utils/helpers.h"
+#include "utils/lock.h"
namespace test {
namespace components {
@@ -55,18 +55,17 @@ namespace sdl_activate_app_request {
namespace am = ::application_manager;
namespace strings = am::strings;
namespace hmi_response = am::hmi_response;
+using am::ApplicationSet;
using am::commands::MessageSharedPtr;
+using am::event_engine::Event;
+using connection_handler_test::MockConnectionHandler;
+using policy_test::MockPolicyHandlerInterface;
using sdl_rpc_plugin::commands::SDLActivateAppRequest;
-using am::ApplicationSet;
+using testing::Gt;
using testing::Mock;
+using ::testing::NiceMock;
using testing::Return;
using testing::ReturnRef;
-using testing::Mock;
-using testing::Gt;
-using ::testing::NiceMock;
-using policy_test::MockPolicyHandlerInterface;
-using connection_handler_test::MockConnectionHandler;
-using am::event_engine::Event;
namespace {
const uint32_t kCorrelationID = 1u;
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_activate_app_response_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_activate_app_response_test.cc
index bca316bcfa..b35ccde314 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_activate_app_response_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_activate_app_response_test.cc
@@ -33,12 +33,12 @@
#include <stdint.h>
#include <string>
-#include "gtest/gtest.h"
-#include "smart_objects/smart_object.h"
-#include "application_manager/smart_object_keys.h"
-#include "application_manager/commands/commands_test.h"
#include "application_manager/application.h"
+#include "application_manager/commands/commands_test.h"
+#include "application_manager/smart_object_keys.h"
+#include "gtest/gtest.h"
#include "hmi/sdl_activate_app_response.h"
+#include "smart_objects/smart_object.h"
namespace test {
namespace components {
@@ -48,8 +48,8 @@ namespace sdl_activate_app_response {
namespace am = ::application_manager;
namespace strings = ::application_manager::strings;
-using sdl_rpc_plugin::commands::SDLActivateAppResponse;
using am::commands::CommandImpl;
+using sdl_rpc_plugin::commands::SDLActivateAppResponse;
typedef std::shared_ptr<SDLActivateAppResponse> SDLActivateAppResponsePtr;
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_get_list_of_permisssions_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_get_list_of_permisssions_request_test.cc
index 262ac5fc7d..c8cc4bb18c 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_get_list_of_permisssions_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_get_list_of_permisssions_request_test.cc
@@ -32,11 +32,11 @@
#include <stdint.h>
-#include "gtest/gtest.h"
-#include "hmi/sdl_get_list_of_permissions_request.h"
+#include "application_manager/commands/command_request_test.h"
#include "application_manager/mock_application.h"
#include "application_manager/policies/mock_policy_handler_interface.h"
-#include "application_manager/commands/command_request_test.h"
+#include "gtest/gtest.h"
+#include "hmi/sdl_get_list_of_permissions_request.h"
namespace test {
namespace components {
@@ -46,8 +46,8 @@ namespace sdl_get_list_of_permissions_request {
using application_manager::commands::MessageSharedPtr;
using sdl_rpc_plugin::commands::SDLGetListOfPermissionsRequest;
-using test::components::policy_test::MockPolicyHandlerInterface;
using smart_objects::SmartObject;
+using test::components::policy_test::MockPolicyHandlerInterface;
using testing::Return;
using testing::ReturnRef;
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_get_policy_configuration_data_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_get_policy_configuration_data_request_test.cc
new file mode 100644
index 0000000000..8e802bbd7d
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_get_policy_configuration_data_request_test.cc
@@ -0,0 +1,180 @@
+/*
+ * Copyright (c) 2019, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "hmi/sdl_get_policy_configuration_data_request.h"
+#include "application_manager/commands/command_request_test.h"
+#include "gtest/gtest.h"
+#include "smart_objects/smart_object.h"
+
+namespace test {
+namespace components {
+namespace commands_test {
+namespace hmi_commands_test {
+namespace sdl_get_policy_configuration_data_request {
+
+using testing::Return;
+
+using sdl_rpc_plugin::commands::SDLGetPolicyConfigurationDataRequest;
+using test::components::policy_test::MockPolicyHandlerInterface;
+
+namespace strings = ::app_mngr::strings;
+namespace hmi_response = ::app_mngr::hmi_response;
+
+class SDLGetPolicyConfigurationDataRequestTest
+ : public CommandRequestTest<CommandsTestMocks::kIsNice> {};
+
+MATCHER_P(GetPolicyConfigurationDataFirstElementMatches,
+ string_first_element_value,
+ "") {
+ auto message = static_cast<smart_objects::SmartObject>(*arg);
+ if (!message.keyExists(strings::msg_params) ||
+ !message[strings::msg_params].keyExists(strings::value)) {
+ return false;
+ }
+
+ if (message[strings::msg_params][strings::value].getType() !=
+ smart_objects::SmartType::SmartType_Array ||
+ message[strings::msg_params][strings::value].empty()) {
+ return false;
+ }
+
+ Json::Reader reader;
+ Json::Value msg_json_value(Json::ValueType::arrayValue);
+
+ auto msg_value_first = message[strings::msg_params][strings::value][0];
+ return msg_value_first.asString() == string_first_element_value;
+}
+
+MATCHER_P(HMIResultCodeIs, result_code, "") {
+ return result_code ==
+ static_cast<hmi_apis::Common_Result::eType>(
+ (*arg)[strings::params][hmi_response::code].asInt());
+}
+
+TEST_F(SDLGetPolicyConfigurationDataRequestTest, Run_Fail_DataNotAvailable) {
+ std::string kInvalidKey = "invalid_key";
+
+ PolicyTable pt;
+ ON_CALL(mock_policy_handler_, GetPolicyTableData())
+ .WillByDefault(Return(pt.ToJsonValue()));
+
+ MessageSharedPtr msg = CreateMessage();
+ (*msg)[strings::msg_params][strings::policy_type] = kInvalidKey;
+ (*msg)[strings::msg_params][strings::property] = kInvalidKey;
+
+ std::shared_ptr<SDLGetPolicyConfigurationDataRequest> command(
+ CreateCommand<SDLGetPolicyConfigurationDataRequest>(msg));
+
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::Common_Result::DATA_NOT_AVAILABLE),
+ Command::SOURCE_SDL_TO_HMI));
+
+ command->Run();
+}
+
+void clear_new_line_symbol(std::string& str_to_clear) {
+ str_to_clear.erase(
+ std::remove_if(str_to_clear.begin(),
+ str_to_clear.end(),
+ [](char character) { return '\n' == character; }),
+ str_to_clear.end());
+}
+
+TEST_F(SDLGetPolicyConfigurationDataRequestTest, Run_Success) {
+ MessageSharedPtr msg = CreateMessage();
+ (*msg)[strings::msg_params][strings::policy_type] = "module_config";
+ (*msg)[strings::msg_params][strings::property] = "endpoints";
+
+ std::shared_ptr<SDLGetPolicyConfigurationDataRequest> command(
+ CreateCommand<SDLGetPolicyConfigurationDataRequest>(msg));
+
+ policy_table::ModuleConfig module_config_with_endpoints;
+ policy_table::URLList endpoint_url_list;
+ policy_table::URL urls;
+ urls.push_back("https://url1.com");
+ urls.push_back("https://url2.com");
+ endpoint_url_list["default"] = urls;
+ module_config_with_endpoints.endpoints["0x9"] = endpoint_url_list;
+
+ PolicyTable pt;
+ pt.mark_initialized();
+ pt.module_config.mark_initialized();
+ pt.module_config = module_config_with_endpoints;
+
+ ON_CALL(mock_policy_handler_, GetPolicyTableData())
+ .WillByDefault(Return(pt.ToJsonValue()));
+
+ auto json_val = module_config_with_endpoints.endpoints.ToJsonValue();
+ Json::FastWriter writer;
+ std::string expected_string = writer.write(json_val);
+ clear_new_line_symbol(expected_string);
+
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(GetPolicyConfigurationDataFirstElementMatches(
+ expected_string),
+ Command::SOURCE_SDL_TO_HMI));
+ command->Run();
+}
+
+TEST_F(SDLGetPolicyConfigurationDataRequestTest,
+ Run_RetriveStringValueFromPolicy) {
+ MessageSharedPtr msg = CreateMessage();
+ (*msg)[strings::msg_params][strings::policy_type] =
+ "consumer_friendly_messages";
+ (*msg)[strings::msg_params][strings::property] = "version";
+
+ auto command = CreateCommand<SDLGetPolicyConfigurationDataRequest>(msg);
+
+ const std::string version_test_value("version string");
+ PolicyTable pt;
+ pt.mark_initialized();
+ pt.consumer_friendly_messages->mark_initialized();
+ pt.consumer_friendly_messages->version =
+ rpc::String<1, 100>(version_test_value);
+
+ ON_CALL(mock_policy_handler_, GetPolicyTableData())
+ .WillByDefault(Return(pt.ToJsonValue()));
+
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(GetPolicyConfigurationDataFirstElementMatches(
+ version_test_value),
+ Command::SOURCE_SDL_TO_HMI));
+
+ command->Run();
+}
+
+} // namespace sdl_get_policy_configuration_data_request
+} // namespace hmi_commands_test
+} // namespace commands_test
+} // namespace components
+} // namespace test
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_get_status_update_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_get_status_update_request_test.cc
index fca8ed840f..021dfc8b1d 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_get_status_update_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_get_status_update_request_test.cc
@@ -32,11 +32,11 @@
#include <stdint.h>
-#include "gtest/gtest.h"
-#include "hmi/sdl_get_status_update_request.h"
+#include "application_manager/commands/command_request_test.h"
#include "application_manager/mock_application.h"
#include "application_manager/policies/mock_policy_handler_interface.h"
-#include "application_manager/commands/command_request_test.h"
+#include "gtest/gtest.h"
+#include "hmi/sdl_get_status_update_request.h"
namespace test {
namespace components {
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_get_user_friendly_message_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_get_user_friendly_message_request_test.cc
index b040f8ea40..5cac1c823f 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_get_user_friendly_message_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_get_user_friendly_message_request_test.cc
@@ -34,15 +34,15 @@
#include <string>
#include <vector>
-#include "gtest/gtest.h"
-#include "hmi/sdl_get_user_friendly_message_request.h"
+#include "application_manager/commands/command_request_test.h"
#include "application_manager/mock_application.h"
+#include "application_manager/mock_hmi_capabilities.h"
+#include "application_manager/mock_message_helper.h"
#include "application_manager/mock_state_controller.h"
#include "application_manager/policies/mock_policy_handler_interface.h"
-#include "application_manager/mock_message_helper.h"
-#include "application_manager/mock_hmi_capabilities.h"
+#include "gtest/gtest.h"
+#include "hmi/sdl_get_user_friendly_message_request.h"
#include "smart_objects/smart_object.h"
-#include "application_manager/commands/command_request_test.h"
namespace test {
namespace components {
@@ -50,11 +50,11 @@ namespace commands_test {
namespace hmi_commands_test {
namespace sdl_get_user_friendly_message_request {
+using application_manager::MockMessageHelper;
using application_manager::commands::MessageSharedPtr;
using sdl_rpc_plugin::commands::SDLGetUserFriendlyMessageRequest;
-using application_manager::MockMessageHelper;
-using test::components::policy_test::MockPolicyHandlerInterface;
using test::components::application_manager_test::MockHMICapabilities;
+using test::components::policy_test::MockPolicyHandlerInterface;
using testing::_;
using testing::Return;
using testing::ReturnRef;
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/simple_notifications_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/simple_notifications_test.cc
index 581913d3a5..57bb018273 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/simple_notifications_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/simple_notifications_test.cc
@@ -34,8 +34,8 @@
#include "application_manager/commands/commands_test.h"
-#include "application_manager/commands/notification_to_hmi.h"
#include "application_manager/commands/command_notification_impl.h"
+#include "application_manager/commands/notification_to_hmi.h"
namespace test {
namespace components {
@@ -45,8 +45,8 @@ namespace simple_notifications_test {
using namespace application_manager;
-using ::testing::Types;
using commands::NotificationToHMI;
+using ::testing::Types;
template <typename Command>
class SimpleNotificationsTest
: public CommandsTest<CommandsTestMocks::kIsNice> {
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/simple_request_from_hmi_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/simple_request_from_hmi_test.cc
index a69f6c71fc..fc2cd1cca4 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/simple_request_from_hmi_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/simple_request_from_hmi_test.cc
@@ -30,14 +30,14 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include "gtest/gtest.h"
-#include "smart_objects/smart_object.h"
-#include "application_manager/smart_object_keys.h"
-#include "application_manager/commands/commands_test.h"
#include "application_manager/commands/command.h"
+#include "application_manager/commands/commands_test.h"
+#include "application_manager/commands/request_from_hmi.h"
#include "application_manager/event_engine/event.h"
#include "application_manager/mock_event_dispatcher.h"
-#include "application_manager/commands/request_from_hmi.h"
+#include "application_manager/smart_object_keys.h"
+#include "gtest/gtest.h"
+#include "smart_objects/smart_object.h"
namespace test {
namespace components {
@@ -46,12 +46,12 @@ namespace hmi_commands_test {
namespace simple_requests_from_hmi_test {
using ::testing::_;
-using ::testing::Types;
-using ::testing::NotNull;
using ::testing::NiceMock;
+using ::testing::NotNull;
+using ::testing::Types;
namespace commands = ::application_manager::commands;
-using commands::MessageSharedPtr;
using ::application_manager::event_engine::EventObserver;
+using commands::MessageSharedPtr;
using ::test::components::event_engine_test::MockEventDispatcher;
class RequestFromHMITest : public CommandsTest<CommandsTestMocks::kIsNice> {
@@ -89,7 +89,7 @@ TEST_F(RequestFromHMITest, SendResponse_SUCCESS) {
hmi_apis::Common_Result::SUCCESS);
}
-} // namespace simple_requests_to_hmi_test
+} // namespace simple_requests_from_hmi_test
} // namespace hmi_commands_test
} // namespace commands_test
} // namespace components
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/simple_requests_to_hmi_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/simple_requests_to_hmi_test.cc
index 599c7e50f2..162e832e9f 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/simple_requests_to_hmi_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/simple_requests_to_hmi_test.cc
@@ -30,16 +30,18 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include "gtest/gtest.h"
-#include "smart_objects/smart_object.h"
-#include "application_manager/smart_object_keys.h"
-#include "application_manager/commands/commands_test.h"
-#include "application_manager/commands/command_request_test.h"
#include "application_manager/commands/command.h"
-#include "sdl_rpc_plugin/commands/hmi/allow_app_request.h"
+#include "application_manager/commands/command_request_test.h"
+#include "application_manager/commands/commands_test.h"
+#include "application_manager/commands/request_to_hmi.h"
+#include "application_manager/smart_object_keys.h"
+#include "gtest/gtest.h"
#include "sdl_rpc_plugin/commands/hmi/allow_all_apps_request.h"
+#include "sdl_rpc_plugin/commands/hmi/allow_app_request.h"
#include "sdl_rpc_plugin/commands/hmi/basic_communication_system_request.h"
#include "sdl_rpc_plugin/commands/hmi/button_get_capabilities_request.h"
+#include "sdl_rpc_plugin/commands/hmi/close_popup_request.h"
+#include "sdl_rpc_plugin/commands/hmi/dial_number_request.h"
#include "sdl_rpc_plugin/commands/hmi/navi_alert_maneuver_request.h"
#include "sdl_rpc_plugin/commands/hmi/navi_audio_stop_stream_request.h"
#include "sdl_rpc_plugin/commands/hmi/navi_get_way_points_request.h"
@@ -53,21 +55,15 @@
#include "sdl_rpc_plugin/commands/hmi/sdl_activate_app_response.h"
#include "sdl_rpc_plugin/commands/hmi/sdl_get_list_of_permissions_response.h"
#include "sdl_rpc_plugin/commands/hmi/sdl_get_status_update_response.h"
-#include "sdl_rpc_plugin/commands/hmi/ui_scrollable_message_request.h"
-#include "sdl_rpc_plugin/commands/hmi/ui_set_app_icon_request.h"
-#include "sdl_rpc_plugin/commands/hmi/ui_set_display_layout_request.h"
-#include "sdl_rpc_plugin/commands/hmi/ui_set_global_properties_request.h"
-#include "application_manager/commands/request_to_hmi.h"
-#include "sdl_rpc_plugin/commands/hmi/dial_number_request.h"
+#include "sdl_rpc_plugin/commands/hmi/sdl_policy_update.h"
+#include "sdl_rpc_plugin/commands/hmi/tts_change_registration_request.h"
+#include "sdl_rpc_plugin/commands/hmi/tts_get_capabilities_request.h"
+#include "sdl_rpc_plugin/commands/hmi/tts_get_language_request.h"
+#include "sdl_rpc_plugin/commands/hmi/tts_get_supported_languages_request.h"
#include "sdl_rpc_plugin/commands/hmi/tts_is_ready_request.h"
#include "sdl_rpc_plugin/commands/hmi/tts_set_global_properties_request.h"
#include "sdl_rpc_plugin/commands/hmi/tts_speak_request.h"
#include "sdl_rpc_plugin/commands/hmi/tts_stop_speaking_request.h"
-#include "sdl_rpc_plugin/commands/hmi/tts_get_supported_languages_request.h"
-#include "sdl_rpc_plugin/commands/hmi/tts_change_registration_request.h"
-#include "sdl_rpc_plugin/commands/hmi/tts_get_capabilities_request.h"
-#include "sdl_rpc_plugin/commands/hmi/tts_get_language_request.h"
-#include "sdl_rpc_plugin/commands/hmi/close_popup_request.h"
#include "sdl_rpc_plugin/commands/hmi/ui_add_command_request.h"
#include "sdl_rpc_plugin/commands/hmi/ui_add_submenu_request.h"
#include "sdl_rpc_plugin/commands/hmi/ui_alert_request.h"
@@ -81,6 +77,11 @@
#include "sdl_rpc_plugin/commands/hmi/ui_is_ready_request.h"
#include "sdl_rpc_plugin/commands/hmi/ui_perform_audio_pass_thru_request.h"
#include "sdl_rpc_plugin/commands/hmi/ui_perform_interaction_request.h"
+#include "sdl_rpc_plugin/commands/hmi/ui_scrollable_message_request.h"
+#include "sdl_rpc_plugin/commands/hmi/ui_send_haptic_data_request.h"
+#include "sdl_rpc_plugin/commands/hmi/ui_set_app_icon_request.h"
+#include "sdl_rpc_plugin/commands/hmi/ui_set_display_layout_request.h"
+#include "sdl_rpc_plugin/commands/hmi/ui_set_global_properties_request.h"
#include "sdl_rpc_plugin/commands/hmi/ui_set_media_clock_timer_request.h"
#include "sdl_rpc_plugin/commands/hmi/ui_show_request.h"
#include "sdl_rpc_plugin/commands/hmi/ui_slider_request.h"
@@ -88,23 +89,11 @@
#include "sdl_rpc_plugin/commands/hmi/vr_change_registration_request.h"
#include "sdl_rpc_plugin/commands/hmi/vr_delete_command_request.h"
#include "sdl_rpc_plugin/commands/hmi/vr_get_capabilities_request.h"
-#include "sdl_rpc_plugin/commands/hmi/vr_get_supported_languages_request.h"
#include "sdl_rpc_plugin/commands/hmi/vr_get_language_request.h"
+#include "sdl_rpc_plugin/commands/hmi/vr_get_supported_languages_request.h"
#include "sdl_rpc_plugin/commands/hmi/vr_is_ready_request.h"
#include "sdl_rpc_plugin/commands/hmi/vr_perform_interaction_request.h"
-#include "sdl_rpc_plugin/commands/hmi/allow_all_apps_request.h"
-#include "sdl_rpc_plugin/commands/hmi/basic_communication_system_request.h"
-#include "sdl_rpc_plugin/commands/hmi/button_get_capabilities_request.h"
-#include "sdl_rpc_plugin/commands/hmi/allow_app_request.h"
-#include "sdl_rpc_plugin/commands/hmi/navi_send_location_request.h"
-#include "sdl_rpc_plugin/commands/hmi/navi_unsubscribe_way_points_request.h"
-#include "sdl_rpc_plugin/commands/hmi/navi_update_turn_list_request.h"
-#include "sdl_rpc_plugin/commands/hmi/navi_show_constant_tbt_request.h"
-#include "sdl_rpc_plugin/commands/hmi/navi_stop_stream_request.h"
-#include "sdl_rpc_plugin/commands/hmi/navi_subscribe_way_points_request.h"
-#include "sdl_rpc_plugin/commands/hmi/sdl_policy_update.h"
-#include "sdl_rpc_plugin/commands/hmi/dial_number_request.h"
-#include "sdl_rpc_plugin/commands/hmi/ui_send_haptic_data_request.h"
+#include "smart_objects/smart_object.h"
#include "application_manager/mock_event_dispatcher.h"
@@ -115,8 +104,8 @@ namespace hmi_commands_test {
namespace simple_requests_to_hmi_test {
using ::testing::_;
-using ::testing::Types;
using ::testing::NotNull;
+using ::testing::Types;
namespace am_commands = application_manager::commands;
using am_commands::MessageSharedPtr;
using event_engine_test::MockEventDispatcher;
@@ -221,7 +210,8 @@ typedef Types<sdl_rpc_plugin::commands::UIScrollableMessageRequest,
typedef Types<sdl_rpc_plugin::commands::TTSIsReadyRequest,
sdl_rpc_plugin::commands::UIIsReadyRequest,
sdl_rpc_plugin::commands::NaviIsReadyRequest,
- sdl_rpc_plugin::commands::VRIsReadyRequest> RequestCommandsList3;
+ sdl_rpc_plugin::commands::VRIsReadyRequest>
+ RequestCommandsList3;
TYPED_TEST_CASE(RequestToHMICommandsTest, RequestCommandsList);
TYPED_TEST_CASE(RequestToHMICommandsTest2, RequestCommandsList2);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/simple_response_from_hmi_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/simple_response_from_hmi_test.cc
index 4f415975ba..f232240c28 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/simple_response_from_hmi_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/simple_response_from_hmi_test.cc
@@ -32,13 +32,18 @@
#include <stdint.h>
-#include "gtest/gtest.h"
-#include "smart_objects/smart_object.h"
-#include "application_manager/smart_object_keys.h"
-#include "application_manager/commands/commands_test.h"
#include "application_manager/commands/command.h"
+#include "application_manager/commands/commands_test.h"
+#include "application_manager/commands/notification_from_hmi.h"
+#include "application_manager/mock_event_dispatcher.h"
+#include "application_manager/mock_hmi_capabilities.h"
+#include "application_manager/policies/mock_policy_handler_interface.h"
+#include "application_manager/smart_object_keys.h"
+#include "gtest/gtest.h"
#include "hmi/activate_app_response.h"
#include "hmi/basic_communication_system_response.h"
+#include "hmi/close_popup_response.h"
+#include "hmi/dial_number_response.h"
#include "hmi/navi_alert_maneuver_response.h"
#include "hmi/navi_audio_start_stream_response.h"
#include "hmi/navi_audio_stop_stream_response.h"
@@ -50,20 +55,13 @@
#include "hmi/navi_subscribe_way_points_response.h"
#include "hmi/navi_unsubscribe_way_points_response.h"
#include "hmi/navi_update_turn_list_response.h"
+#include "hmi/on_find_applications.h"
+#include "hmi/on_update_device_list.h"
+#include "hmi/sdl_policy_update_response.h"
#include "hmi/tts_change_registration_response.h"
-#include "hmi/ui_set_app_icon_response.h"
-#include "hmi/ui_set_display_layout_response.h"
-#include "hmi/ui_set_global_properties_response.h"
-#include "hmi/ui_scrollable_message_response.h"
-#include "application_manager/mock_event_dispatcher.h"
-#include "application_manager/mock_hmi_capabilities.h"
-#include "application_manager/policies/mock_policy_handler_interface.h"
-#include "hmi/dial_number_response.h"
-#include "hmi/close_popup_response.h"
#include "hmi/tts_set_global_properties_response.h"
#include "hmi/tts_speak_response.h"
#include "hmi/tts_stop_speaking_response.h"
-#include "hmi/tts_change_registration_response.h"
#include "hmi/ui_add_command_response.h"
#include "hmi/ui_add_submenu_response.h"
#include "hmi/ui_alert_response.h"
@@ -73,28 +71,21 @@
#include "hmi/ui_end_audio_pass_thru_response.h"
#include "hmi/ui_perform_audio_pass_thru_response.h"
#include "hmi/ui_perform_interaction_response.h"
+#include "hmi/ui_scrollable_message_response.h"
+#include "hmi/ui_send_haptic_data_response.h"
+#include "hmi/ui_set_app_icon_response.h"
+#include "hmi/ui_set_display_layout_response.h"
+#include "hmi/ui_set_global_properties_response.h"
#include "hmi/ui_set_media_clock_timer_response.h"
#include "hmi/ui_show_response.h"
#include "hmi/ui_slider_response.h"
+#include "hmi/update_app_list_response.h"
+#include "hmi/update_device_list_response.h"
#include "hmi/vr_add_command_response.h"
#include "hmi/vr_change_registration_response.h"
#include "hmi/vr_delete_command_response.h"
#include "hmi/vr_perform_interaction_response.h"
-#include "hmi/activate_app_response.h"
-#include "hmi/basic_communication_system_response.h"
-#include "hmi/navi_unsubscribe_way_points_response.h"
-#include "hmi/navi_update_turn_list_response.h"
-#include "hmi/navi_send_location_response.h"
-#include "hmi/navi_show_constant_tbt_response.h"
-#include "hmi/navi_start_stream_response.h"
-#include "hmi/navi_subscribe_way_points_response.h"
-#include "hmi/on_find_applications.h"
-#include "hmi/on_update_device_list.h"
-#include "hmi/sdl_policy_update_response.h"
-#include "hmi/update_app_list_response.h"
-#include "hmi/update_device_list_response.h"
-#include "application_manager/commands/notification_from_hmi.h"
-#include "hmi/ui_send_haptic_data_response.h"
+#include "smart_objects/smart_object.h"
namespace test {
namespace components {
@@ -102,12 +93,12 @@ namespace commands_test {
namespace hmi_commands_test {
namespace simple_response_from_hmi_test {
+using ::test::components::event_engine_test::MockEventDispatcher;
using ::testing::_;
+using ::testing::Eq;
using ::testing::Return;
using ::testing::ReturnRef;
using ::testing::Types;
-using ::testing::Eq;
-using ::test::components::event_engine_test::MockEventDispatcher;
namespace am = ::application_manager;
namespace commands = sdl_rpc_plugin::commands;
@@ -218,7 +209,8 @@ typedef Types<
CommandData<sdl_rpc_plugin::commands::UIScrollableMessageResponse,
hmi_apis::FunctionID::UI_ScrollableMessage>,
CommandData<sdl_rpc_plugin::commands::UISendHapticDataResponse,
- hmi_apis::FunctionID::UI_SendHapticData> > ResponseCommandsList;
+ hmi_apis::FunctionID::UI_SendHapticData> >
+ ResponseCommandsList;
typedef Types<sdl_rpc_plugin::commands::AudioStopStreamResponse,
sdl_rpc_plugin::commands::NaviStopStreamResponse,
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/simple_response_to_hmi_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/simple_response_to_hmi_test.cc
index 643e21d818..910c3f2873 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/simple_response_to_hmi_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/simple_response_to_hmi_test.cc
@@ -30,16 +30,16 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include "gtest/gtest.h"
-#include "smart_objects/smart_object.h"
-#include "application_manager/smart_object_keys.h"
#include "application_manager/commands/command.h"
#include "application_manager/commands/commands_test.h"
+#include "application_manager/commands/response_to_hmi.h"
+#include "application_manager/smart_object_keys.h"
+#include "gtest/gtest.h"
#include "sdl_rpc_plugin/commands/hmi/sdl_activate_app_response.h"
#include "sdl_rpc_plugin/commands/hmi/sdl_get_list_of_permissions_response.h"
#include "sdl_rpc_plugin/commands/hmi/sdl_get_status_update_response.h"
#include "sdl_rpc_plugin/commands/hmi/sdl_get_user_friendly_message_response.h"
-#include "application_manager/commands/response_to_hmi.h"
+#include "smart_objects/smart_object.h"
namespace test {
namespace components {
@@ -48,8 +48,8 @@ namespace hmi_commands_test {
namespace simple_response_to_hmi_test {
using ::testing::_;
-using ::testing::Types;
using ::testing::NotNull;
+using ::testing::Types;
namespace commands = sdl_rpc_plugin::commands;
using application_manager::commands::MessageSharedPtr;
@@ -63,7 +63,8 @@ class ResponseToHMICommandsTest
typedef Types<commands::SDLActivateAppResponse,
commands::SDLGetListOfPermissionsResponse,
commands::SDLGetStatusUpdateResponse,
- commands::SDLGetUserFriendlyMessageResponse> ResponseCommandsList;
+ commands::SDLGetUserFriendlyMessageResponse>
+ ResponseCommandsList;
TYPED_TEST_CASE(ResponseToHMICommandsTest, ResponseCommandsList);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/tts_get_capabilities_response_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/tts_get_capabilities_response_test.cc
index bc9d262e6d..c7b96f1acf 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/tts_get_capabilities_response_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/tts_get_capabilities_response_test.cc
@@ -32,11 +32,11 @@
#include <string>
+#include "application_manager/commands/commands_test.h"
+#include "application_manager/mock_hmi_capabilities.h"
#include "gtest/gtest.h"
#include "hmi/tts_get_capabilities_response.h"
-#include "application_manager/mock_hmi_capabilities.h"
#include "smart_objects/smart_object.h"
-#include "application_manager/commands/commands_test.h"
namespace test {
namespace components {
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/tts_get_language_response_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/tts_get_language_response_test.cc
index 0d22500f48..c0d23cb34b 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/tts_get_language_response_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/tts_get_language_response_test.cc
@@ -30,13 +30,12 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include "gtest/gtest.h"
#include "hmi/tts_get_language_response.h"
-#include "application_manager/smart_object_keys.h"
#include "application_manager/commands/commands_test.h"
-#include "application_manager/mock_hmi_capabilities.h"
#include "application_manager/mock_event_dispatcher.h"
-#include "application_manager/commands/commands_test.h"
+#include "application_manager/mock_hmi_capabilities.h"
+#include "application_manager/smart_object_keys.h"
+#include "gtest/gtest.h"
namespace test {
namespace components {
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/tts_get_supported_languages_response_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/tts_get_supported_languages_response_test.cc
index 417b8e1898..c0f187a85f 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/tts_get_supported_languages_response_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/tts_get_supported_languages_response_test.cc
@@ -33,17 +33,17 @@
#include <stdint.h>
#include <string>
-#include "gtest/gtest.h"
-#include "smart_objects/smart_object.h"
-#include "application_manager/smart_object_keys.h"
-#include "application_manager/commands/commands_test.h"
#include "application_manager/application.h"
+#include "application_manager/commands/commands_test.h"
+#include "application_manager/commands/response_from_hmi.h"
+#include "application_manager/mock_application_manager.h"
#include "application_manager/mock_hmi_capabilities.h"
#include "application_manager/mock_message_helper.h"
-#include "application_manager/mock_application_manager.h"
-#include "application_manager/commands/response_from_hmi.h"
-#include "hmi/tts_get_supported_languages_response.h"
#include "application_manager/policies/mock_policy_handler_interface.h"
+#include "application_manager/smart_object_keys.h"
+#include "gtest/gtest.h"
+#include "hmi/tts_get_supported_languages_response.h"
+#include "smart_objects/smart_object.h"
namespace test {
namespace components {
@@ -52,14 +52,14 @@ namespace hmi_commands_test {
namespace tts_get_supported_languages_response {
using ::testing::_;
-using ::testing::Return;
using ::testing::NiceMock;
+using ::testing::Return;
namespace am = ::application_manager;
namespace strings = ::application_manager::strings;
namespace hmi_response = am::hmi_response;
+using am::commands::CommandImpl;
using application_manager::commands::ResponseFromHMI;
using sdl_rpc_plugin::commands::TTSGetSupportedLanguagesResponse;
-using am::commands::CommandImpl;
typedef std::shared_ptr<ResponseFromHMI> ResponseFromHMIPtr;
typedef NiceMock<
@@ -113,7 +113,8 @@ TEST_F(TTSGetSupportedLanguageResponseTest, RUN_UNSUCCESS) {
CreateCommand<TTSGetSupportedLanguagesResponse>(command_msg));
EXPECT_CALL(mock_hmi_capabilities_,
- set_tts_supported_languages(supported_languages)).Times(0);
+ set_tts_supported_languages(supported_languages))
+ .Times(0);
command->Run();
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/tts_is_ready_response_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/tts_is_ready_response_test.cc
index 2fae8a6819..a2f4440c86 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/tts_is_ready_response_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/tts_is_ready_response_test.cc
@@ -33,18 +33,18 @@
#include <stdint.h>
#include <string>
-#include "gtest/gtest.h"
-#include "smart_objects/smart_object.h"
-#include "application_manager/smart_object_keys.h"
-#include "application_manager/commands/commands_test.h"
#include "application_manager/application.h"
+#include "application_manager/commands/commands_test.h"
+#include "application_manager/commands/response_from_hmi.h"
+#include "application_manager/mock_application_manager.h"
+#include "application_manager/mock_event_dispatcher.h"
#include "application_manager/mock_hmi_capabilities.h"
#include "application_manager/mock_message_helper.h"
-#include "application_manager/mock_application_manager.h"
-#include "application_manager/commands/response_from_hmi.h"
-#include "hmi/tts_is_ready_response.h"
#include "application_manager/policies/mock_policy_handler_interface.h"
-#include "application_manager/mock_event_dispatcher.h"
+#include "application_manager/smart_object_keys.h"
+#include "gtest/gtest.h"
+#include "hmi/tts_is_ready_response.h"
+#include "smart_objects/smart_object.h"
namespace test {
namespace components {
@@ -53,14 +53,14 @@ namespace hmi_commands_test {
namespace tts_is_ready_response {
using ::testing::_;
-using ::testing::Return;
using ::testing::NiceMock;
+using ::testing::Return;
namespace am = ::application_manager;
namespace strings = ::application_manager::strings;
namespace hmi_response = am::hmi_response;
+using am::commands::CommandImpl;
using application_manager::commands::ResponseFromHMI;
using sdl_rpc_plugin::commands::TTSIsReadyResponse;
-using am::commands::CommandImpl;
using test::components::event_engine_test::MockEventDispatcher;
typedef std::shared_ptr<ResponseFromHMI> ResponseFromHMIPtr;
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_get_capabilities_response_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_get_capabilities_response_test.cc
index 31e4860d4a..4683fc62c7 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_get_capabilities_response_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_get_capabilities_response_test.cc
@@ -32,14 +32,14 @@
#include <stdint.h>
-#include "gtest/gtest.h"
-#include "smart_objects/smart_object.h"
-#include "interfaces/MOBILE_API.h"
+#include "application_manager/commands/command_impl.h"
+#include "application_manager/commands/commands_test.h"
#include "application_manager/mock_hmi_capabilities.h"
#include "application_manager/smart_object_keys.h"
-#include "application_manager/commands/commands_test.h"
-#include "application_manager/commands/command_impl.h"
+#include "gtest/gtest.h"
#include "hmi/ui_get_capabilities_response.h"
+#include "interfaces/MOBILE_API.h"
+#include "smart_objects/smart_object.h"
namespace test {
namespace components {
@@ -51,9 +51,9 @@ using ::testing::NiceMock;
namespace am = ::application_manager;
namespace strings = am::strings;
namespace hmi_response = am::hmi_response;
+using am::commands::CommandImpl;
using application_manager::commands::ResponseFromHMI;
using sdl_rpc_plugin::commands::UIGetCapabilitiesResponse;
-using am::commands::CommandImpl;
typedef std::shared_ptr<ResponseFromHMI> ResponseFromHMIPtr;
typedef NiceMock<
@@ -113,8 +113,9 @@ TEST_F(UIGetCapabilitiesResponseTest, SetSoftButton_SUCCESS) {
ResponseFromHMIPtr command(
CreateCommand<UIGetCapabilitiesResponse>(command_msg));
- smart_objects::SmartObject soft_button_capabilities_so = (*command_msg)
- [strings::msg_params][hmi_response::soft_button_capabilities];
+ smart_objects::SmartObject soft_button_capabilities_so =
+ (*command_msg)[strings::msg_params]
+ [hmi_response::soft_button_capabilities];
EXPECT_CALL(mock_hmi_capabilities_,
set_soft_button_capabilities(soft_button_capabilities_so));
@@ -144,16 +145,48 @@ TEST_F(UIGetCapabilitiesResponseTest, SetHmiZone_SUCCESS) {
TEST_F(UIGetCapabilitiesResponseTest, SetAudioPassThru_SUCCESS) {
MessageSharedPtr command_msg = CreateCommandMsg();
(*command_msg)[strings::msg_params][strings::audio_pass_thru_capabilities] =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
+
+ ResponseFromHMIPtr command(
+ CreateCommand<UIGetCapabilitiesResponse>(command_msg));
+
+ smart_objects::SmartObject audio_pass_thru_capabilities_so =
+ (*command_msg)[strings::msg_params]
+ [strings::audio_pass_thru_capabilities];
+
+ // hmi_capabilities will receive a list of capabilities, the first element
+ // being audio_pass_thru_capabilities_so
+ smart_objects::SmartObject audio_pass_thru_capabilities_list_so =
+ smart_objects::SmartObject(smart_objects::SmartType_Array);
+ audio_pass_thru_capabilities_list_so[0] = audio_pass_thru_capabilities_so;
+ EXPECT_CALL(
+ mock_hmi_capabilities_,
+ set_audio_pass_thru_capabilities(audio_pass_thru_capabilities_list_so));
+
+ command->Run();
+}
+
+TEST_F(UIGetCapabilitiesResponseTest, SetAudioPassThruList_SUCCESS) {
+ MessageSharedPtr command_msg = CreateCommandMsg();
+
+ // if both audioPassThruCapabilities and audioPassThruCapabilitiesList are
+ // supplied, audioPassThruCapabilitiesList should be used
+ smart_objects::SmartObject audio_pass_thru_capabilities_so =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
+ smart_objects::SmartObject audio_pass_thru_capabilities_list_so =
smart_objects::SmartObject(smart_objects::SmartType_Array);
+ (*command_msg)[strings::msg_params][strings::audio_pass_thru_capabilities] =
+ audio_pass_thru_capabilities_so;
+ (*command_msg)[strings::msg_params]
+ [strings::audio_pass_thru_capabilities_list] =
+ audio_pass_thru_capabilities_list_so;
ResponseFromHMIPtr command(
CreateCommand<UIGetCapabilitiesResponse>(command_msg));
- smart_objects::SmartObject audio_pass_thru_capabilities_so = (*command_msg)
- [strings::msg_params][strings::audio_pass_thru_capabilities];
EXPECT_CALL(
mock_hmi_capabilities_,
- set_audio_pass_thru_capabilities(audio_pass_thru_capabilities_so));
+ set_audio_pass_thru_capabilities(audio_pass_thru_capabilities_list_so));
command->Run();
}
@@ -277,7 +310,7 @@ TEST_F(UIGetCapabilitiesResponseTest, SetVideoStreamingCapability_SUCCESS) {
video_streaming_capability[strings::preferred_resolution]
[strings::resolution_width] = 800;
video_streaming_capability[strings::preferred_resolution]
- [strings::resolution_height] = 350;
+ [strings::resolution_height] = 354;
video_streaming_capability[strings::max_bitrate] = 10000;
@@ -295,6 +328,12 @@ TEST_F(UIGetCapabilitiesResponseTest, SetVideoStreamingCapability_SUCCESS) {
video_streaming_capability[strings::haptic_spatial_data_supported] = true;
+ video_streaming_capability[strings::diagonal_screen_size] = 7.47;
+
+ video_streaming_capability[strings::pixel_per_inch] = 117.f;
+
+ video_streaming_capability[strings::scale] = 1.f;
+
ResponseFromHMIPtr command(
CreateCommand<UIGetCapabilitiesResponse>(command_msg));
@@ -304,6 +343,25 @@ TEST_F(UIGetCapabilitiesResponseTest, SetVideoStreamingCapability_SUCCESS) {
command->Run();
}
+TEST_F(UIGetCapabilitiesResponseTest, SetSystemDisplayCapabilities_SUCCESS) {
+ MessageSharedPtr command_msg = CreateCommandMsg();
+ (*command_msg)[strings::msg_params][strings::system_capabilities] =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
+
+ ResponseFromHMIPtr command(
+ CreateCommand<UIGetCapabilitiesResponse>(command_msg));
+
+ const auto& display_capability_so =
+ (*command_msg)[strings::msg_params][strings::system_capabilities]
+ [strings::display_capabilities];
+
+ EXPECT_CALL(mock_hmi_capabilities_,
+ set_system_display_capabilities(display_capability_so));
+
+ ASSERT_TRUE(command->Init());
+ command->Run();
+}
+
} // namespace ui_get_capabilities_response
} // namespace hmi_commands_test
} // namespace commands_test
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_get_language_response_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_get_language_response_test.cc
index de69c5de5c..7e8040543d 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_get_language_response_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_get_language_response_test.cc
@@ -30,13 +30,13 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include "gtest/gtest.h"
#include "hmi/ui_get_language_response.h"
-#include "application_manager/smart_object_keys.h"
#include "application_manager/commands/commands_test.h"
-#include "application_manager/mock_hmi_capabilities.h"
-#include "application_manager/mock_event_dispatcher.h"
#include "application_manager/mock_application_manager.h"
+#include "application_manager/mock_event_dispatcher.h"
+#include "application_manager/mock_hmi_capabilities.h"
+#include "application_manager/smart_object_keys.h"
+#include "gtest/gtest.h"
namespace test {
namespace components {
@@ -47,8 +47,8 @@ namespace ui_get_language_response {
using sdl_rpc_plugin::commands::UIGetLanguageResponse;
using test::components::event_engine_test::MockEventDispatcher;
using testing::_;
-using testing::ReturnRef;
using ::testing::NiceMock;
+using testing::ReturnRef;
namespace strings = application_manager::strings;
namespace hmi_response = application_manager::hmi_response;
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_get_supported_languages_response_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_get_supported_languages_response_test.cc
index 5626e2b0ee..10cf244bcf 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_get_supported_languages_response_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_get_supported_languages_response_test.cc
@@ -33,15 +33,15 @@
#include <stdint.h>
#include <string>
-#include "gtest/gtest.h"
-#include "smart_objects/smart_object.h"
-#include "application_manager/smart_object_keys.h"
#include "application_manager/application.h"
#include "application_manager/commands/commands_test.h"
-#include "application_manager/mock_hmi_capabilities.h"
#include "application_manager/mock_application_manager.h"
-#include "hmi/ui_get_supported_languages_response.h"
+#include "application_manager/mock_hmi_capabilities.h"
#include "application_manager/policies/mock_policy_handler_interface.h"
+#include "application_manager/smart_object_keys.h"
+#include "gtest/gtest.h"
+#include "hmi/ui_get_supported_languages_response.h"
+#include "smart_objects/smart_object.h"
namespace test {
namespace components {
@@ -49,8 +49,8 @@ namespace commands_test {
namespace hmi_commands_test {
namespace ui_get_supported_languages_response {
-using ::testing::Return;
using ::testing::NiceMock;
+using ::testing::Return;
namespace am = ::application_manager;
namespace strings = ::application_manager::strings;
namespace hmi_response = am::hmi_response;
@@ -107,7 +107,8 @@ TEST_F(UIGetSupportedLanguagesResponseTest, RUN_UNSUCCESS) {
CreateCommand<UIGetSupportedLanguagesResponse>(command_msg));
EXPECT_CALL(mock_hmi_capabilities_,
- set_ui_supported_languages(supported_languages)).Times(0);
+ set_ui_supported_languages(supported_languages))
+ .Times(0);
command->Run();
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_is_ready_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_is_ready_request_test.cc
index 70fc80bbd1..837b8438dc 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_is_ready_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_is_ready_request_test.cc
@@ -34,16 +34,16 @@
#include "gtest/gtest.h"
-#include "smart_objects/smart_object.h"
-#include "application_manager/smart_object_keys.h"
#include "application_manager/commands/command_request_test.h"
-#include "application_manager/mock_application_manager.h"
+#include "application_manager/event_engine/event.h"
#include "application_manager/hmi_interfaces.h"
-#include "application_manager/mock_hmi_interface.h"
+#include "application_manager/mock_application_manager.h"
#include "application_manager/mock_hmi_capabilities.h"
-#include "application_manager/policies/mock_policy_handler_interface.h"
+#include "application_manager/mock_hmi_interface.h"
#include "application_manager/mock_message_helper.h"
-#include "application_manager/event_engine/event.h"
+#include "application_manager/policies/mock_policy_handler_interface.h"
+#include "application_manager/smart_object_keys.h"
+#include "smart_objects/smart_object.h"
namespace test {
namespace components {
@@ -53,12 +53,12 @@ namespace ui_is_ready_request {
namespace am = ::application_manager;
+using am::commands::MessageSharedPtr;
+using am::event_engine::Event;
+using sdl_rpc_plugin::commands::UIIsReadyRequest;
using ::testing::_;
using ::testing::Return;
using ::testing::ReturnRef;
-using am::commands::MessageSharedPtr;
-using sdl_rpc_plugin::commands::UIIsReadyRequest;
-using am::event_engine::Event;
typedef std::shared_ptr<UIIsReadyRequest> UIIsReadyRequestPtr;
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_is_ready_response_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_is_ready_response_test.cc
index cccdbdc44d..44b9504055 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_is_ready_response_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_is_ready_response_test.cc
@@ -33,12 +33,12 @@
#include <stdint.h>
#include <string>
-#include "gtest/gtest.h"
-#include "smart_objects/smart_object.h"
#include "application_manager/commands/commands_test.h"
+#include "application_manager/mock_event_dispatcher.h"
#include "application_manager/mock_hmi_capabilities.h"
+#include "gtest/gtest.h"
#include "hmi/ui_is_ready_response.h"
-#include "application_manager/mock_event_dispatcher.h"
+#include "smart_objects/smart_object.h"
namespace test {
namespace components {
@@ -46,8 +46,8 @@ namespace commands_test {
namespace hmi_commands_test {
namespace ui_is_ready_response {
-using ::testing::Return;
using ::testing::NiceMock;
+using ::testing::Return;
namespace am = ::application_manager;
namespace strings = ::application_manager::strings;
namespace hmi_response = am::hmi_response;
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/update_device_list_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/update_device_list_request_test.cc
index c566702998..31c03a7ed5 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/update_device_list_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/update_device_list_request_test.cc
@@ -32,20 +32,20 @@
#include <stdint.h>
-#include "gtest/gtest.h"
-#include "smart_objects/smart_object.h"
-#include "interfaces/HMI_API.h"
-#include "application_manager/smart_object_keys.h"
-#include "application_manager/commands/commands_test.h"
-#include "application_manager/commands/command_impl.h"
#include "application_manager/application_manager.h"
#include "application_manager/application_manager_impl.h"
-#include "application_manager/mock_event_dispatcher.h"
-#include "application_manager/mock_application.h"
+#include "application_manager/commands/command_impl.h"
+#include "application_manager/commands/commands_test.h"
#include "application_manager/event_engine/event.h"
-#include "application_manager/request_controller_settings.h"
+#include "application_manager/mock_application.h"
#include "application_manager/mock_application_manager_settings.h"
+#include "application_manager/mock_event_dispatcher.h"
+#include "application_manager/request_controller_settings.h"
+#include "application_manager/smart_object_keys.h"
+#include "gtest/gtest.h"
#include "hmi/update_device_list_request.h"
+#include "interfaces/HMI_API.h"
+#include "smart_objects/smart_object.h"
namespace test {
namespace components {
@@ -53,18 +53,18 @@ namespace commands_test {
namespace hmi_commands_test {
namespace update_device_list_request {
-using testing::_;
-using testing::ReturnRef;
-using testing::Return;
-using test::components::event_engine_test::MockEventDispatcher;
using ::test::components::application_manager_test::
MockApplicationManagerSettings;
+using test::components::event_engine_test::MockEventDispatcher;
+using testing::_;
+using testing::Return;
+using testing::ReturnRef;
namespace am = ::application_manager;
namespace strings = am::strings;
namespace hmi_response = am::hmi_response;
+using am::commands::CommandImpl;
using am::event_engine::Event;
using sdl_rpc_plugin::commands::UpdateDeviceListRequest;
-using am::commands::CommandImpl;
typedef std::shared_ptr<UpdateDeviceListRequest> UpdateDeviceListRequestPtr;
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/update_sdl_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/update_sdl_request_test.cc
index af3b9bebf6..96f3b38fbf 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/update_sdl_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/update_sdl_request_test.cc
@@ -33,13 +33,13 @@
#include <stdint.h>
#include <string>
-#include "gtest/gtest.h"
-#include "smart_objects/smart_object.h"
-#include "application_manager/smart_object_keys.h"
-#include "application_manager/commands/commands_test.h"
#include "application_manager/application.h"
+#include "application_manager/commands/commands_test.h"
#include "application_manager/policies/mock_policy_handler_interface.h"
+#include "application_manager/smart_object_keys.h"
+#include "gtest/gtest.h"
#include "hmi/update_sdl_request.h"
+#include "smart_objects/smart_object.h"
namespace test {
namespace components {
@@ -47,8 +47,8 @@ namespace commands_test {
namespace hmi_commands_test {
namespace update_sdl_request {
-using ::testing::ReturnRef;
using ::testing::NiceMock;
+using ::testing::ReturnRef;
namespace am = ::application_manager;
namespace strings = ::application_manager::strings;
using sdl_rpc_plugin::commands::UpdateSDLRequest;
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/update_sdl_response_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/update_sdl_response_test.cc
index 93c49724ce..62ffc6be4d 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/update_sdl_response_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/update_sdl_response_test.cc
@@ -33,12 +33,12 @@
#include <stdint.h>
#include <string>
-#include "gtest/gtest.h"
-#include "smart_objects/smart_object.h"
-#include "application_manager/smart_object_keys.h"
-#include "application_manager/commands/commands_test.h"
#include "application_manager/application.h"
+#include "application_manager/commands/commands_test.h"
+#include "application_manager/smart_object_keys.h"
+#include "gtest/gtest.h"
#include "hmi/update_sdl_response.h"
+#include "smart_objects/smart_object.h"
namespace test {
namespace components {
@@ -48,8 +48,8 @@ namespace update_sdl_response {
namespace am = ::application_manager;
namespace strings = ::application_manager::strings;
-using sdl_rpc_plugin::commands::UpdateSDLResponse;
using am::commands::CommandImpl;
+using sdl_rpc_plugin::commands::UpdateSDLResponse;
typedef std::shared_ptr<UpdateSDLResponse> UpdateSDLResponsePtr;
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_get_capabilities_response_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_get_capabilities_response_test.cc
index 15d38d4ef3..21acf2bb70 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_get_capabilities_response_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_get_capabilities_response_test.cc
@@ -32,14 +32,14 @@
#include <stdint.h>
-#include "gtest/gtest.h"
-#include "smart_objects/smart_object.h"
-#include "interfaces/MOBILE_API.h"
+#include "application_manager/commands/command_impl.h"
+#include "application_manager/commands/commands_test.h"
#include "application_manager/mock_hmi_capabilities.h"
#include "application_manager/smart_object_keys.h"
-#include "application_manager/commands/commands_test.h"
-#include "application_manager/commands/command_impl.h"
+#include "gtest/gtest.h"
#include "hmi/vr_get_capabilities_response.h"
+#include "interfaces/MOBILE_API.h"
+#include "smart_objects/smart_object.h"
namespace test {
namespace components {
@@ -51,8 +51,8 @@ using ::testing::NiceMock;
namespace am = ::application_manager;
namespace strings = am::strings;
namespace hmi_response = am::hmi_response;
-using sdl_rpc_plugin::commands::VRGetCapabilitiesResponse;
using am::commands::CommandImpl;
+using sdl_rpc_plugin::commands::VRGetCapabilitiesResponse;
typedef std::shared_ptr<VRGetCapabilitiesResponse> VRGetCapabilitiesResponsePtr;
typedef NiceMock<
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_get_language_response_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_get_language_response_test.cc
index 05ed186963..8b00b4dded 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_get_language_response_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_get_language_response_test.cc
@@ -30,13 +30,13 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include "gtest/gtest.h"
#include "hmi/vr_get_language_response.h"
-#include "application_manager/smart_object_keys.h"
#include "application_manager/commands/commands_test.h"
-#include "application_manager/mock_hmi_capabilities.h"
-#include "application_manager/mock_event_dispatcher.h"
#include "application_manager/mock_application_manager.h"
+#include "application_manager/mock_event_dispatcher.h"
+#include "application_manager/mock_hmi_capabilities.h"
+#include "application_manager/smart_object_keys.h"
+#include "gtest/gtest.h"
namespace test {
namespace components {
@@ -47,8 +47,8 @@ namespace vr_get_language_response {
using sdl_rpc_plugin::commands::VRGetLanguageResponse;
using test::components::event_engine_test::MockEventDispatcher;
using testing::_;
-using testing::ReturnRef;
using ::testing::NiceMock;
+using testing::ReturnRef;
namespace strings = application_manager::strings;
namespace hmi_response = application_manager::hmi_response;
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_get_supported_languages_response_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_get_supported_languages_response_test.cc
index 56b11ad440..b81823624c 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_get_supported_languages_response_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_get_supported_languages_response_test.cc
@@ -33,15 +33,15 @@
#include <stdint.h>
#include <string>
-#include "gtest/gtest.h"
-#include "smart_objects/smart_object.h"
-#include "application_manager/smart_object_keys.h"
#include "application_manager/application.h"
#include "application_manager/commands/commands_test.h"
-#include "application_manager/mock_hmi_capabilities.h"
#include "application_manager/mock_application_manager.h"
-#include "hmi/vr_get_supported_languages_response.h"
+#include "application_manager/mock_hmi_capabilities.h"
#include "application_manager/policies/mock_policy_handler_interface.h"
+#include "application_manager/smart_object_keys.h"
+#include "gtest/gtest.h"
+#include "hmi/vr_get_supported_languages_response.h"
+#include "smart_objects/smart_object.h"
namespace test {
namespace components {
@@ -49,8 +49,8 @@ namespace commands_test {
namespace hmi_commands_test {
namespace vr_get_supported_languages_response {
-using ::testing::Return;
using ::testing::NiceMock;
+using ::testing::Return;
namespace am = ::application_manager;
namespace strings = ::application_manager::strings;
namespace hmi_response = am::hmi_response;
@@ -107,7 +107,8 @@ TEST_F(VRGetSupportedLanguagesResponseTest, RUN_UNSUCCESS) {
CreateCommand<VRGetSupportedLanguagesResponse>(command_msg));
EXPECT_CALL(mock_hmi_capabilities_,
- set_vr_supported_languages(supported_languages)).Times(0);
+ set_vr_supported_languages(supported_languages))
+ .Times(0);
command->Run();
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_is_ready_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_is_ready_request_test.cc
index 259fd0b92b..9bb8e4c2d5 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_is_ready_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_is_ready_request_test.cc
@@ -34,15 +34,15 @@
#include "gtest/gtest.h"
-#include "smart_objects/smart_object.h"
-#include "application_manager/smart_object_keys.h"
#include "application_manager/commands/command_request_test.h"
-#include "application_manager/mock_application_manager.h"
+#include "application_manager/event_engine/event.h"
#include "application_manager/hmi_interfaces.h"
-#include "application_manager/mock_hmi_interface.h"
+#include "application_manager/mock_application_manager.h"
#include "application_manager/mock_hmi_capabilities.h"
+#include "application_manager/mock_hmi_interface.h"
#include "application_manager/mock_message_helper.h"
-#include "application_manager/event_engine/event.h"
+#include "application_manager/smart_object_keys.h"
+#include "smart_objects/smart_object.h"
namespace test {
namespace components {
@@ -54,8 +54,8 @@ using ::testing::_;
using ::testing::ReturnRef;
namespace am = ::application_manager;
using am::commands::MessageSharedPtr;
-using sdl_rpc_plugin::commands::VRIsReadyRequest;
using am::event_engine::Event;
+using sdl_rpc_plugin::commands::VRIsReadyRequest;
typedef std::shared_ptr<VRIsReadyRequest> VRIsReadyRequestPtr;
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_is_ready_response_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_is_ready_response_test.cc
index 0e56f5b483..8b7b0a94f4 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_is_ready_response_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_is_ready_response_test.cc
@@ -33,12 +33,12 @@
#include <stdint.h>
#include <string>
-#include "gtest/gtest.h"
-#include "smart_objects/smart_object.h"
#include "application_manager/commands/commands_test.h"
+#include "application_manager/mock_event_dispatcher.h"
#include "application_manager/mock_hmi_capabilities.h"
+#include "gtest/gtest.h"
#include "hmi/vr_is_ready_response.h"
-#include "application_manager/mock_event_dispatcher.h"
+#include "smart_objects/smart_object.h"
namespace test {
namespace components {
@@ -46,8 +46,8 @@ namespace commands_test {
namespace hmi_commands_test {
namespace vr_is_ready_response {
-using ::testing::Return;
using ::testing::NiceMock;
+using ::testing::Return;
namespace am = ::application_manager;
namespace strings = ::application_manager::strings;
namespace hmi_response = am::hmi_response;
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/add_command_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/add_command_request_test.cc
index 0023368b5a..b11312eb33 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/add_command_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/add_command_request_test.cc
@@ -32,8 +32,8 @@
#include <stdint.h>
#include <memory>
-#include <string>
#include <set>
+#include <string>
#include "mobile/add_command_request.h"
@@ -41,16 +41,16 @@
#include "utils/helpers.h"
-#include "smart_objects/smart_object.h"
-#include "utils/custom_string.h"
#include "application_manager/commands/command_request_test.h"
-#include "application_manager/smart_object_keys.h"
+#include "application_manager/event_engine/event.h"
#include "application_manager/mock_application.h"
#include "application_manager/mock_application_manager.h"
-#include "application_manager/mock_message_helper.h"
-#include "application_manager/event_engine/event.h"
-#include "application_manager/mock_hmi_interface.h"
#include "application_manager/mock_help_prompt_manager.h"
+#include "application_manager/mock_hmi_interface.h"
+#include "application_manager/mock_message_helper.h"
+#include "application_manager/smart_object_keys.h"
+#include "smart_objects/smart_object.h"
+#include "utils/custom_string.h"
namespace test {
namespace components {
@@ -60,17 +60,17 @@ namespace add_command_request {
namespace am = application_manager;
namespace am_test = application_manager_test;
-using am::commands::CommandImpl;
using am::ApplicationManager;
-using am::commands::MessageSharedPtr;
using am::ApplicationSharedPtr;
-using ::testing::_;
-using ::testing::Return;
-using ::testing::InSequence;
-using sdl_rpc_plugin::commands::AddCommandRequest;
+using am::commands::CommandImpl;
+using am::commands::MessageSharedPtr;
+using am::event_engine::EventObserver;
using ns_smart_device_link::ns_smart_objects::SmartObjectSPtr;
+using sdl_rpc_plugin::commands::AddCommandRequest;
using ::test::components::application_manager_test::MockApplication;
-using am::event_engine::EventObserver;
+using ::testing::_;
+using ::testing::InSequence;
+using ::testing::Return;
using namespace smart_objects;
namespace custom_str = utils::custom_string;
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/add_sub_menu_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/add_sub_menu_request_test.cc
index ecaa436529..a88a1ade69 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/add_sub_menu_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/add_sub_menu_request_test.cc
@@ -35,14 +35,14 @@
#include "mobile/add_sub_menu_request.h"
-#include "gtest/gtest.h"
-#include "application_manager/commands/commands_test.h"
#include "application_manager/commands/command_request_test.h"
-#include "application_manager/mock_application_manager.h"
-#include "application_manager/mock_application.h"
-#include "application_manager/mock_message_helper.h"
+#include "application_manager/commands/commands_test.h"
#include "application_manager/event_engine/event.h"
+#include "application_manager/mock_application.h"
+#include "application_manager/mock_application_manager.h"
#include "application_manager/mock_hmi_interface.h"
+#include "application_manager/mock_message_helper.h"
+#include "gtest/gtest.h"
namespace test {
namespace components {
@@ -51,9 +51,9 @@ namespace mobile_commands_test {
namespace add_sub_menu_request {
namespace am = ::application_manager;
-using sdl_rpc_plugin::commands::AddSubMenuRequest;
using am::commands::MessageSharedPtr;
using am::event_engine::Event;
+using sdl_rpc_plugin::commands::AddSubMenuRequest;
using ::testing::_;
using ::testing::Return;
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/alert_maneuver_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/alert_maneuver_request_test.cc
index 7d2dd0b2c2..e726616345 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/alert_maneuver_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/alert_maneuver_request_test.cc
@@ -35,20 +35,20 @@
#include "gtest/gtest.h"
-#include "smart_objects/smart_object.h"
-#include "application_manager/smart_object_keys.h"
-#include "application_manager/commands/commands_test.h"
-#include "application_manager/commands/command_request_test.h"
#include "application_manager/application.h"
-#include "application_manager/mock_application_manager.h"
+#include "application_manager/commands/command_request_test.h"
+#include "application_manager/commands/commands_test.h"
+#include "application_manager/event_engine/event.h"
#include "application_manager/mock_application.h"
+#include "application_manager/mock_application_manager.h"
+#include "application_manager/mock_hmi_interface.h"
#include "application_manager/mock_message_helper.h"
-#include "application_manager/event_engine/event.h"
-#include "mobile/alert_maneuver_request.h"
-#include "interfaces/MOBILE_API.h"
-#include "application_manager/policies/policy_handler_interface.h"
#include "application_manager/policies/mock_policy_handler_interface.h"
-#include "application_manager/mock_hmi_interface.h"
+#include "application_manager/policies/policy_handler_interface.h"
+#include "application_manager/smart_object_keys.h"
+#include "interfaces/MOBILE_API.h"
+#include "mobile/alert_maneuver_request.h"
+#include "smart_objects/smart_object.h"
namespace test {
namespace components {
@@ -60,9 +60,9 @@ using ::testing::_;
using ::testing::Return;
using ::testing::ReturnRef;
namespace am = ::application_manager;
-using sdl_rpc_plugin::commands::AlertManeuverRequest;
using am::commands::MessageSharedPtr;
using am::event_engine::Event;
+using sdl_rpc_plugin::commands::AlertManeuverRequest;
typedef std::shared_ptr<AlertManeuverRequest> CommandPtr;
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/alert_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/alert_request_test.cc
index a66d0d557f..dc7731bfc8 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/alert_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/alert_request_test.cc
@@ -31,19 +31,19 @@
*/
#include <stdint.h>
-#include <string>
#include <set>
+#include <string>
#include "mobile/alert_request.h"
-#include "gtest/gtest.h"
#include "application_manager/commands/command_request_test.h"
+#include "application_manager/event_engine/event.h"
#include "application_manager/mock_application.h"
#include "application_manager/mock_application_manager.h"
-#include "application_manager/mock_message_helper.h"
-#include "application_manager/event_engine/event.h"
#include "application_manager/mock_hmi_interface.h"
+#include "application_manager/mock_message_helper.h"
#include "application_manager/policies/mock_policy_handler_interface.h"
+#include "gtest/gtest.h"
namespace test {
namespace components {
@@ -52,12 +52,12 @@ namespace mobile_commands_test {
namespace alert_request {
namespace am = application_manager;
-using sdl_rpc_plugin::commands::AlertRequest;
+using am::MockMessageHelper;
using am::commands::CommandImpl;
using am::commands::MessageSharedPtr;
-using am::MockMessageHelper;
using am::event_engine::Event;
using policy_test::MockPolicyHandlerInterface;
+using sdl_rpc_plugin::commands::AlertRequest;
using ::testing::_;
using ::testing::Return;
using ::testing::ReturnRef;
@@ -73,6 +73,8 @@ const uint32_t kDefaultTimeout = 1000u;
const uint32_t kCorrelationId = 2u;
const mobile_apis::FunctionID::eType kFunctionId =
mobile_apis::FunctionID::AlertID;
+const am::WindowID kDefaultWindowId =
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW;
} // namespace
class AlertRequestTest : public CommandRequestTest<CommandsTestMocks::kIsNice> {
@@ -138,9 +140,9 @@ class AlertRequestTest : public CommandRequestTest<CommandsTestMocks::kIsNice> {
*mock_app_,
AreCommandLimitsExceeded(kFunctionId, am::TLimitSource::POLICY_TABLE))
.WillByDefault(Return(false));
- ON_CALL(*mock_app_, hmi_level())
+ ON_CALL(*mock_app_, hmi_level(kDefaultWindowId))
.WillByDefault(Return(mobile_apis::HMILevel::HMI_FULL));
- ON_CALL(*mock_app_, hmi_level())
+ ON_CALL(*mock_app_, hmi_level(kDefaultWindowId))
.WillByDefault(Return(mobile_apis::HMILevel::HMI_BACKGROUND));
}
@@ -155,7 +157,8 @@ class AlertRequestTest : public CommandRequestTest<CommandsTestMocks::kIsNice> {
}
void ExpectCallHmiLevel(const mobile_apis::HMILevel::eType level) {
- EXPECT_CALL(*mock_app_, hmi_level()).WillRepeatedly(Return(level));
+ EXPECT_CALL(*mock_app_, hmi_level(kDefaultWindowId))
+ .WillRepeatedly(Return(level));
}
void ExpectManageMobileCommandWithResultCode(
@@ -477,9 +480,10 @@ TEST_F(AlertRequestTest, DISABLED_OnEvent_TTSWarnings_SUCCESS) {
(*msg_)[am::strings::msg_params][am::strings::tts_chunks], _, _))
.WillOnce(Return(mobile_apis::Result::SUCCESS));
- EXPECT_CALL(mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::TTS_Speak),
- _)).WillOnce(Return(true));
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::TTS_Speak), _))
+ .WillOnce(Return(true));
CommandPtr command(CreateCommand<AlertRequest>(msg_));
command->Run();
@@ -508,9 +512,10 @@ TEST_F(AlertRequestTest, DISABLED_OnEvent_TTSUnsupportedResource_SUCCESS) {
VerifyTtsFiles(
(*msg_)[am::strings::msg_params][am::strings::tts_chunks], _, _))
.WillOnce(Return(mobile_apis::Result::SUCCESS));
- EXPECT_CALL(mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::TTS_Speak),
- _)).WillOnce(Return(true));
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::TTS_Speak), _))
+ .WillOnce(Return(true));
CommandPtr command(CreateCommand<AlertRequest>(msg_));
command->Run();
@@ -641,9 +646,10 @@ TEST_F(AlertRequestTest, OnEvent_TTSSuccesUiAlertInvalidEnum_SUCCESS) {
VerifyTtsFiles(
(*msg_)[am::strings::msg_params][am::strings::tts_chunks], _, _))
.WillOnce(Return(mobile_apis::Result::SUCCESS));
- EXPECT_CALL(mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::TTS_Speak),
- _)).WillOnce(Return(true));
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::TTS_Speak), _))
+ .WillOnce(Return(true));
CommandPtr command(CreateCommand<AlertRequest>(msg_));
command->Run();
@@ -690,9 +696,10 @@ TEST_F(AlertRequestTest, DISABLED_OnEvent_TTSAbortedUiAlertNotSent_SUCCESS) {
VerifyTtsFiles(
(*msg_)[am::strings::msg_params][am::strings::tts_chunks], _, _))
.WillOnce(Return(mobile_apis::Result::SUCCESS));
- EXPECT_CALL(mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::TTS_Speak),
- _)).WillOnce(Return(true));
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::TTS_Speak), _))
+ .WillOnce(Return(true));
CommandPtr command(CreateCommand<AlertRequest>(msg_));
command->Run();
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/change_registration_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/change_registration_test.cc
index 58755c8b36..4394c6fe5e 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/change_registration_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/change_registration_test.cc
@@ -31,25 +31,25 @@
*/
#include <stdint.h>
-#include <string>
#include <set>
+#include <string>
#include "mobile/change_registration_request.h"
-#include "gtest/gtest.h"
-#include "utils/helpers.h"
-#include "utils/custom_string.h"
-#include "smart_objects/smart_object.h"
#include "application_manager/commands/command_request_test.h"
-#include "application_manager/smart_object_keys.h"
-#include "policy/policy_regular/policy/usage_statistics/mock_statistics_manager.h"
+#include "application_manager/event_engine/event.h"
#include "application_manager/mock_application.h"
#include "application_manager/mock_application_manager.h"
-#include "application_manager/mock_message_helper.h"
#include "application_manager/mock_hmi_capabilities.h"
-#include "application_manager/event_engine/event.h"
#include "application_manager/mock_hmi_interface.h"
+#include "application_manager/mock_message_helper.h"
#include "application_manager/policies/mock_policy_handler_interface.h"
+#include "application_manager/smart_object_keys.h"
+#include "gtest/gtest.h"
+#include "policy/policy_regular/policy/usage_statistics/mock_statistics_manager.h"
+#include "smart_objects/smart_object.h"
+#include "utils/custom_string.h"
+#include "utils/helpers.h"
namespace test {
namespace components {
@@ -58,18 +58,18 @@ namespace mobile_commands_test {
namespace change_registration_request {
namespace am = application_manager;
-using am::commands::CommandImpl;
using am::ApplicationManager;
-using am::commands::MessageSharedPtr;
using am::ApplicationSharedPtr;
using am::MockMessageHelper;
+using am::commands::CommandImpl;
+using am::commands::MessageSharedPtr;
+using policy_test::MockPolicyHandlerInterface;
+using sdl_rpc_plugin::commands::ChangeRegistrationRequest;
+using ::test::components::application_manager_test::MockApplication;
using ::testing::_;
using ::testing::Return;
using ::testing::ReturnRef;
using ::testing::SetArgPointee;
-using sdl_rpc_plugin::commands::ChangeRegistrationRequest;
-using policy_test::MockPolicyHandlerInterface;
-using ::test::components::application_manager_test::MockApplication;
namespace custom_str = utils::custom_string;
namespace strings = ::application_manager::strings;
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/create_interaction_choice_set_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/create_interaction_choice_set_test.cc
index 3abda89234..73a0008624 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/create_interaction_choice_set_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/create_interaction_choice_set_test.cc
@@ -31,24 +31,24 @@
*/
#include <stdint.h>
-#include <string>
#include <set>
+#include <string>
#include "mobile/create_interaction_choice_set_request.h"
#include "mobile/create_interaction_choice_set_response.h"
-#include "gtest/gtest.h"
-#include "utils/helpers.h"
-#include "smart_objects/smart_object.h"
-#include "utils/custom_string.h"
#include "application_manager/commands/command_request_test.h"
-#include "application_manager/smart_object_keys.h"
+#include "application_manager/event_engine/event.h"
#include "application_manager/mock_application.h"
#include "application_manager/mock_application_manager.h"
-#include "application_manager/mock_message_helper.h"
-#include "application_manager/event_engine/event.h"
-#include "application_manager/mock_hmi_interface.h"
#include "application_manager/mock_hmi_capabilities.h"
+#include "application_manager/mock_hmi_interface.h"
+#include "application_manager/mock_message_helper.h"
+#include "application_manager/smart_object_keys.h"
+#include "gtest/gtest.h"
+#include "smart_objects/smart_object.h"
+#include "utils/custom_string.h"
+#include "utils/helpers.h"
namespace test {
namespace components {
@@ -57,18 +57,18 @@ namespace mobile_commands_test {
namespace create_interaction_choice_set_request {
namespace am = application_manager;
-using am::commands::CommandImpl;
using am::ApplicationManager;
-using am::commands::MessageSharedPtr;
using am::ApplicationSharedPtr;
using am::MockMessageHelper;
-using ::testing::_;
-using ::testing::Return;
-using ::testing::ReturnRef;
-using ::testing::AtLeast;
+using am::commands::CommandImpl;
+using am::commands::MessageSharedPtr;
using sdl_rpc_plugin::commands::CreateInteractionChoiceSetRequest;
using sdl_rpc_plugin::commands::CreateInteractionChoiceSetResponse;
using ::test::components::application_manager_test::MockApplication;
+using ::testing::_;
+using ::testing::AtLeast;
+using ::testing::Return;
+using ::testing::ReturnRef;
namespace custom_str = utils::custom_string;
namespace strings = ::application_manager::strings;
@@ -920,4 +920,4 @@ TEST_F(CreateInteractionChoiceSetRequestTest, Run_ErrorFromHmiFalse_UNSUCCESS) {
} // namespace mobile_commands_test
} // namespace commands_test
} // namespace components
-} // namespace tests
+} // namespace test
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/create_window_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/create_window_request_test.cc
new file mode 100644
index 0000000000..905c6ceb72
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/create_window_request_test.cc
@@ -0,0 +1,460 @@
+/*
+ * Copyright (c) 2019, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <stdint.h>
+#include <memory>
+#include <set>
+#include <string>
+
+#include "mobile/create_window_request.h"
+
+#include "application_manager/commands/command_request_test.h"
+#include "application_manager/event_engine/event.h"
+#include "application_manager/hmi_state.h"
+#include "application_manager/mock_application.h"
+#include "application_manager/mock_application_manager.h"
+#include "application_manager/mock_hmi_interface.h"
+#include "application_manager/mock_message_helper.h"
+#include "application_manager/mock_state_controller.h"
+#include "gtest/gtest.h"
+#include "interfaces/MOBILE_API.h"
+
+namespace test {
+namespace components {
+namespace commands_test {
+namespace mobile_commands_test {
+namespace create_window_request {
+
+namespace am = application_manager;
+using am::MockMessageHelper;
+using am::commands::CommandImpl;
+using am::commands::MessageSharedPtr;
+using sdl_rpc_plugin::commands::CreateWindowRequest;
+using namespace mobile_apis::PredefinedWindows;
+using am::commands::Command;
+using application_manager::WindowID;
+using test::components::application_manager_test::MockStateController;
+using test::components::policy_test::MockPolicyHandlerInterface;
+using ::testing::_;
+using ::testing::Return;
+using ::testing::ReturnRef;
+
+namespace {
+const uint32_t kAppId = 1u;
+const uint32_t kConnectionKey = 2u;
+const int32_t kFunctionID = mobile_apis::FunctionID::CreateWindowID;
+const WindowID kTestWindowId = 12;
+const WindowID kDuplicateWindowID = 13;
+const char* const kWindowName = "WindowName";
+const utils::custom_string::CustomString kAppName("TestApp");
+} // namespace
+
+MATCHER_P2(CheckMessageToMobile, result_code, success, "") {
+ const bool is_success =
+ (*arg)[am::strings::msg_params][am::strings::success].asBool() == success;
+
+ const bool is_result_code_correct =
+ (*arg)[am::strings::msg_params][am::strings::result_code].asInt() ==
+ static_cast<int32_t>(result_code);
+ return is_success && is_result_code_correct;
+}
+
+class CreateWindowRequestTest
+ : public CommandRequestTest<CommandsTestMocks::kIsNice> {
+ public:
+ CreateWindowRequestTest() {
+ mock_app_ = CreateMockApp();
+ ON_CALL(app_mngr_, application(kConnectionKey))
+ .WillByDefault(Return(mock_app_));
+ }
+
+ protected:
+ MessageSharedPtr CreateMsgParams() {
+ auto msg = CreateMessage();
+ (*msg)[am::strings::params][am::strings::connection_key] = kConnectionKey;
+ (*msg)[am::strings::params][am::strings::function_id] = kFunctionID;
+ return msg;
+ }
+
+ void SetupHelperApplyWindowInitialState(const MockAppPtr& app,
+ const MessageSharedPtr& msg) {
+ am::HmiStatePtr state(new am::HmiState(app, app_mngr_));
+ const auto window_type = static_cast<mobile_apis::WindowType::eType>(
+ (*msg)[am::strings::msg_params][am::strings::window_type].asInt());
+ const auto window_id = static_cast<mobile_apis::WindowType::eType>(
+ (*msg)[am::strings::msg_params][am::strings::window_id].asInt());
+ const auto window_name =
+ (*msg)[am::strings::msg_params][am::strings::window_name].asString();
+
+ state->set_window_type(window_type);
+ state->set_hmi_level(mobile_apis::HMILevel::INVALID_ENUM);
+ state->set_audio_streaming_state(
+ mobile_apis::AudioStreamingState::INVALID_ENUM);
+ state->set_video_streaming_state(
+ mobile_apis::VideoStreamingState::INVALID_ENUM);
+ state->set_system_context(mobile_apis::SystemContext::INVALID_ENUM);
+ ApplicationSharedPtr AppPtr = app;
+ ON_CALL(app_mngr_,
+ CreateRegularState(AppPtr,
+ window_type,
+ mobile_apis::HMILevel::INVALID_ENUM,
+ mobile_apis::AudioStreamingState::INVALID_ENUM,
+ mobile_apis::VideoStreamingState::INVALID_ENUM,
+ mobile_apis::SystemContext::INVALID_ENUM))
+ .WillByDefault(Return(state));
+ ON_CALL(*mock_app_, SetInitialState(kTestWindowId, window_name, state))
+ .WillByDefault(Return());
+ ON_CALL(app_mngr_, state_controller())
+ .WillByDefault(ReturnRef(mock_state_controller));
+ ON_CALL(
+ mock_state_controller,
+ OnAppWindowAdded(
+ AppPtr, window_id, window_type, mobile_apis::HMILevel::HMI_NONE))
+ .WillByDefault(Return());
+ }
+
+ void SetUp() OVERRIDE {
+ using namespace application_manager;
+ display_capabilities_ = std::make_shared<smart_objects::SmartObject>(
+ smart_objects::SmartType_Array);
+
+ smart_objects::SmartObject window_type_supported(
+ smart_objects::SmartType_Array);
+
+ const uint32_t maximum_widgets_amount = 4;
+ smart_objects::SmartObject maximum_widgets(smart_objects::SmartType_Map);
+ maximum_widgets[strings::window_type] = mobile_apis::WindowType::WIDGET;
+ maximum_widgets[strings::maximum_number_of_windows] =
+ maximum_widgets_amount;
+
+ window_type_supported[window_type_supported.length()] = maximum_widgets;
+
+ (*display_capabilities_)[0][strings::window_type_supported] =
+ window_type_supported;
+
+ ON_CALL(*mock_app_, display_capabilities())
+ .WillByDefault(Return(display_capabilities_));
+
+ ON_CALL(mock_hmi_capabilities_, system_display_capabilities())
+ .WillByDefault(Return(display_capabilities_));
+
+ window_params_map_lock_ptr_ = std::make_shared<sync_primitives::Lock>();
+
+ DataAccessor<am::WindowParamsMap> window_params_map(
+ test_window_params_map_, window_params_map_lock_ptr_);
+ ON_CALL(*mock_app_, window_optional_params_map())
+ .WillByDefault(Return(window_params_map));
+ }
+
+ MockAppPtr mock_app_;
+ NiceMock<MockStateController> mock_state_controller;
+ std::shared_ptr<sync_primitives::Lock> window_params_map_lock_ptr_;
+ application_manager::WindowParamsMap test_window_params_map_;
+ smart_objects::SmartObjectSPtr display_capabilities_;
+};
+
+TEST_F(CreateWindowRequestTest, WindowID_ExpectDefaultWindowID) {
+ auto msg = CreateMsgParams();
+ const auto command = CreateCommand<CreateWindowRequest>(msg);
+ EXPECT_EQ(mobile_apis::PredefinedWindows::DEFAULT_WINDOW,
+ command->window_id());
+}
+
+TEST_F(CreateWindowRequestTest,
+ Run_AppDoesNotExist_ExpectAppNotRegisteredResponseToMobile) {
+ const auto result_code = mobile_apis::Result::APPLICATION_NOT_REGISTERED;
+ EXPECT_CALL(mock_rpc_service_,
+ ManageMobileCommand(CheckMessageToMobile(result_code, false),
+ Command::CommandSource::SOURCE_SDL))
+ .WillOnce(Return(true));
+ EXPECT_CALL(app_mngr_, application(kConnectionKey)).WillOnce(Return(nullptr));
+
+ auto msg = CreateMsgParams();
+ auto command = CreateCommand<CreateWindowRequest>(msg);
+ EXPECT_TRUE(command->Init());
+ command->Run();
+}
+
+TEST_F(CreateWindowRequestTest,
+ Run_WindowIDAlreadyExist_ExpectInvalidIDResponseToMobile) {
+ const auto result_code = mobile_apis::Result::INVALID_ID;
+ EXPECT_CALL(mock_rpc_service_,
+ ManageMobileCommand(CheckMessageToMobile(result_code, false),
+ Command::CommandSource::SOURCE_SDL))
+ .WillOnce(Return(true));
+ ON_CALL(*mock_app_, WindowIdExists(kTestWindowId))
+ .WillByDefault(Return(true));
+
+ auto msg = CreateMsgParams();
+ (*msg)[am::strings::msg_params][am::strings::window_id] = kTestWindowId;
+
+ auto command = CreateCommand<CreateWindowRequest>(msg);
+ EXPECT_TRUE(command->Init());
+ command->Run();
+}
+
+TEST_F(CreateWindowRequestTest,
+ Run_CreateWindowForMAINWindowType_ExpectInvalidDataResponseToMobile) {
+ const auto result_code = mobile_apis::Result::INVALID_DATA;
+ EXPECT_CALL(mock_rpc_service_,
+ ManageMobileCommand(CheckMessageToMobile(result_code, false),
+ Command::CommandSource::SOURCE_SDL))
+ .WillOnce(Return(true));
+ ON_CALL(*mock_app_, WindowIdExists(kTestWindowId))
+ .WillByDefault(Return(false));
+
+ auto msg = CreateMsgParams();
+ (*msg)[am::strings::msg_params][am::strings::window_id] = kTestWindowId;
+ (*msg)[am::strings::msg_params][am::strings::window_type] =
+ mobile_apis::WindowType::eType::MAIN;
+
+ auto command = CreateCommand<CreateWindowRequest>(msg);
+ EXPECT_TRUE(command->Init());
+ command->Run();
+}
+
+TEST_F(
+ CreateWindowRequestTest,
+ Run_DuplicateUpdatesFromNotExistingWindowId_ExpectInvalidDataResponseToMobile) {
+ const auto result_code = mobile_apis::Result::INVALID_DATA;
+ EXPECT_CALL(mock_rpc_service_,
+ ManageMobileCommand(CheckMessageToMobile(result_code, false),
+ Command::CommandSource::SOURCE_SDL))
+ .WillOnce(Return(true));
+ ON_CALL(*mock_app_, WindowIdExists(kTestWindowId))
+ .WillByDefault(Return(false));
+ ON_CALL(*mock_app_, WindowIdExists(kDuplicateWindowID))
+ .WillByDefault(Return(false));
+
+ auto msg = CreateMsgParams();
+ (*msg)[am::strings::msg_params][am::strings::window_id] = kTestWindowId;
+ (*msg)[am::strings::msg_params]
+ [am::strings::duplicate_updates_from_window_id] = kDuplicateWindowID;
+
+ auto command = CreateCommand<CreateWindowRequest>(msg);
+ EXPECT_TRUE(command->Init());
+ command->Run();
+}
+
+TEST_F(
+ CreateWindowRequestTest,
+ Run_DuplicateUpdatesFromExistingWindowId_ExpectUICreateWindowIsSentToHMI) {
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_CreateWindow),
+ Command::CommandSource::SOURCE_SDL_TO_HMI))
+ .WillOnce(Return(true));
+ ON_CALL(*mock_app_, WindowIdExists(kTestWindowId))
+ .WillByDefault(Return(false));
+ ON_CALL(*mock_app_, WindowIdExists(kDuplicateWindowID))
+ .WillByDefault(Return(true));
+ ON_CALL(*mock_app_, name()).WillByDefault(ReturnRef(kAppName));
+ ON_CALL(*mock_app_, GetWindowNames())
+ .WillByDefault(Return(std::vector<std::string>()));
+
+ auto msg = CreateMsgParams();
+ (*msg)[am::strings::msg_params][am::strings::window_id] = kTestWindowId;
+ (*msg)[am::strings::msg_params]
+ [am::strings::duplicate_updates_from_window_id] = kDuplicateWindowID;
+ (*msg)[am::strings::msg_params][am::strings::window_type] =
+ mobile_apis::WindowType::WIDGET;
+
+ auto command = CreateCommand<CreateWindowRequest>(msg);
+ EXPECT_TRUE(command->Init());
+ command->Run();
+}
+
+TEST_F(CreateWindowRequestTest,
+ Run_WindowNameAppNameAreEqual_ExpectDuplicateNameResponseToMobile) {
+ const auto result_code = mobile_apis::Result::DUPLICATE_NAME;
+ EXPECT_CALL(mock_rpc_service_,
+ ManageMobileCommand(CheckMessageToMobile(result_code, false),
+ Command::CommandSource::SOURCE_SDL))
+ .WillOnce(Return(true));
+ ON_CALL(*mock_app_, WindowIdExists(kTestWindowId))
+ .WillByDefault(Return(false));
+ ON_CALL(*mock_app_, name()).WillByDefault(ReturnRef(kAppName));
+
+ auto msg = CreateMsgParams();
+ (*msg)[am::strings::msg_params][am::strings::window_id] = kTestWindowId;
+ (*msg)[am::strings::msg_params][am::strings::window_name] = kAppName;
+
+ auto command = CreateCommand<CreateWindowRequest>(msg);
+ EXPECT_TRUE(command->Init());
+ command->Run();
+}
+
+TEST_F(CreateWindowRequestTest,
+ Run_AllParametersCorrect_ExpectUICreateWindowIsSentToHMI) {
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_CreateWindow),
+ Command::CommandSource::SOURCE_SDL_TO_HMI))
+ .WillOnce(Return(true));
+ ON_CALL(*mock_app_, WindowIdExists(kTestWindowId))
+ .WillByDefault(Return(false));
+ ON_CALL(*mock_app_, WindowIdExists(kDuplicateWindowID))
+ .WillByDefault(Return(true));
+ ON_CALL(*mock_app_, name()).WillByDefault(ReturnRef(kAppName));
+
+ const std::vector<std::string> windowNames = {
+ "WindowName_1", "WindowName_2", "WindowName_3"};
+ ON_CALL(*mock_app_, GetWindowNames()).WillByDefault(Return(windowNames));
+
+ auto msg = CreateMsgParams();
+ (*msg)[am::strings::msg_params][am::strings::window_id] = kTestWindowId;
+ (*msg)[am::strings::msg_params][am::strings::window_name] = kWindowName;
+ (*msg)[am::strings::msg_params]
+ [am::strings::duplicate_updates_from_window_id] = kDuplicateWindowID;
+ (*msg)[am::strings::msg_params][am::strings::associated_service_type] =
+ "MEDIA";
+ (*msg)[am::strings::msg_params][am::strings::window_type] =
+ mobile_apis::WindowType::WIDGET;
+
+ auto command = CreateCommand<CreateWindowRequest>(msg);
+ EXPECT_TRUE(command->Init());
+ command->Run();
+}
+
+TEST_F(
+ CreateWindowRequestTest,
+ CheckWindowName_AllParametersCorrectCreateWindowForPrimaryWidget_SendMessageToHMI) {
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_CreateWindow),
+ Command::CommandSource::SOURCE_SDL_TO_HMI))
+ .WillOnce(Return(true));
+ ON_CALL(*mock_app_, WindowIdExists(kTestWindowId))
+ .WillByDefault(Return(false));
+ ON_CALL(*mock_app_, WindowIdExists(kDuplicateWindowID))
+ .WillByDefault(Return(true));
+ ON_CALL(*mock_app_, name()).WillByDefault(ReturnRef(kAppName));
+
+ auto msg = CreateMsgParams();
+ (*msg)[am::strings::msg_params][am::strings::window_id] =
+ mobile_apis::PredefinedWindows::PRIMARY_WIDGET;
+ (*msg)[am::strings::msg_params][am::strings::window_name] = kWindowName;
+ (*msg)[am::strings::msg_params]
+ [am::strings::duplicate_updates_from_window_id] = kDuplicateWindowID;
+ (*msg)[am::strings::msg_params][am::strings::associated_service_type] =
+ "MEDIA";
+ (*msg)[am::strings::msg_params][am::strings::window_type] =
+ mobile_apis::WindowType::WIDGET;
+
+ auto command = CreateCommand<CreateWindowRequest>(msg);
+ EXPECT_TRUE(command->Init());
+ command->Run();
+}
+
+TEST_F(CreateWindowRequestTest,
+ OnEvent_InvalidFunctionId_MessageNotSendToMobile) {
+ EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _)).Times(0);
+ auto msg = CreateMsgParams();
+ auto command = CreateCommand<CreateWindowRequest>(msg);
+ EXPECT_TRUE(command->Init());
+ Event event(hmi_apis::FunctionID::INVALID_ENUM);
+ command->on_event(event);
+}
+
+TEST_F(CreateWindowRequestTest,
+ OnEvent_AppDoesNotExist_ExpectAppNotRegisteredResponseToMobile) {
+ const auto result_code = mobile_apis::Result::APPLICATION_NOT_REGISTERED;
+ EXPECT_CALL(mock_rpc_service_,
+ ManageMobileCommand(CheckMessageToMobile(result_code, false),
+ Command::CommandSource::SOURCE_SDL))
+ .WillOnce(Return(true));
+ EXPECT_CALL(app_mngr_, application(kConnectionKey)).WillOnce(Return(nullptr));
+
+ auto msg = CreateMsgParams();
+ auto command = CreateCommand<CreateWindowRequest>(msg);
+ EXPECT_TRUE(command->Init());
+ Event event(hmi_apis::FunctionID::UI_CreateWindow);
+ command->on_event(event);
+}
+
+TEST_F(CreateWindowRequestTest,
+ OnEvent_RequestFailedOnHMISide_SendGenericErrorResponseToMobile) {
+ const auto result_code = mobile_apis::Result::GENERIC_ERROR;
+ EXPECT_CALL(mock_rpc_service_,
+ ManageMobileCommand(CheckMessageToMobile(result_code, false),
+ Command::CommandSource::SOURCE_SDL))
+ .WillOnce(Return(true));
+
+ auto msg = CreateMsgParams();
+ (*msg)[am::strings::params][am::hmi_response::code] =
+ hmi_apis::Common_Result::GENERIC_ERROR;
+ (*msg)[am::strings::msg_params][am::strings::window_name] = kWindowName;
+ (*msg)[am::strings::msg_params][am::strings::window_id] = kTestWindowId;
+ (*msg)[am::strings::msg_params][am::strings::window_type] =
+ mobile_apis::WindowType::eType::WIDGET;
+
+ SetupHelperApplyWindowInitialState(mock_app_, msg);
+
+ Event event(hmi_apis::FunctionID::UI_CreateWindow);
+ event.set_smart_object(*msg);
+
+ auto command = CreateCommand<CreateWindowRequest>(msg);
+ EXPECT_TRUE(command->Init());
+ command->on_event(event);
+}
+
+TEST_F(CreateWindowRequestTest,
+ OnEvent_AllParametersCorrect_SendSuccessResponseToMobile) {
+ const auto result_code = mobile_apis::Result::SUCCESS;
+ EXPECT_CALL(mock_rpc_service_,
+ ManageMobileCommand(CheckMessageToMobile(result_code, true),
+ Command::CommandSource::SOURCE_SDL))
+ .WillOnce(Return(true));
+ EXPECT_CALL(*mock_app_, UpdateHash()).Times(1);
+ auto msg = CreateMsgParams();
+ (*msg)[am::strings::params][am::hmi_response::code] =
+ hmi_apis::Common_Result::SUCCESS;
+ (*msg)[am::strings::msg_params][am::strings::window_name] = kWindowName;
+ (*msg)[am::strings::msg_params][am::strings::window_id] = kTestWindowId;
+ (*msg)[am::strings::msg_params][am::strings::window_type] =
+ mobile_apis::WindowType::eType::WIDGET;
+
+ SetupHelperApplyWindowInitialState(mock_app_, msg);
+
+ Event event(hmi_apis::FunctionID::UI_CreateWindow);
+ event.set_smart_object(*msg);
+
+ auto command = CreateCommand<CreateWindowRequest>(msg);
+ EXPECT_TRUE(command->Init());
+ command->on_event(event);
+}
+
+} // namespace create_window_request
+} // namespace mobile_commands_test
+} // namespace commands_test
+} // namespace components
+} // namespace test
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_command_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_command_request_test.cc
index a87d172923..081058f05a 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_command_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_command_request_test.cc
@@ -37,15 +37,15 @@
#include "gtest/gtest.h"
-#include "smart_objects/smart_object.h"
-#include "application_manager/smart_object_keys.h"
#include "application_manager/commands/command_request_test.h"
-#include "application_manager/mock_application_manager.h"
+#include "application_manager/event_engine/event.h"
#include "application_manager/mock_application.h"
-#include "application_manager/mock_message_helper.h"
-#include "application_manager/mock_hmi_interface.h"
+#include "application_manager/mock_application_manager.h"
#include "application_manager/mock_help_prompt_manager.h"
-#include "application_manager/event_engine/event.h"
+#include "application_manager/mock_hmi_interface.h"
+#include "application_manager/mock_message_helper.h"
+#include "application_manager/smart_object_keys.h"
+#include "smart_objects/smart_object.h"
namespace test {
namespace components {
@@ -58,11 +58,11 @@ using ::testing::Return;
using ::testing::ReturnRef;
namespace am = ::application_manager;
namespace am_test = application_manager_test;
-using sdl_rpc_plugin::commands::DeleteCommandRequest;
+using am::MockHmiInterfaces;
+using am::MockMessageHelper;
using am::commands::MessageSharedPtr;
using am::event_engine::Event;
-using am::MockMessageHelper;
-using am::MockHmiInterfaces;
+using sdl_rpc_plugin::commands::DeleteCommandRequest;
typedef std::shared_ptr<DeleteCommandRequest> DeleteCommandPtr;
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_file_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_file_test.cc
index 0ed7a92fa4..cce53bb480 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_file_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_file_test.cc
@@ -31,32 +31,32 @@
*/
#include <stdint.h>
-#include <vector>
-#include <string>
#include <map>
+#include <string>
+#include <vector>
#include "mobile/delete_file_request.h"
#include "mobile/delete_file_response.h"
#include "gtest/gtest.h"
-#include "utils/file_system.h"
-#include "smart_objects/smart_object.h"
-#include "application_manager/smart_object_keys.h"
-#include "application_manager/commands/commands_test.h"
-#include "application_manager/commands/command_request_test.h"
#include "application_manager/application.h"
-#include "application_manager/mock_application_manager.h"
-#include "application_manager/mock_application.h"
-#include "application_manager/mock_message_helper.h"
+#include "application_manager/commands/command_request_test.h"
+#include "application_manager/commands/commands_test.h"
#include "application_manager/event_engine/event.h"
+#include "application_manager/mock_application.h"
+#include "application_manager/mock_application_manager.h"
+#include "application_manager/mock_application_manager_settings.h"
#include "application_manager/mock_hmi_capabilities.h"
+#include "application_manager/mock_message_helper.h"
#include "application_manager/policies/mock_policy_handler_interface.h"
-#include "application_manager/mock_application_manager_settings.h"
+#include "application_manager/smart_object_keys.h"
+#include "smart_objects/smart_object.h"
+#include "utils/file_system.h"
-#include "interfaces/MOBILE_API.h"
-#include "application_manager/policies/policy_handler_interface.h"
#include "application_manager/policies/policy_handler.h"
+#include "application_manager/policies/policy_handler_interface.h"
+#include "interfaces/MOBILE_API.h"
namespace test {
namespace components {
@@ -65,17 +65,17 @@ namespace mobile_commands_test {
namespace delete_file {
using ::testing::_;
-using ::testing::Test;
+using ::testing::AtLeast;
using ::testing::Return;
using ::testing::ReturnRef;
using ::testing::SetArgReferee;
-using ::testing::AtLeast;
+using ::testing::Test;
namespace am = ::application_manager;
-using sdl_rpc_plugin::commands::DeleteFileRequest;
-using sdl_rpc_plugin::commands::DeleteFileResponse;
+using am::MockMessageHelper;
using am::commands::MessageSharedPtr;
using am::event_engine::Event;
-using am::MockMessageHelper;
+using sdl_rpc_plugin::commands::DeleteFileRequest;
+using sdl_rpc_plugin::commands::DeleteFileResponse;
typedef std::shared_ptr<DeleteFileRequest> DeleteFileRequestPtr;
typedef std::shared_ptr<DeleteFileResponse> DeleteFileResponsePtr;
@@ -98,6 +98,8 @@ namespace {
const uint32_t kConnectionKey = 1u;
const uint32_t kCorrelationId = 10u;
const int32_t kMenuId = 5;
+const am::WindowID kDefaultWindowId =
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW;
} // namespace
class DeleteFileRequestTest
@@ -134,7 +136,7 @@ TEST_F(DeleteFileRequestTest, Run_HMILevelNone_UNSUCCESS) {
EXPECT_CALL(app_mngr_, application(kConnectionKey))
.WillOnce(Return(mock_app_));
- EXPECT_CALL(*mock_app_, hmi_level())
+ EXPECT_CALL(*mock_app_, hmi_level(kDefaultWindowId))
.WillOnce(Return(am::mobile_api::HMILevel::HMI_NONE));
EXPECT_CALL(app_mngr_, get_settings())
@@ -161,7 +163,7 @@ TEST_F(DeleteFileRequestTest, Run_ValidFileName_SUCCESS) {
EXPECT_CALL(app_mngr_, application(kConnectionKey))
.WillRepeatedly(Return(mock_app_));
- EXPECT_CALL(*mock_app_, hmi_level())
+ EXPECT_CALL(*mock_app_, hmi_level(kDefaultWindowId))
.WillOnce(Return(am::mobile_api::HMILevel::HMI_FULL));
EXPECT_CALL(app_mngr_, get_settings())
@@ -191,7 +193,7 @@ TEST_F(DeleteFileRequestTest, Run_InvalidFile_UNSUCCESS) {
(*message_)[am::strings::msg_params][am::strings::sync_file_name] = file_name;
EXPECT_CALL(app_mngr_, application(_)).WillOnce(Return(mock_app_));
- EXPECT_CALL(*mock_app_, hmi_level())
+ EXPECT_CALL(*mock_app_, hmi_level(kDefaultWindowId))
.WillOnce(Return(am::mobile_api::HMILevel::HMI_FULL));
EXPECT_CALL(app_mngr_, get_settings())
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_interaction_choice_set_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_interaction_choice_set_test.cc
index c209c4fea2..fa96b21ca7 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_interaction_choice_set_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_interaction_choice_set_test.cc
@@ -38,13 +38,13 @@
#include "gtest/gtest.h"
-#include "smart_objects/smart_object.h"
-#include "application_manager/smart_object_keys.h"
-#include "application_manager/commands/commands_test.h"
#include "application_manager/commands/command_request_test.h"
-#include "application_manager/mock_application_manager.h"
-#include "application_manager/mock_application.h"
+#include "application_manager/commands/commands_test.h"
#include "application_manager/event_engine/event.h"
+#include "application_manager/mock_application.h"
+#include "application_manager/mock_application_manager.h"
+#include "application_manager/smart_object_keys.h"
+#include "smart_objects/smart_object.h"
namespace test {
namespace components {
@@ -53,15 +53,15 @@ namespace mobile_commands_test {
namespace delete_interaction_choice_set {
using ::testing::_;
-using ::testing::Return;
using ::testing::InSequence;
+using ::testing::Return;
namespace am = ::application_manager;
-using sdl_rpc_plugin::commands::DeleteInteractionChoiceSetRequest;
-using sdl_rpc_plugin::commands::DeleteInteractionChoiceSetResponse;
using am::commands::MessageSharedPtr;
using am::event_engine::Event;
+using sdl_rpc_plugin::commands::DeleteInteractionChoiceSetRequest;
+using sdl_rpc_plugin::commands::DeleteInteractionChoiceSetResponse;
typedef std::shared_ptr<DeleteInteractionChoiceSetRequest>
DeleteInteractionChoiceSetRequestPtr;
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_sub_menu_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_sub_menu_test.cc
index ff9e29c872..04f12568b4 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_sub_menu_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_sub_menu_test.cc
@@ -36,14 +36,14 @@
#include "mobile/delete_sub_menu_request.h"
#include "mobile/delete_sub_menu_response.h"
-#include "gtest/gtest.h"
#include "application_manager/commands/command_request_test.h"
-#include "application_manager/mock_application_manager.h"
-#include "application_manager/mock_application.h"
-#include "application_manager/mock_message_helper.h"
#include "application_manager/event_engine/event.h"
-#include "application_manager/mock_hmi_interface.h"
+#include "application_manager/mock_application.h"
+#include "application_manager/mock_application_manager.h"
#include "application_manager/mock_help_prompt_manager.h"
+#include "application_manager/mock_hmi_interface.h"
+#include "application_manager/mock_message_helper.h"
+#include "gtest/gtest.h"
namespace test {
namespace components {
@@ -52,15 +52,15 @@ namespace mobile_commands_test {
namespace delete_sub_menu_request {
using ::testing::_;
+using ::testing::InSequence;
using ::testing::Return;
using ::testing::ReturnRef;
-using ::testing::InSequence;
namespace am = ::application_manager;
namespace am_test = application_manager_test;
-using am::commands::MessageSharedPtr;
-using am::event_engine::Event;
using am::MockHmiInterfaces;
using am::MockMessageHelper;
+using am::commands::MessageSharedPtr;
+using am::event_engine::Event;
using sdl_rpc_plugin::commands::DeleteSubMenuRequest;
using sdl_rpc_plugin::commands::DeleteSubMenuResponse;
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_window_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_window_request_test.cc
new file mode 100644
index 0000000000..f951d5c2a7
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_window_request_test.cc
@@ -0,0 +1,278 @@
+/*
+ * Copyright (c) 2019, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <stdint.h>
+#include <memory>
+#include <set>
+#include <string>
+
+#include "mobile/delete_window_request.h"
+
+#include "application_manager/commands/command_request_test.h"
+#include "application_manager/event_engine/event.h"
+#include "application_manager/hmi_state.h"
+#include "application_manager/mock_application.h"
+#include "application_manager/mock_application_manager.h"
+#include "application_manager/mock_hmi_interface.h"
+#include "application_manager/mock_message_helper.h"
+#include "application_manager/mock_state_controller.h"
+#include "gtest/gtest.h"
+#include "interfaces/MOBILE_API.h"
+
+namespace test {
+namespace components {
+namespace commands_test {
+namespace mobile_commands_test {
+namespace delete_window_request {
+
+namespace am = application_manager;
+using am::MockMessageHelper;
+using am::commands::CommandImpl;
+using am::commands::MessageSharedPtr;
+using sdl_rpc_plugin::commands::DeleteWindowRequest;
+using namespace mobile_apis::PredefinedWindows;
+using am::commands::Command;
+using application_manager::WindowID;
+using test::components::application_manager_test::MockStateController;
+using test::components::policy_test::MockPolicyHandlerInterface;
+using ::testing::_;
+using ::testing::Return;
+using ::testing::ReturnRef;
+
+namespace {
+const uint32_t kConnectionKey = 2u;
+const int32_t kFunctionID = mobile_apis::FunctionID::DeleteWindowID;
+const WindowID kTestWindowId = 12;
+} // namespace
+
+MATCHER_P2(CheckMessageToMobile, result_code, success, "") {
+ const bool is_success =
+ (*arg)[am::strings::msg_params][am::strings::success].asBool() == success;
+
+ const bool is_result_code_correct =
+ (*arg)[am::strings::msg_params][am::strings::result_code].asInt() ==
+ static_cast<int32_t>(result_code);
+ return is_success && is_result_code_correct;
+}
+
+class DeleteWindowRequestTest
+ : public CommandRequestTest<CommandsTestMocks::kIsNice> {
+ public:
+ DeleteWindowRequestTest() {
+ mock_app_ = CreateMockApp();
+ ON_CALL(app_mngr_, application(kConnectionKey))
+ .WillByDefault(Return(mock_app_));
+ }
+
+ protected:
+ MessageSharedPtr CreateMsgParams() {
+ auto msg = CreateMessage();
+ (*msg)[am::strings::params][am::strings::connection_key] = kConnectionKey;
+ (*msg)[am::strings::params][am::strings::function_id] = kFunctionID;
+ return msg;
+ }
+
+ MockAppPtr mock_app_;
+ NiceMock<MockStateController> mock_state_controller;
+};
+
+TEST_F(DeleteWindowRequestTest, WindowID_ExpectDefaultWindowID) {
+ auto msg = CreateMsgParams();
+ const auto command = CreateCommand<DeleteWindowRequest>(msg);
+ EXPECT_EQ(mobile_apis::PredefinedWindows::DEFAULT_WINDOW,
+ command->window_id());
+}
+
+TEST_F(DeleteWindowRequestTest,
+ Run_AppDoesNotExist_ExpectAppNotRegisteredResponseToMobile) {
+ const auto result_code = mobile_apis::Result::APPLICATION_NOT_REGISTERED;
+ EXPECT_CALL(mock_rpc_service_,
+ ManageMobileCommand(CheckMessageToMobile(result_code, false),
+ Command::CommandSource::SOURCE_SDL))
+ .WillOnce(Return(true));
+ EXPECT_CALL(app_mngr_, application(kConnectionKey)).WillOnce(Return(nullptr));
+
+ auto msg = CreateMsgParams();
+ auto command = CreateCommand<DeleteWindowRequest>(msg);
+ EXPECT_TRUE(command->Init());
+ command->Run();
+}
+
+TEST_F(DeleteWindowRequestTest,
+ Run_WindowIDForMainApplicationWindow_ExpectInvalidIDResponseToMobile) {
+ const auto result_code = mobile_apis::Result::INVALID_ID;
+ EXPECT_CALL(mock_rpc_service_,
+ ManageMobileCommand(CheckMessageToMobile(result_code, false),
+ Command::CommandSource::SOURCE_SDL))
+ .WillOnce(Return(true));
+
+ auto msg = CreateMsgParams();
+ (*msg)[am::strings::msg_params][am::strings::window_id] =
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW;
+
+ auto command = CreateCommand<DeleteWindowRequest>(msg);
+ EXPECT_TRUE(command->Init());
+ command->Run();
+}
+
+TEST_F(DeleteWindowRequestTest,
+ Run_WindowIDNotExist_ExpectInvalidIDResponseToMobile) {
+ const auto result_code = mobile_apis::Result::INVALID_ID;
+ EXPECT_CALL(mock_rpc_service_,
+ ManageMobileCommand(CheckMessageToMobile(result_code, false),
+ Command::CommandSource::SOURCE_SDL))
+ .WillOnce(Return(true));
+ ON_CALL(*mock_app_, GetWindowIds()).WillByDefault(Return(am::WindowIds()));
+
+ auto msg = CreateMsgParams();
+ (*msg)[am::strings::msg_params][am::strings::window_id] = kTestWindowId;
+
+ auto command = CreateCommand<DeleteWindowRequest>(msg);
+ EXPECT_TRUE(command->Init());
+ command->Run();
+}
+
+TEST_F(DeleteWindowRequestTest,
+ Run_AllParametersCorrect_ExpectUIDeleteWindowIsSentToHMI) {
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_DeleteWindow),
+ Command::CommandSource::SOURCE_SDL_TO_HMI))
+ .WillOnce(Return(true));
+
+ ON_CALL(*mock_app_, GetWindowIds())
+ .WillByDefault(Return(am::WindowIds(1, kTestWindowId)));
+ EXPECT_CALL(*mock_app_, WindowIdExists(kTestWindowId)).WillOnce(Return(true));
+ auto msg = CreateMsgParams();
+ (*msg)[am::strings::msg_params][am::strings::window_id] = kTestWindowId;
+
+ auto command = CreateCommand<DeleteWindowRequest>(msg);
+ EXPECT_TRUE(command->Init());
+ command->Run();
+}
+
+TEST_F(DeleteWindowRequestTest,
+ Run_AllParametersCorrectDeleteWindowForPrimaryWidget_SendMessageToHMI) {
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_DeleteWindow),
+ Command::CommandSource::SOURCE_SDL_TO_HMI))
+ .WillOnce(Return(true));
+ const auto primary_widget_window_id =
+ mobile_apis::PredefinedWindows::PRIMARY_WIDGET;
+ ON_CALL(*mock_app_, GetWindowIds())
+ .WillByDefault(Return(am::WindowIds(1, primary_widget_window_id)));
+ EXPECT_CALL(*mock_app_, WindowIdExists(primary_widget_window_id))
+ .WillOnce(Return(true));
+ auto msg = CreateMsgParams();
+ (*msg)[am::strings::msg_params][am::strings::window_id] =
+ primary_widget_window_id;
+
+ auto command = CreateCommand<DeleteWindowRequest>(msg);
+ EXPECT_TRUE(command->Init());
+ command->Run();
+}
+
+TEST_F(DeleteWindowRequestTest,
+ OnEvent_InvalidFunctionId_MessageNotSendToMobile) {
+ EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _)).Times(0);
+ auto msg = CreateMsgParams();
+ auto command = CreateCommand<DeleteWindowRequest>(msg);
+ EXPECT_TRUE(command->Init());
+ Event event(hmi_apis::FunctionID::INVALID_ENUM);
+ command->on_event(event);
+}
+
+TEST_F(DeleteWindowRequestTest,
+ OnEvent_AppDoesNotExist_ExpectAppNotRegisteredResponseToMobile) {
+ const auto result_code = mobile_apis::Result::APPLICATION_NOT_REGISTERED;
+ EXPECT_CALL(mock_rpc_service_,
+ ManageMobileCommand(CheckMessageToMobile(result_code, false),
+ Command::CommandSource::SOURCE_SDL))
+ .WillOnce(Return(true));
+ EXPECT_CALL(app_mngr_, application(kConnectionKey)).WillOnce(Return(nullptr));
+
+ auto msg = CreateMsgParams();
+ auto command = CreateCommand<DeleteWindowRequest>(msg);
+ EXPECT_TRUE(command->Init());
+ Event event(hmi_apis::FunctionID::UI_DeleteWindow);
+ command->on_event(event);
+}
+
+TEST_F(DeleteWindowRequestTest,
+ OnEvent_RequestFailedOnHMISide_SendGenericErrorResponseToMobile) {
+ const auto result_code = mobile_apis::Result::GENERIC_ERROR;
+ EXPECT_CALL(mock_rpc_service_,
+ ManageMobileCommand(CheckMessageToMobile(result_code, false),
+ Command::CommandSource::SOURCE_SDL))
+ .WillOnce(Return(true));
+
+ auto msg = CreateMsgParams();
+ (*msg)[am::strings::params][am::hmi_response::code] =
+ hmi_apis::Common_Result::GENERIC_ERROR;
+
+ Event event(hmi_apis::FunctionID::UI_DeleteWindow);
+ event.set_smart_object(*msg);
+
+ auto command = CreateCommand<DeleteWindowRequest>(msg);
+ EXPECT_TRUE(command->Init());
+ command->on_event(event);
+}
+
+TEST_F(DeleteWindowRequestTest,
+ OnEvent_AllParametersCorrect_SendSuccessResponseToMobile) {
+ const auto result_code = mobile_apis::Result::SUCCESS;
+ EXPECT_CALL(mock_rpc_service_,
+ ManageMobileCommand(CheckMessageToMobile(result_code, true),
+ Command::CommandSource::SOURCE_SDL))
+ .WillOnce(Return(true));
+ EXPECT_CALL(*mock_app_, UpdateHash()).Times(1);
+ EXPECT_CALL(*mock_app_, RemoveHMIState(kTestWindowId, _)).Times(1);
+
+ auto msg = CreateMsgParams();
+ (*msg)[am::strings::params][am::hmi_response::code] =
+ hmi_apis::Common_Result::SUCCESS;
+ (*msg)[am::strings::msg_params][am::strings::window_id] = kTestWindowId;
+
+ Event event(hmi_apis::FunctionID::UI_DeleteWindow);
+ event.set_smart_object(*msg);
+
+ auto command = CreateCommand<DeleteWindowRequest>(msg);
+ EXPECT_TRUE(command->Init());
+ command->on_event(event);
+}
+
+} // namespace delete_window_request
+} // namespace mobile_commands_test
+} // namespace commands_test
+} // namespace components
+} // namespace test
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/dial_number_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/dial_number_request_test.cc
index ffa1b833be..cf2634b37c 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/dial_number_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/dial_number_request_test.cc
@@ -36,16 +36,16 @@
#include "gtest/gtest.h"
-#include "smart_objects/smart_object.h"
-#include "application_manager/smart_object_keys.h"
-#include "application_manager/commands/commands_test.h"
-#include "application_manager/commands/command_request_test.h"
#include "application_manager/application.h"
-#include "application_manager/mock_application_manager.h"
-#include "application_manager/mock_application.h"
+#include "application_manager/commands/command_request_test.h"
+#include "application_manager/commands/commands_test.h"
#include "application_manager/event_engine/event.h"
-#include "mobile/dial_number_request.h"
+#include "application_manager/mock_application.h"
+#include "application_manager/mock_application_manager.h"
+#include "application_manager/smart_object_keys.h"
#include "interfaces/MOBILE_API.h"
+#include "mobile/dial_number_request.h"
+#include "smart_objects/smart_object.h"
namespace test {
namespace components {
@@ -57,8 +57,8 @@ using ::testing::_;
using ::testing::Return;
namespace am = ::application_manager;
using am::commands::MessageSharedPtr;
-using sdl_rpc_plugin::commands::DialNumberRequest;
using am::event_engine::Event;
+using sdl_rpc_plugin::commands::DialNumberRequest;
namespace mobile_result = mobile_apis::Result;
typedef std::shared_ptr<DialNumberRequest> DialNumberRequestPtr;
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/dummy_mobile_commands_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/dummy_mobile_commands_test.cc
index 9c20143c39..8f83a2dd10 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/dummy_mobile_commands_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/dummy_mobile_commands_test.cc
@@ -131,8 +131,8 @@
#include "application_manager/mock_application.h"
#include "application_manager/mock_application_manager.h"
-#include "test/application_manager/mock_application_manager_settings.h"
#include "application_manager/mock_event_dispatcher.h"
+#include "test/application_manager/mock_application_manager_settings.h"
namespace am = application_manager;
@@ -143,16 +143,16 @@ namespace mobile_commands_test {
namespace dummy_mobile_commands_test {
namespace commands = sdl_rpc_plugin::commands;
-using ::testing::_;
-using ::testing::NotNull;
-using ::testing::Types;
using am::commands::MessageSharedPtr;
-using ::test::components::event_engine_test::MockEventDispatcher;
+using ::application_manager::ApplicationSharedPtr;
+using ::test::components::application_manager_test::MockApplication;
using ::test::components::application_manager_test::MockApplicationManager;
using ::test::components::application_manager_test::
MockApplicationManagerSettings;
-using ::application_manager::ApplicationSharedPtr;
-using ::test::components::application_manager_test::MockApplication;
+using ::test::components::event_engine_test::MockEventDispatcher;
+using ::testing::_;
+using ::testing::NotNull;
+using ::testing::Types;
namespace {
const std::string kEmptyString_ = "";
@@ -283,7 +283,8 @@ typedef Types<commands::mobile::OnSystemRequestNotification,
commands::SubscribeWayPointsRequest,
commands::SubscribeWayPointsResponse,
commands::SystemResponse,
- commands::UnregisterAppInterfaceRequest> MobileCommandsListSecond;
+ commands::UnregisterAppInterfaceRequest>
+ MobileCommandsListSecond;
typedef Types<commands::UnregisterAppInterfaceResponse,
commands::UnsubscribeButtonRequest,
@@ -291,7 +292,8 @@ typedef Types<commands::UnregisterAppInterfaceResponse,
commands::UnsubscribeWayPointsRequest,
commands::UnsubscribeWayPointsResponse,
commands::UpdateTurnListRequest,
- commands::UpdateTurnListResponse> MobileCommandsListThird;
+ commands::UpdateTurnListResponse>
+ MobileCommandsListThird;
TYPED_TEST_CASE(MobileCommandsTestFirst, MobileCommandsListFirst);
TYPED_TEST_CASE(MobileCommandsTestSecond, MobileCommandsListSecond);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/end_audio_pass_thru_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/end_audio_pass_thru_request_test.cc
index 304cf13ffd..ba09e0dabe 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/end_audio_pass_thru_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/end_audio_pass_thru_request_test.cc
@@ -36,14 +36,14 @@
#include "mobile/end_audio_pass_thru_request.h"
-#include "gtest/gtest.h"
-#include "application_manager/smart_object_keys.h"
-#include "application_manager/commands/commands_test.h"
#include "application_manager/commands/command_request_test.h"
-#include "application_manager/mock_application_manager.h"
+#include "application_manager/commands/commands_test.h"
#include "application_manager/event_engine/event.h"
-#include "application_manager/mock_message_helper.h"
+#include "application_manager/mock_application_manager.h"
#include "application_manager/mock_hmi_interface.h"
+#include "application_manager/mock_message_helper.h"
+#include "application_manager/smart_object_keys.h"
+#include "gtest/gtest.h"
namespace test {
namespace components {
@@ -52,13 +52,13 @@ namespace mobile_commands_test {
namespace end_audio_pass_thru_request {
namespace am = ::application_manager;
+using am::MockMessageHelper;
+using am::commands::MessageSharedPtr;
+using am::event_engine::Event;
+using sdl_rpc_plugin::commands::EndAudioPassThruRequest;
using ::testing::_;
using ::testing::Return;
using ::testing::ReturnRef;
-using am::commands::MessageSharedPtr;
-using sdl_rpc_plugin::commands::EndAudioPassThruRequest;
-using am::event_engine::Event;
-using am::MockMessageHelper;
typedef std::shared_ptr<EndAudioPassThruRequest> EndAudioPassThruRequestPtr;
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/get_system_capability_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/get_system_capability_request_test.cc
new file mode 100644
index 0000000000..74c61410e8
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/get_system_capability_request_test.cc
@@ -0,0 +1,124 @@
+/*
+ Copyright (c) 2019, Ford Motor Company
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the Ford Motor Company nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "mobile/get_system_capability_request.h"
+
+#include "application_manager/commands/command_request_test.h"
+#include "gtest/gtest.h"
+#include "interfaces/MOBILE_API.h"
+#include "smart_objects/smart_object.h"
+
+namespace test {
+namespace components {
+namespace commands_test {
+namespace mobile_commands_test {
+namespace get_system_capability_request_test {
+
+using sdl_rpc_plugin::commands::GetSystemCapabilityRequest;
+using ::testing::_;
+using ::testing::Return;
+typedef std::shared_ptr<GetSystemCapabilityRequest>
+ GetSystemCapabilityRequestPtr;
+
+namespace strings = application_manager::strings;
+namespace {
+const uint32_t kConnectionKey = 1u;
+}
+
+class GetSystemCapabilityRequestTest
+ : public CommandRequestTest<CommandsTestMocks::kIsNice> {
+ protected:
+ void SetUp() OVERRIDE {
+ message_ = CreateMessage();
+ (*message_)[strings::params][strings::connection_key] = kConnectionKey;
+
+ command_ = CreateCommand<GetSystemCapabilityRequest>(message_);
+ mock_app_ = CreateMockApp();
+
+ ON_CALL(app_mngr_, application(kConnectionKey))
+ .WillByDefault(Return(mock_app_));
+ }
+
+ GetSystemCapabilityRequestPtr command_;
+ MessageSharedPtr message_;
+ MockAppPtr mock_app_;
+};
+
+TEST_F(
+ GetSystemCapabilityRequestTest,
+ Run_GetSystemDisplayCapabilities_SendMessageToMobileWithSUCCESSResultCode) {
+ (*message_)[strings::msg_params][strings::system_capability_type] =
+ mobile_apis::SystemCapabilityType::DISPLAYS;
+
+ smart_objects::SmartObjectSPtr system_display_capabilities(
+ std::make_shared<smart_objects::SmartObject>());
+
+ ON_CALL(*mock_app_, display_capabilities())
+ .WillByDefault(Return(system_display_capabilities));
+
+ ON_CALL(mock_hmi_capabilities_, system_display_capabilities())
+ .WillByDefault(Return(system_display_capabilities));
+
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageMobileCommand(MobileResultCodeIs(mobile_apis::Result::SUCCESS),
+ Command::CommandSource::SOURCE_SDL));
+
+ ASSERT_TRUE(command_->Init());
+ command_->Run();
+}
+
+TEST_F(
+ GetSystemCapabilityRequestTest,
+ Run_GetSystemDisplayCapabilities_CapabilitiesNotExistSendMessageToMobileWithDATA_NOT_AVAILABLEResultCode) {
+ (*message_)[strings::msg_params][strings::system_capability_type] =
+ mobile_apis::SystemCapabilityType::DISPLAYS;
+
+ EXPECT_CALL(*mock_app_, display_capabilities()).WillOnce(Return(nullptr));
+
+ ON_CALL(mock_hmi_capabilities_, system_display_capabilities())
+ .WillByDefault(Return(nullptr));
+
+ EXPECT_CALL(mock_rpc_service_,
+ ManageMobileCommand(
+ MobileResultCodeIs(mobile_apis::Result::DATA_NOT_AVAILABLE),
+ Command::CommandSource::SOURCE_SDL));
+
+ ASSERT_TRUE(command_->Init());
+ command_->Run();
+}
+
+} // namespace get_system_capability_request_test
+} // namespace mobile_commands_test
+} // namespace commands_test
+} // namespace components
+} // namespace test
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/get_way_points_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/get_way_points_request_test.cc
index f450d4b671..7f7a8b55bd 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/get_way_points_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/get_way_points_request_test.cc
@@ -32,18 +32,17 @@
#include "gtest/gtest.h"
-#include "application_manager/commands/commands_test.h"
-#include "application_manager/commands/command_request_test.h"
#include "application_manager/application.h"
-#include "application_manager/mock_application_manager.h"
+#include "application_manager/commands/command_request_test.h"
+#include "application_manager/commands/commands_test.h"
#include "application_manager/mock_application.h"
-#include "mobile/get_way_points_request.h"
-#include "application_manager/smart_object_keys.h"
+#include "application_manager/mock_application_manager.h"
+#include "application_manager/mock_hmi_interface.h"
#include "application_manager/mock_message_helper.h"
+#include "application_manager/smart_object_keys.h"
#include "interfaces/HMI_API.h"
#include "interfaces/MOBILE_API.h"
-#include "application_manager/mock_hmi_interface.h"
-#include "application_manager/mock_message_helper.h"
+#include "mobile/get_way_points_request.h"
namespace test {
namespace components {
@@ -52,11 +51,11 @@ namespace mobile_commands_test {
namespace get_way_points_request {
using namespace mobile_apis::Result;
-using ::testing::Return;
-using ::testing::_;
-using sdl_rpc_plugin::commands::GetWayPointsRequest;
-using application_manager::MockMessageHelper;
using application_manager::MockHmiInterfaces;
+using application_manager::MockMessageHelper;
+using sdl_rpc_plugin::commands::GetWayPointsRequest;
+using ::testing::_;
+using ::testing::Return;
typedef std::shared_ptr<GetWayPointsRequest> CommandPtr;
typedef mobile_apis::Result::eType MobileResult;
@@ -67,7 +66,7 @@ const uint32_t kCorrelationId = 2u;
const uint32_t kAppId = 3u;
const uint32_t kConnectionKey = kAppId;
const std::string kMethodName = "Navigation.GetWayPoints";
-}
+} // namespace
class GetWayPointsRequestTest
: public CommandRequestTest<CommandsTestMocks::kIsNice> {
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/list_files_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/list_files_request_test.cc
index 3fcc4225f3..06ecc1116e 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/list_files_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/list_files_request_test.cc
@@ -35,15 +35,15 @@
#include "gtest/gtest.h"
-#include "smart_objects/smart_object.h"
-#include "application_manager/commands/commands_test.h"
-#include "application_manager/commands/command_request_test.h"
#include "application_manager/application.h"
-#include "application_manager/mock_application_manager.h"
+#include "application_manager/commands/command_request_test.h"
+#include "application_manager/commands/commands_test.h"
#include "application_manager/mock_application.h"
-#include "mobile/list_files_request.h"
-#include "interfaces/MOBILE_API.h"
+#include "application_manager/mock_application_manager.h"
#include "application_manager/smart_object_keys.h"
+#include "interfaces/MOBILE_API.h"
+#include "mobile/list_files_request.h"
+#include "smart_objects/smart_object.h"
namespace test {
namespace components {
@@ -52,13 +52,18 @@ namespace mobile_commands_test {
namespace list_files_request {
using ::testing::_;
+using ::testing::DoAll;
using ::testing::Return;
using ::testing::ReturnRef;
-using ::testing::DoAll;
using ::testing::SaveArg;
namespace am = ::application_manager;
-using sdl_rpc_plugin::commands::ListFilesRequest;
using am::commands::MessageSharedPtr;
+using sdl_rpc_plugin::commands::ListFilesRequest;
+
+namespace {
+const am::WindowID kDefaultWindowId =
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW;
+}
class ListFilesRequestTest
: public CommandRequestTest<CommandsTestMocks::kIsNice> {
@@ -86,7 +91,7 @@ TEST_F(ListFilesRequestTest, Run_TooManyHmiNone_UNSUCCESS) {
std::shared_ptr<ListFilesRequest> command(CreateCommand<ListFilesRequest>());
ON_CALL(app_mngr_, application(_)).WillByDefault(Return(app));
- ON_CALL(*app, hmi_level())
+ ON_CALL(*app, hmi_level(kDefaultWindowId))
.WillByDefault(Return(mobile_apis::HMILevel::HMI_NONE));
const uint32_t kListFilesInNoneAllowed = 1u;
@@ -121,7 +126,7 @@ TEST_F(ListFilesRequestTest, Run_SUCCESS) {
ON_CALL(app_mngr_, application(_)).WillByDefault(Return(app));
- ON_CALL(*app, hmi_level())
+ ON_CALL(*app, hmi_level(kDefaultWindowId))
.WillByDefault(Return(mobile_apis::HMILevel::HMI_FULL));
ON_CALL(*app, increment_list_files_in_none_count()).WillByDefault(Return());
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_button_notification_commands_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_button_notification_commands_test.cc
index a0e41cf728..c0305a15ca 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_button_notification_commands_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_button_notification_commands_test.cc
@@ -33,16 +33,16 @@
#include <stdint.h>
#include <string>
+#include "application_manager/smart_object_keys.h"
#include "gtest/gtest.h"
#include "smart_objects/smart_object.h"
-#include "application_manager/smart_object_keys.h"
-#include "application_manager/mock_application_manager.h"
#include "application_manager/mock_application.h"
+#include "application_manager/mock_application_manager.h"
#include "application_manager/commands/command_impl.h"
-#include "application_manager/commands/commands_test.h"
#include "application_manager/commands/command_request_test.h"
+#include "application_manager/commands/commands_test.h"
#include "mobile/on_button_event_notification.h"
#include "mobile/on_button_press_notification.h"
@@ -54,17 +54,19 @@ namespace on_button_notification {
namespace am = ::application_manager;
namespace commands = am::commands;
+using am::commands::MessageSharedPtr;
using sdl_rpc_plugin::commands::mobile::OnButtonEventNotification;
using sdl_rpc_plugin::commands::mobile::OnButtonPressNotification;
using ::testing::_;
-using ::testing::Types;
using ::testing::Return;
-using am::commands::MessageSharedPtr;
+using ::testing::Types;
namespace {
const uint32_t kAppId = 5u;
const uint32_t kCustomButtonId = 3u;
const mobile_apis::ButtonName::eType kButtonName = mobile_apis::ButtonName::OK;
+const am::WindowID kDefaultWindowId =
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW;
} // namespace
template <class NotificationT,
@@ -217,7 +219,7 @@ TYPED_TEST(OnButtonNotificationCommandsTest, Run_CustomButton_SUCCESS) {
this->template CreateCommand<Notification>(notification_msg));
typename TestFixture::MockAppPtr mock_app = this->CreateMockApp();
- ON_CALL(*mock_app, hmi_level())
+ ON_CALL(*mock_app, hmi_level(kDefaultWindowId))
.WillByDefault(Return(mobile_apis::HMILevel::HMI_FULL));
EXPECT_CALL(this->app_mngr_, application(kAppId)).WillOnce(Return(mock_app));
EXPECT_CALL(*mock_app, IsSubscribedToSoftButton(kCustomButtonId))
@@ -264,7 +266,7 @@ TYPED_TEST(OnButtonNotificationCommandsTest, Run_InvalidHmiLevel_UNSUCCESS) {
std::vector<ApplicationSharedPtr> subscribed_apps_list;
subscribed_apps_list.push_back(mock_app);
- EXPECT_CALL(*mock_app, hmi_level())
+ EXPECT_CALL(*mock_app, hmi_level(kDefaultWindowId))
.WillRepeatedly(Return(mobile_apis::HMILevel::HMI_NONE));
EXPECT_CALL(this->app_mngr_, applications_by_button(kButtonName))
@@ -290,7 +292,7 @@ TYPED_TEST(OnButtonNotificationCommandsTest,
std::vector<ApplicationSharedPtr> subscribed_apps_list;
subscribed_apps_list.push_back(mock_app);
- EXPECT_CALL(*mock_app, hmi_level())
+ EXPECT_CALL(*mock_app, hmi_level(kDefaultWindowId))
.WillRepeatedly(Return(mobile_apis::HMILevel::HMI_LIMITED));
EXPECT_CALL(this->app_mngr_, applications_by_button(kButtonName))
@@ -316,7 +318,7 @@ TYPED_TEST(OnButtonNotificationCommandsTest, Run_SUCCESS) {
std::vector<ApplicationSharedPtr> subscribed_apps_list;
subscribed_apps_list.push_back(mock_app);
- EXPECT_CALL(*mock_app, hmi_level())
+ EXPECT_CALL(*mock_app, hmi_level(kDefaultWindowId))
.WillRepeatedly(Return(mobile_apis::HMILevel::HMI_FULL));
ON_CALL(*mock_app, IsFullscreen()).WillByDefault(Return(true));
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_command_notification_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_command_notification_test.cc
index 2fd6f6137d..1356b1c5fa 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_command_notification_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_command_notification_test.cc
@@ -35,11 +35,11 @@
#include "gtest/gtest.h"
-#include "smart_objects/smart_object.h"
-#include "application_manager/smart_object_keys.h"
-#include "application_manager/commands/commands_test.h"
#include "application_manager/commands/command_impl.h"
+#include "application_manager/commands/commands_test.h"
+#include "application_manager/smart_object_keys.h"
#include "mobile/on_command_notification.h"
+#include "smart_objects/smart_object.h"
namespace test {
namespace components {
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_hash_change_notification_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_hash_change_notification_test.cc
index 1d6711e36f..15faa5c13f 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_hash_change_notification_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_hash_change_notification_test.cc
@@ -32,12 +32,12 @@
#include <string>
-#include "gtest/gtest.h"
-#include "mobile/on_hash_change_notification.h"
+#include "application_manager/commands/command_impl.h"
#include "application_manager/mock_message_helper.h"
#include "application_manager/smart_object_keys.h"
-#include "application_manager/commands/command_impl.h"
#include "application_manager/test/include/application_manager/commands/commands_test.h"
+#include "gtest/gtest.h"
+#include "mobile/on_hash_change_notification.h"
namespace test {
namespace components {
@@ -47,13 +47,13 @@ namespace on_hash_change_notification {
namespace strings = application_manager::strings;
-using sdl_rpc_plugin::commands::mobile::OnHashChangeNotification;
using application_manager::MockMessageHelper;
using application_manager::commands::CommandImpl;
+using sdl_rpc_plugin::commands::mobile::OnHashChangeNotification;
+using testing::_;
using testing::Mock;
using testing::Return;
using testing::ReturnRef;
-using testing::_;
class OnHashChangeNotificationTest
: public CommandsTest<CommandsTestMocks::kIsNice> {};
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_hmi_status_notification_from_mobile_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_hmi_status_notification_from_mobile_test.cc
index 333c204d57..528f1d8618 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_hmi_status_notification_from_mobile_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_hmi_status_notification_from_mobile_test.cc
@@ -30,13 +30,13 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include "gtest/gtest.h"
#include "mobile/on_hmi_status_notification_from_mobile.h"
-#include "application_manager/commands/commands_test.h"
#include <application_manager/smart_object_keys.h>
-#include "application_manager/message.h"
#include "application_manager/application_manager.h"
+#include "application_manager/commands/commands_test.h"
+#include "application_manager/message.h"
#include "application_manager/mock_message_helper.h"
+#include "gtest/gtest.h"
namespace test {
namespace components {
@@ -51,12 +51,12 @@ const connection_handler::DeviceHandle kHandle = 2u;
namespace strings = application_manager::strings;
-using sdl_rpc_plugin::commands::OnHMIStatusNotificationFromMobile;
-using protocol_handler::MajorProtocolVersion;
using application_manager::ApplicationSet;
+using protocol_handler::MajorProtocolVersion;
+using sdl_rpc_plugin::commands::OnHMIStatusNotificationFromMobile;
+using testing::_;
using testing::Mock;
using testing::Return;
-using testing::_;
class OnHMIStatusNotificationFromMobileTest
: public CommandsTest<CommandsTestMocks::kIsNice> {
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_hmi_status_notification_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_hmi_status_notification_test.cc
index ba3b1e8f1d..5bf68414e5 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_hmi_status_notification_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_hmi_status_notification_test.cc
@@ -30,11 +30,11 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include "gtest/gtest.h"
#include "mobile/on_hmi_status_notification.h"
-#include "application_manager/test/include/application_manager/commands/commands_test.h"
-#include "application_manager/mock_message_helper.h"
#include "application_manager/commands/command_impl.h"
+#include "application_manager/mock_message_helper.h"
+#include "application_manager/test/include/application_manager/commands/commands_test.h"
+#include "gtest/gtest.h"
namespace test {
namespace components {
@@ -47,13 +47,13 @@ const uint32_t kConnectionKey = 1u;
} // namespace
namespace strings = application_manager::strings;
-using sdl_rpc_plugin::commands::OnHMIStatusNotification;
-using protocol_handler::MajorProtocolVersion;
using application_manager::MockMessageHelper;
using application_manager::commands::CommandImpl;
+using protocol_handler::MajorProtocolVersion;
+using sdl_rpc_plugin::commands::OnHMIStatusNotification;
+using testing::_;
using testing::Mock;
using testing::Return;
-using testing::_;
class OnHMIStatusNotificationTest
: public CommandsTest<CommandsTestMocks::kIsNice> {
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_keyboard_input_notification_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_keyboard_input_notification_test.cc
index 04f88e2b13..b7b827bb4c 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_keyboard_input_notification_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_keyboard_input_notification_test.cc
@@ -30,13 +30,13 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include "gtest/gtest.h"
#include "mobile/on_keyboard_input_notification.h"
-#include "application_manager/commands/commands_test.h"
#include <application_manager/smart_object_keys.h>
+#include "application_manager/commands/command_impl.h"
+#include "application_manager/commands/commands_test.h"
#include "application_manager/message.h"
#include "application_manager/mock_message_helper.h"
-#include "application_manager/commands/command_impl.h"
+#include "gtest/gtest.h"
namespace test {
namespace components {
@@ -48,15 +48,17 @@ namespace strings = application_manager::strings;
namespace {
const uint32_t kConnectionKey = 1u;
+const am::WindowID kDefaultWindowId =
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW;
} // namespace
-using sdl_rpc_plugin::commands::mobile::OnKeyBoardInputNotification;
+using application_manager::ApplicationSet;
using application_manager::MockMessageHelper;
using application_manager::commands::CommandImpl;
-using application_manager::ApplicationSet;
+using sdl_rpc_plugin::commands::mobile::OnKeyBoardInputNotification;
+using testing::_;
using testing::Mock;
using testing::Return;
-using testing::_;
class OnKeyBoardInputNotificationTest
: public CommandsTest<CommandsTestMocks::kIsNice> {
@@ -102,7 +104,7 @@ TEST_F(OnKeyBoardInputNotificationTest, Run_ActionActive_SUCCESS) {
EXPECT_CALL(*mock_app, is_perform_interaction_active()).WillOnce(Return(1));
EXPECT_CALL(*mock_app, perform_interaction_layout())
.WillOnce(Return(mobile_apis::LayoutMode::KEYBOARD));
- EXPECT_CALL(*mock_app, hmi_level()).Times(0);
+ EXPECT_CALL(*mock_app, hmi_level(kDefaultWindowId)).Times(0);
EXPECT_CALL(*mock_app, app_id()).WillOnce(Return(kConnectionKey));
@@ -126,7 +128,7 @@ TEST_F(OnKeyBoardInputNotificationTest, Run_ActionNotActive_SUCCESS) {
EXPECT_CALL(*mock_app, is_perform_interaction_active())
.WillRepeatedly(Return(0));
- EXPECT_CALL(*mock_app, hmi_level())
+ EXPECT_CALL(*mock_app, hmi_level(kDefaultWindowId))
.WillOnce(Return(mobile_apis::HMILevel::eType::HMI_FULL));
EXPECT_CALL(*mock_app, app_id()).WillOnce(Return(kConnectionKey));
@@ -151,7 +153,7 @@ TEST_F(OnKeyBoardInputNotificationTest, Run_InvalidApp_NoNotification) {
EXPECT_CALL(*mock_app, is_perform_interaction_active())
.WillRepeatedly(Return(0));
- EXPECT_CALL(*mock_app, hmi_level())
+ EXPECT_CALL(*mock_app, hmi_level(kDefaultWindowId))
.WillOnce(Return(mobile_apis::HMILevel::eType::HMI_BACKGROUND));
EXPECT_CALL(mock_message_helper_, PrintSmartObject(_)).Times(0);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_system_capability_updated_notification_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_system_capability_updated_notification_test.cc
new file mode 100644
index 0000000000..349ada66a2
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_system_capability_updated_notification_test.cc
@@ -0,0 +1,236 @@
+/*
+ * Copyright (c) 2019, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "mobile/on_system_capability_updated_notification.h"
+
+#include "application_manager/commands/commands_test.h"
+#include "application_manager/display_capabilities_builder.h"
+#include "gtest/gtest.h"
+#include "sdl_rpc_plugin/extensions/system_capability_app_extension.h"
+#include "sdl_rpc_plugin/sdl_rpc_plugin.h"
+
+namespace test {
+namespace components {
+namespace commands_test {
+namespace mobile_commands_test {
+namespace on_system_capability_updated_notification {
+
+using sdl_rpc_plugin::commands::mobile::OnSystemCapabilityUpdatedNotification;
+using ::testing::_;
+using ::testing::Return;
+
+typedef std::shared_ptr<OnSystemCapabilityUpdatedNotification>
+ OnSystemCapabilityUpdatedNotificationPtr;
+
+namespace strings = application_manager::strings;
+namespace {
+const uint32_t kConnectionKey = 1u;
+const uint32_t kAppId = 2u;
+} // namespace
+
+MATCHER_P(CheckDisplayCapabilities, display_capabilities, "") {
+ return *display_capabilities ==
+ (*arg)[strings::msg_params][strings::system_capability]
+ [strings::display_capabilities];
+}
+
+class OnSystemCapabilityUpdatedNotificationTest
+ : public CommandsTest<CommandsTestMocks::kIsNice> {
+ protected:
+ void SetUp() OVERRIDE {
+ message_ = CreateMessage();
+ (*message_)[strings::params][strings::connection_key] = kConnectionKey;
+
+ command_ = CreateCommand<OnSystemCapabilityUpdatedNotification>(message_);
+ mock_app_ = CreateMockApp();
+ }
+
+ OnSystemCapabilityUpdatedNotificationPtr command_;
+ MockAppPtr mock_app_;
+ MessageSharedPtr message_;
+};
+
+TEST_F(
+ OnSystemCapabilityUpdatedNotificationTest,
+ Run_AppExistSubscribedToNotification_SystemDisplayCapabilitiesSendToMobile) {
+ (*message_)[am::strings::msg_params][strings::system_capability]
+ [am::strings::system_capability_type] =
+ mobile_apis::SystemCapabilityType::DISPLAYS;
+
+ smart_objects::SmartObjectSPtr system_display_capabilities =
+ std::make_shared<smart_objects::SmartObject>(
+ smart_objects::SmartType_Null);
+
+ ON_CALL(mock_hmi_capabilities_, system_display_capabilities())
+ .WillByDefault(Return(system_display_capabilities));
+
+ sdl_rpc_plugin::SDLRPCPlugin sdl_rpc_plugin;
+
+ std::shared_ptr<sdl_rpc_plugin::SystemCapabilityAppExtension>
+ system_capability_app_extension(
+ std::make_shared<sdl_rpc_plugin::SystemCapabilityAppExtension>(
+ sdl_rpc_plugin, *mock_app_));
+ system_capability_app_extension->SubscribeTo(
+ mobile_apis::SystemCapabilityType::DISPLAYS);
+ application_manager::ApplicationSet apps({mock_app_});
+ std::shared_ptr<sync_primitives::Lock> apps_lock_(
+ std::make_shared<sync_primitives::Lock>());
+ DataAccessor<application_manager::ApplicationSet> apps_data(
+ DataAccessor<application_manager::ApplicationSet>(apps, apps_lock_));
+
+ ON_CALL(app_mngr_, applications()).WillByDefault(Return(apps_data));
+ ON_CALL(*mock_app_, app_id()).WillByDefault(Return(kConnectionKey));
+ ON_CALL(*mock_app_, display_capabilities()).WillByDefault(Return(nullptr));
+ ON_CALL(*mock_app_,
+ QueryInterface(sdl_rpc_plugin::SystemCapabilityAppExtension::
+ SystemCapabilityAppExtensionUID))
+ .WillByDefault(Return(system_capability_app_extension));
+ application_manager::DisplayCapabilitiesBuilder builder(*mock_app_);
+ ON_CALL(*mock_app_, display_capabilities_builder())
+ .WillByDefault(ReturnRef(builder));
+
+ EXPECT_CALL(
+ mock_rpc_service_,
+ SendMessageToMobile(CheckDisplayCapabilities(system_display_capabilities),
+ false));
+
+ ASSERT_TRUE(command_->Init());
+ command_->Run();
+}
+
+TEST_F(
+ OnSystemCapabilityUpdatedNotificationTest,
+ Run_AppExistConnectionKeyNotEqualWithAppId_SystemDisplayCapabilitiesNotSendToMobile) {
+ (*message_)[am::strings::msg_params][strings::system_capability]
+ [am::strings::system_capability_type] =
+ mobile_apis::SystemCapabilityType::DISPLAYS;
+
+ smart_objects::SmartObjectSPtr system_display_capabilities =
+ std::make_shared<smart_objects::SmartObject>(
+ smart_objects::SmartType_Null);
+
+ ON_CALL(mock_hmi_capabilities_, system_display_capabilities())
+ .WillByDefault(Return(system_display_capabilities));
+
+ sdl_rpc_plugin::SDLRPCPlugin sdl_rpc_plugin;
+
+ std::shared_ptr<sdl_rpc_plugin::SystemCapabilityAppExtension>
+ system_capability_app_extension(
+ std::make_shared<sdl_rpc_plugin::SystemCapabilityAppExtension>(
+ sdl_rpc_plugin, *mock_app_));
+ system_capability_app_extension->SubscribeTo(
+ mobile_apis::SystemCapabilityType::DISPLAYS);
+ application_manager::ApplicationSet apps({mock_app_});
+ std::shared_ptr<sync_primitives::Lock> apps_lock_(
+ std::make_shared<sync_primitives::Lock>());
+ DataAccessor<application_manager::ApplicationSet> apps_data(
+ DataAccessor<application_manager::ApplicationSet>(apps, apps_lock_));
+
+ ON_CALL(app_mngr_, applications()).WillByDefault(Return(apps_data));
+ ON_CALL(*mock_app_, app_id()).WillByDefault(Return(kAppId));
+ ON_CALL(*mock_app_, display_capabilities()).WillByDefault(Return(nullptr));
+ ON_CALL(*mock_app_,
+ QueryInterface(sdl_rpc_plugin::SystemCapabilityAppExtension::
+ SystemCapabilityAppExtensionUID))
+ .WillByDefault(Return(system_capability_app_extension));
+
+ EXPECT_CALL(mock_rpc_service_, SendMessageToMobile(_, _)).Times(0);
+
+ ASSERT_TRUE(command_->Init());
+ command_->Run();
+}
+
+TEST_F(
+ OnSystemCapabilityUpdatedNotificationTest,
+ Run_AppExistNotSubscribedToNotification_SystemDisplayCapabilitiesNotSendToMobile) {
+ (*message_)[am::strings::msg_params][strings::system_capability]
+ [am::strings::system_capability_type] =
+ mobile_apis::SystemCapabilityType::DISPLAYS;
+
+ smart_objects::SmartObjectSPtr system_display_capabilities =
+ std::make_shared<smart_objects::SmartObject>(
+ smart_objects::SmartType_Null);
+
+ ON_CALL(mock_hmi_capabilities_, system_display_capabilities())
+ .WillByDefault(Return(system_display_capabilities));
+
+ sdl_rpc_plugin::SDLRPCPlugin sdl_rpc_plugin;
+
+ std::shared_ptr<sdl_rpc_plugin::SystemCapabilityAppExtension>
+ system_capability_app_extension(
+ std::make_shared<sdl_rpc_plugin::SystemCapabilityAppExtension>(
+ sdl_rpc_plugin, *mock_app_));
+
+ application_manager::ApplicationSet apps({mock_app_});
+ std::shared_ptr<sync_primitives::Lock> apps_lock_(
+ std::make_shared<sync_primitives::Lock>());
+ DataAccessor<application_manager::ApplicationSet> apps_data(
+ DataAccessor<application_manager::ApplicationSet>(apps, apps_lock_));
+
+ ON_CALL(app_mngr_, applications()).WillByDefault(Return(apps_data));
+ ON_CALL(*mock_app_, app_id()).WillByDefault(Return(kConnectionKey));
+ ON_CALL(*mock_app_, display_capabilities()).WillByDefault(Return(nullptr));
+ ON_CALL(*mock_app_,
+ QueryInterface(sdl_rpc_plugin::SystemCapabilityAppExtension::
+ SystemCapabilityAppExtensionUID))
+ .WillByDefault(Return(system_capability_app_extension));
+
+ EXPECT_CALL(mock_rpc_service_, SendMessageToMobile(_, _)).Times(0);
+
+ ASSERT_TRUE(command_->Init());
+ command_->Run();
+}
+
+TEST_F(
+ OnSystemCapabilityUpdatedNotificationTest,
+ Run_AppDataEmpty_SystemDisplayCapabilitiesUpdatedNotificationNotSendToMobile) {
+ (*message_)[am::strings::msg_params][strings::system_capability]
+ [am::strings::system_capability_type] =
+ mobile_apis::SystemCapabilityType::DISPLAYS;
+ application_manager::ApplicationSet apps;
+ std::shared_ptr<sync_primitives::Lock> apps_lock_(
+ std::make_shared<sync_primitives::Lock>());
+ DataAccessor<application_manager::ApplicationSet> apps_data(
+ DataAccessor<application_manager::ApplicationSet>(apps, apps_lock_));
+
+ ON_CALL(app_mngr_, applications()).WillByDefault(Return(apps_data));
+ EXPECT_CALL(mock_rpc_service_, SendMessageToMobile(_, _)).Times(0);
+
+ ASSERT_TRUE(command_->Init());
+ command_->Run();
+}
+
+} // namespace on_system_capability_updated_notification
+} // namespace mobile_commands_test
+} // namespace commands_test
+} // namespace components
+} // namespace test
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_system_request_notification_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_system_request_notification_test.cc
index 4981301e07..ffa7203f1f 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_system_request_notification_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_system_request_notification_test.cc
@@ -32,14 +32,13 @@
#include <string>
-#include "gtest/gtest.h"
-#include "mobile/on_system_request_notification.h"
+#include "application_manager/commands/command_impl.h"
+#include "application_manager/commands/commands_test.h"
#include "application_manager/mock_message_helper.h"
#include "application_manager/policies/mock_policy_handler_interface.h"
-#include "application_manager/mock_message_helper.h"
-#include "application_manager/commands/commands_test.h"
-#include "application_manager/commands/command_impl.h"
+#include "gtest/gtest.h"
#include "interfaces/MOBILE_API.h"
+#include "mobile/on_system_request_notification.h"
namespace test {
namespace components {
@@ -49,20 +48,21 @@ namespace on_system_request_notification {
namespace strings = application_manager::strings;
-using sdl_rpc_plugin::commands::mobile::OnSystemRequestNotification;
-using application_manager::commands::CommandImpl;
using application_manager::MockMessageHelper;
+using application_manager::commands::CommandImpl;
+using sdl_rpc_plugin::commands::mobile::OnSystemRequestNotification;
using test::components::policy_test::MockPolicyHandlerInterface;
using namespace mobile_apis;
-using testing::SaveArg;
+using testing::_;
using testing::Mock;
using testing::Return;
using testing::ReturnRef;
-using testing::_;
+using testing::SaveArg;
namespace {
const uint32_t kConnectionKey = 1u;
const std::string kPolicyAppId = "fake-app-id";
+const connection_handler::DeviceHandle kDeviceId = 1u;
} // namespace
class OnSystemRequestNotificationTest
@@ -74,6 +74,7 @@ class OnSystemRequestNotificationTest
ON_CALL(app_mngr_, application(kConnectionKey))
.WillByDefault(Return(mock_app_));
ON_CALL(*mock_app_, policy_app_id()).WillByDefault(Return(kPolicyAppId));
+ ON_CALL(*mock_app_, device()).WillByDefault(Return(kDeviceId));
}
protected:
@@ -91,12 +92,14 @@ TEST_F(OnSystemRequestNotificationTest, Run_ProprietaryType_SUCCESS) {
std::shared_ptr<OnSystemRequestNotification> command =
CreateCommand<OnSystemRequestNotification>(msg);
+ PreConditions();
+
EXPECT_CALL(app_mngr_, application(kConnectionKey))
.WillRepeatedly(Return(mock_app_));
EXPECT_CALL(*mock_app_, policy_app_id()).WillOnce(Return(kPolicyAppId));
EXPECT_CALL(mock_policy_handler_,
- IsRequestTypeAllowed(kPolicyAppId, request_type))
+ IsRequestTypeAllowed(kDeviceId, kPolicyAppId, request_type))
.WillRepeatedly(Return(true));
#ifdef PROPRIETARY_MODE
@@ -131,10 +134,13 @@ TEST_F(OnSystemRequestNotificationTest, Run_HTTPType_SUCCESS) {
std::shared_ptr<OnSystemRequestNotification> command =
CreateCommand<OnSystemRequestNotification>(msg);
+ PreConditions();
+
EXPECT_CALL(app_mngr_, application(kConnectionKey))
.WillOnce(Return(mock_app_));
EXPECT_CALL(*mock_app_, policy_app_id()).WillOnce(Return(kPolicyAppId));
- EXPECT_CALL(mock_policy_handler_, IsRequestTypeAllowed(_, _))
+ EXPECT_CALL(mock_policy_handler_,
+ IsRequestTypeAllowed(kDeviceId, kPolicyAppId, request_type))
.WillOnce(Return(true));
EXPECT_CALL(mock_message_helper_, PrintSmartObject(_))
@@ -168,7 +174,7 @@ TEST_F(OnSystemRequestNotificationTest, Run_InvalidApp_NoNotification) {
EXPECT_CALL(app_mngr_, application(kConnectionKey))
.WillOnce(Return(MockAppPtr()));
EXPECT_CALL(*mock_app_, policy_app_id()).Times(0);
- EXPECT_CALL(mock_policy_handler_, IsRequestTypeAllowed(_, _)).Times(0);
+ EXPECT_CALL(mock_policy_handler_, IsRequestTypeAllowed(_, _, _)).Times(0);
EXPECT_CALL(mock_message_helper_, PrintSmartObject(_)).Times(0);
@@ -188,10 +194,13 @@ TEST_F(OnSystemRequestNotificationTest, Run_RequestNotAllowed_NoNotification) {
std::shared_ptr<OnSystemRequestNotification> command =
CreateCommand<OnSystemRequestNotification>(msg);
+ PreConditions();
+
EXPECT_CALL(app_mngr_, application(kConnectionKey))
.WillOnce(Return(mock_app_));
EXPECT_CALL(*mock_app_, policy_app_id()).WillOnce(Return(kPolicyAppId));
- EXPECT_CALL(mock_policy_handler_, IsRequestTypeAllowed(_, _))
+ EXPECT_CALL(mock_policy_handler_,
+ IsRequestTypeAllowed(kDeviceId, kPolicyAppId, request_type))
.WillOnce(Return(false));
EXPECT_CALL(mock_message_helper_, PrintSmartObject(_)).Times(0);
@@ -215,7 +224,7 @@ TEST_F(
PreConditions();
EXPECT_CALL(mock_policy_handler_,
- IsRequestTypeAllowed(kPolicyAppId, request_type))
+ IsRequestTypeAllowed(kDeviceId, kPolicyAppId, request_type))
.WillOnce(Return(true));
EXPECT_CALL(mock_policy_handler_,
IsRequestSubTypeAllowed(kPolicyAppId, request_subtype))
@@ -242,7 +251,7 @@ TEST_F(OnSystemRequestNotificationTest,
PreConditions();
EXPECT_CALL(mock_policy_handler_,
- IsRequestTypeAllowed(kPolicyAppId, request_type))
+ IsRequestTypeAllowed(kDeviceId, kPolicyAppId, request_type))
.WillOnce(Return(true));
EXPECT_CALL(mock_policy_handler_,
IsRequestSubTypeAllowed(kPolicyAppId, request_subtype))
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_tbt_client_state_notification_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_tbt_client_state_notification_test.cc
index 3d989db478..c43dea76e1 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_tbt_client_state_notification_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_tbt_client_state_notification_test.cc
@@ -36,10 +36,10 @@
#include "gtest/gtest.h"
#include "mobile/on_tbt_client_state_notification.h"
-#include "smart_objects/smart_object.h"
-#include "application_manager/smart_object_keys.h"
-#include "application_manager/commands/commands_test.h"
#include "application_manager/commands/command_impl.h"
+#include "application_manager/commands/commands_test.h"
+#include "application_manager/smart_object_keys.h"
+#include "smart_objects/smart_object.h"
#include "utils/helpers.h"
namespace test {
@@ -60,6 +60,8 @@ typedef std::shared_ptr<OnTBTClientStateNotification> NotificationPtr;
namespace {
const uint32_t kAppId = 1u;
+const am::WindowID kDefaultWindowId =
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW;
} // namespace
class OnTBTClientStateNotificationTest
@@ -79,7 +81,7 @@ TEST_F(OnTBTClientStateNotificationTest, Run_HmiLevelNone_UNSUCCESS) {
EXPECT_CALL(app_mngr_, applications_with_navi())
.WillOnce(Return(applications_with_navi));
- EXPECT_CALL(*mock_app, hmi_level())
+ EXPECT_CALL(*mock_app, hmi_level(kDefaultWindowId))
.WillOnce(Return(mobile_apis::HMILevel::HMI_NONE));
EXPECT_CALL(*mock_app, app_id()).Times(0);
@@ -122,7 +124,7 @@ TEST_F(OnTBTClientStateNotificationTest,
EXPECT_CALL(app_mngr_, applications_with_navi())
.WillOnce(Return(applications_with_navi));
- EXPECT_CALL(*mock_app, hmi_level())
+ EXPECT_CALL(*mock_app, hmi_level(kDefaultWindowId))
.WillOnce(Return(mobile_apis::HMILevel::HMI_FULL));
EXPECT_CALL(*mock_app, app_id()).WillOnce(Return(kAppId));
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_touch_event_notification_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_touch_event_notification_test.cc
index f69dd5da2e..95020328b4 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_touch_event_notification_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_touch_event_notification_test.cc
@@ -36,10 +36,10 @@
#include "gtest/gtest.h"
#include "mobile/on_touch_event_notification.h"
-#include "smart_objects/smart_object.h"
-#include "application_manager/smart_object_keys.h"
-#include "application_manager/commands/commands_test.h"
#include "application_manager/commands/command_impl.h"
+#include "application_manager/commands/commands_test.h"
+#include "application_manager/smart_object_keys.h"
+#include "smart_objects/smart_object.h"
#include "utils/helpers.h"
namespace test {
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_way_point_change_notification_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_way_point_change_notification_test.cc
index ed0a9b07d2..83958954cd 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_way_point_change_notification_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_way_point_change_notification_test.cc
@@ -36,10 +36,10 @@
#include "gtest/gtest.h"
#include "mobile/on_way_point_change_notification.h"
-#include "smart_objects/smart_object.h"
-#include "application_manager/smart_object_keys.h"
-#include "application_manager/commands/commands_test.h"
#include "application_manager/commands/command_impl.h"
+#include "application_manager/commands/commands_test.h"
+#include "application_manager/smart_object_keys.h"
+#include "smart_objects/smart_object.h"
#include "utils/helpers.h"
namespace test {
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/perform_audio_pass_thru_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/perform_audio_pass_thru_test.cc
index acda9b9fc7..2915418d43 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/perform_audio_pass_thru_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/perform_audio_pass_thru_test.cc
@@ -31,18 +31,18 @@
*/
#include <stdint.h>
-#include <string>
#include <set>
+#include <string>
#include "mobile/perform_audio_pass_thru_request.h"
-#include "gtest/gtest.h"
#include "application_manager/commands/command_request_test.h"
+#include "application_manager/event_engine/event.h"
#include "application_manager/mock_application.h"
#include "application_manager/mock_application_manager.h"
-#include "application_manager/mock_message_helper.h"
-#include "application_manager/event_engine/event.h"
#include "application_manager/mock_hmi_interface.h"
+#include "application_manager/mock_message_helper.h"
+#include "gtest/gtest.h"
namespace test {
namespace components {
@@ -51,14 +51,14 @@ namespace mobile_commands_test {
namespace perform_audio_pass_thru_request {
namespace am = application_manager;
-using sdl_rpc_plugin::commands::PerformAudioPassThruRequest;
+using am::MockMessageHelper;
using am::commands::CommandImpl;
using am::commands::MessageSharedPtr;
-using am::MockMessageHelper;
+using sdl_rpc_plugin::commands::PerformAudioPassThruRequest;
using ::testing::_;
+using ::testing::InSequence;
using ::testing::Return;
using ::testing::ReturnRef;
-using ::testing::InSequence;
namespace {
const int32_t kCommandId = 1;
@@ -72,6 +72,8 @@ const std::string kCorrectDisplayText1 = "CorrectDisplayText1";
const std::string kCorrectDisplayText2 = "CorrectDisplayText2";
const std::string kFunctionId = "FunctionId";
const uint32_t kTimeoutForTTSSpeak = 1u;
+const am::WindowID kDefaultWindowId =
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW;
} // namespace
class PerformAudioPassThruRequestTest
@@ -109,7 +111,7 @@ class PerformAudioPassThruRequestTest
msg_params_[field] = "prompt\\n";
}
- EXPECT_CALL(*application_sptr_, hmi_level())
+ EXPECT_CALL(*application_sptr_, hmi_level(kDefaultWindowId))
.WillOnce(Return(am::mobile_api::HMILevel::HMI_FULL));
CallRun caller(*command_sptr_);
@@ -206,7 +208,7 @@ TEST_F(PerformAudioPassThruRequestTest,
(*mobile_request)[am::strings::msg_params][am::strings::initial_prompt] =
initial_prompt;
- EXPECT_CALL(*application_sptr_, hmi_level())
+ EXPECT_CALL(*application_sptr_, hmi_level(kDefaultWindowId))
.WillOnce(Return(am::mobile_api::HMILevel::HMI_FULL));
std::shared_ptr<PerformAudioPassThruRequest> command =
CreateCommand<PerformAudioPassThruRequest>(mobile_request);
@@ -250,7 +252,8 @@ TEST_F(PerformAudioPassThruRequestTest,
VerifyTtsFiles((*mobile_request)[am::strings::msg_params]
[am::strings::initial_prompt],
_,
- _)).WillOnce(Return(mobile_apis::Result::SUCCESS));
+ _))
+ .WillOnce(Return(mobile_apis::Result::SUCCESS));
command->Run();
command->on_event(event_tts);
@@ -285,7 +288,7 @@ TEST_F(PerformAudioPassThruRequestTest,
}
TEST_F(PerformAudioPassThruRequestTest, Run_HmiLevelNone_Rejected) {
- EXPECT_CALL(*application_sptr_, hmi_level())
+ EXPECT_CALL(*application_sptr_, hmi_level(kDefaultWindowId))
.WillOnce(Return(am::mobile_api::HMILevel::HMI_NONE));
CallRun caller(*command_sptr_);
@@ -318,7 +321,7 @@ TEST_F(PerformAudioPassThruRequestTest,
// First we need to call SendSpeakRequest()
// to enable the "is_active_tts_speak" key
- EXPECT_CALL(*application_sptr_, hmi_level())
+ EXPECT_CALL(*application_sptr_, hmi_level(kDefaultWindowId))
.WillOnce(Return(am::mobile_api::HMILevel::HMI_FULL));
msg_params_[am::strings::initial_prompt][0][am::strings::text] =
@@ -406,7 +409,7 @@ TEST_F(PerformAudioPassThruRequestTest,
TEST_F(PerformAudioPassThruRequestTest,
Run_InitPromptCorrect_SpeakAndPerformAPTRequestsSendMuteTrue) {
- EXPECT_CALL(*application_sptr_, hmi_level())
+ EXPECT_CALL(*application_sptr_, hmi_level(kDefaultWindowId))
.WillOnce(Return(am::mobile_api::HMILevel::HMI_FULL));
msg_params_[am::strings::initial_prompt][0][am::strings::text] =
@@ -463,10 +466,12 @@ TEST_F(PerformAudioPassThruRequestTest,
.asString();
const std::string result_display_text_1 =
perform_msg_params[am::hmi_request::audio_pass_display_texts][0]
- [am::hmi_request::field_text].asString();
+ [am::hmi_request::field_text]
+ .asString();
const std::string result_display_text_2 =
perform_msg_params[am::hmi_request::audio_pass_display_texts][1]
- [am::hmi_request::field_text].asString();
+ [am::hmi_request::field_text]
+ .asString();
EXPECT_EQ(kCorrectPrompt, result_initial_prompt);
EXPECT_EQ(kCorrectType, result_prompt_type);
@@ -478,7 +483,7 @@ TEST_F(PerformAudioPassThruRequestTest,
TEST_F(PerformAudioPassThruRequestTest,
Run_InitPromptCorrect_SpeakAndPerformAPTRequestsSendMuteFalse) {
- EXPECT_CALL(*application_sptr_, hmi_level())
+ EXPECT_CALL(*application_sptr_, hmi_level(kDefaultWindowId))
.WillOnce(Return(am::mobile_api::HMILevel::HMI_FULL));
msg_params_[am::strings::initial_prompt][0][am::strings::text] =
@@ -533,7 +538,7 @@ TEST_F(PerformAudioPassThruRequestTest,
TEST_F(
PerformAudioPassThruRequestTest,
Run_InitPromptEmpty_PerformAndRecordStartNotificationsAndStartRecording) {
- EXPECT_CALL(*application_sptr_, hmi_level())
+ EXPECT_CALL(*application_sptr_, hmi_level(kDefaultWindowId))
.WillOnce(Return(am::mobile_api::HMILevel::HMI_FULL));
MessageSharedPtr start_record_result_msg;
@@ -579,7 +584,8 @@ TEST_F(
const hmi_apis::FunctionID::eType start_record_result_function_id =
static_cast<hmi_apis::FunctionID::eType>(
(*start_record_result_msg)[am::strings::params]
- [am::strings::function_id].asInt());
+ [am::strings::function_id]
+ .asInt());
EXPECT_EQ(hmi_apis::FunctionID::UI_OnRecordStart,
start_record_result_function_id);
}
@@ -762,7 +768,7 @@ TEST_F(PerformAudioPassThruRequestTest,
EXPECT_CALL(app_mngr_, EndAudioPassThru(app_id)).WillOnce(Return(true));
EXPECT_CALL(app_mngr_, StopAudioPassThru(_));
- EXPECT_CALL(*application_sptr_, hmi_level())
+ EXPECT_CALL(*application_sptr_, hmi_level(kDefaultWindowId))
.WillOnce(Return(am::mobile_api::HMILevel::HMI_FULL));
msg_params_[am::strings::initial_prompt][0][am::strings::text] =
@@ -831,4 +837,4 @@ TEST_F(PerformAudioPassThruRequestTest,
} // namespace mobile_commands_test
} // namespace commands_test
} // namespace components
-} // namespace tests
+} // namespace test
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/perform_interaction_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/perform_interaction_test.cc
index 3b68d3ea72..f1f7c4c907 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/perform_interaction_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/perform_interaction_test.cc
@@ -31,22 +31,22 @@
*/
#include <stdint.h>
-#include <string>
#include <set>
+#include <string>
#include "mobile/perform_interaction_request.h"
-#include "gtest/gtest.h"
-#include "utils/helpers.h"
-#include "smart_objects/smart_object.h"
-#include "utils/custom_string.h"
#include "application_manager/commands/command_request_test.h"
-#include "application_manager/smart_object_keys.h"
+#include "application_manager/event_engine/event.h"
#include "application_manager/mock_application.h"
#include "application_manager/mock_application_manager.h"
-#include "application_manager/mock_message_helper.h"
-#include "application_manager/event_engine/event.h"
#include "application_manager/mock_hmi_interface.h"
+#include "application_manager/mock_message_helper.h"
+#include "application_manager/smart_object_keys.h"
+#include "gtest/gtest.h"
+#include "smart_objects/smart_object.h"
+#include "utils/custom_string.h"
+#include "utils/helpers.h"
namespace test {
namespace components {
@@ -55,16 +55,16 @@ namespace mobile_commands_test {
namespace perform_interaction_request {
namespace am = application_manager;
-using am::commands::CommandImpl;
using am::ApplicationManager;
-using am::commands::MessageSharedPtr;
using am::ApplicationSharedPtr;
using am::MockMessageHelper;
+using am::commands::CommandImpl;
+using am::commands::MessageSharedPtr;
+using sdl_rpc_plugin::commands::PerformInteractionRequest;
+using ::test::components::application_manager_test::MockApplication;
using ::testing::_;
using ::testing::Return;
using ::testing::ReturnRef;
-using sdl_rpc_plugin::commands::PerformInteractionRequest;
-using ::test::components::application_manager_test::MockApplication;
namespace strings = ::application_manager::strings;
namespace hmi_response = ::application_manager::hmi_response;
@@ -258,4 +258,4 @@ TEST_F(PerformInteractionRequestTest,
} // namespace mobile_commands_test
} // namespace commands_test
} // namespace components
-} // namespace tests
+} // namespace test
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/put_file_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/put_file_test.cc
index 415b559f82..8db533f446 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/put_file_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/put_file_test.cc
@@ -36,18 +36,18 @@
#include "gtest/gtest.h"
-#include "application_manager/commands/commands_test.h"
#include "application_manager/commands/command_request_test.h"
+#include "application_manager/commands/commands_test.h"
-#include "mobile/put_file_response.h"
#include "mobile/put_file_request.h"
+#include "mobile/put_file_response.h"
-#include "utils/file_system.h"
-#include "smart_objects/smart_object.h"
-#include "interfaces/MOBILE_API.h"
#include "application_manager/application.h"
#include "application_manager/mock_application.h"
#include "application_manager/policies/mock_policy_handler_interface.h"
+#include "interfaces/MOBILE_API.h"
+#include "smart_objects/smart_object.h"
+#include "utils/file_system.h"
namespace test {
namespace components {
@@ -56,16 +56,16 @@ namespace mobile_commands_test {
namespace put_file {
using ::testing::_;
+using ::testing::AtLeast;
using ::testing::Return;
using ::testing::ReturnRef;
-using ::testing::AtLeast;
namespace am = ::application_manager;
-using sdl_rpc_plugin::commands::PutFileRequest;
-using sdl_rpc_plugin::commands::PutFileResponse;
using am::commands::MessageSharedPtr;
using policy_test::MockPolicyHandlerInterface;
+using sdl_rpc_plugin::commands::PutFileRequest;
+using sdl_rpc_plugin::commands::PutFileResponse;
typedef std::shared_ptr<PutFileRequest> PutFileRequestPtr;
typedef std::shared_ptr<PutFileResponse> PutFileResponsePtr;
@@ -78,7 +78,9 @@ const int64_t kZeroOffset = 0u;
const std::string kStorageFolder = "./storage";
const std::string kFolder = "folder";
const std::string kAppFolder = "app_folder";
-}
+const am::WindowID kDefaultWindowId =
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW;
+} // namespace
class PutFileRequestTest
: public CommandRequestTest<CommandsTestMocks::kIsNice> {
@@ -99,7 +101,7 @@ class PutFileRequestTest
ON_CALL(app_mngr_, application(kConnectionKey))
.WillByDefault(Return(mock_app_));
- ON_CALL(*mock_app_, hmi_level())
+ ON_CALL(*mock_app_, hmi_level(kDefaultWindowId))
.WillByDefault(Return(mobile_apis::HMILevel::HMI_FULL));
}
@@ -179,7 +181,7 @@ TEST_F(PutFileRequestTest, Run_ApplicationIsNotRegistered_UNSUCCESS) {
}
TEST_F(PutFileRequestTest, Run_HmiLevelNone_UNSUCCESS) {
- EXPECT_CALL(*mock_app_, hmi_level())
+ EXPECT_CALL(*mock_app_, hmi_level(kDefaultWindowId))
.WillOnce(Return(mobile_apis::HMILevel::HMI_NONE));
const uint32_t settings_put_file_in_none = 1u;
@@ -319,7 +321,8 @@ TEST_F(PutFileRequestTest, Run_SendOnPutFileNotification_SUCCESS) {
mock_rpc_service_,
ManageHMICommand(
HMIResultCodeIs(hmi_apis::FunctionID::BasicCommunication_OnPutFile),
- _)).WillOnce(Return(true));
+ _))
+ .WillOnce(Return(true));
ExpectManageMobileCommandWithResultCode(mobile_apis::Result::SUCCESS);
PutFileRequestPtr command(CreateCommand<PutFileRequest>(msg_));
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/register_app_interface_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/register_app_interface_request_test.cc
index 868d353a85..636175c56f 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/register_app_interface_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/register_app_interface_request_test.cc
@@ -34,25 +34,25 @@
#include <string>
#include <vector>
-#include "gtest/gtest.h"
-#include "mobile/register_app_interface_request.h"
-#include "smart_objects/smart_object.h"
-#include "application_manager/commands/commands_test.h"
-#include "application_manager/commands/command_request_test.h"
#include "application_manager/application.h"
-#include "application_manager/mock_application_manager.h"
+#include "application_manager/commands/command_request_test.h"
+#include "application_manager/commands/commands_test.h"
#include "application_manager/mock_application.h"
#include "application_manager/mock_application_helper.h"
-#include "interfaces/MOBILE_API.h"
-#include "application_manager/smart_object_keys.h"
-#include "application_manager/policies/mock_policy_handler_interface.h"
-#include "protocol_handler/mock_session_observer.h"
-#include "connection_handler/mock_connection_handler.h"
+#include "application_manager/mock_application_manager.h"
#include "application_manager/mock_hmi_capabilities.h"
-#include "application_manager/mock_resume_ctrl.h"
#include "application_manager/mock_hmi_interface.h"
-#include "utils/data_accessor.h"
+#include "application_manager/mock_resume_ctrl.h"
+#include "application_manager/policies/mock_policy_handler_interface.h"
+#include "application_manager/smart_object_keys.h"
+#include "connection_handler/mock_connection_handler.h"
+#include "gtest/gtest.h"
+#include "interfaces/MOBILE_API.h"
+#include "mobile/register_app_interface_request.h"
+#include "protocol_handler/mock_session_observer.h"
+#include "smart_objects/smart_object.h"
#include "utils/custom_string.h"
+#include "utils/data_accessor.h"
#include "utils/lock.h"
#include "utils/macro.h"
#include "utils/semantic_version.h"
@@ -64,9 +64,11 @@ namespace mobile_commands_test {
namespace register_app_interface_request {
using ::testing::_;
+using ::testing::DoAll;
using ::testing::Return;
using ::testing::ReturnRef;
-using ::testing::DoAll;
+using ::testing::SaveArg;
+using ::testing::SetArgPointee;
namespace am = ::application_manager;
@@ -75,12 +77,16 @@ using sdl_rpc_plugin::commands::RegisterAppInterfaceRequest;
namespace {
const uint32_t kConnectionKey = 1u;
+const uint32_t kConnectionKey2 = 2u;
+const connection_handler::DeviceHandle kDeviceHandle = 3u;
const hmi_apis::Common_Language::eType kHmiLanguage =
hmi_apis::Common_Language::EN_US;
const mobile_apis::Language::eType kMobileLanguage =
mobile_apis::Language::EN_US;
-const std::string kMacAddress = "test_mac_address";
-const std::string kAppId = "test_app_id";
+const std::string kMacAddress1 = "test_mac_address1";
+const std::string kMacAddress2 = "test_mac_address2";
+const std::string kAppId1 = "test_app1_id";
+const std::string kAppId2 = "test_app2_id";
const std::string kFullAppId = "test_app_id_long";
const std::string kDummyString = "test_string";
const std::vector<uint32_t> kDummyDiagModes;
@@ -94,6 +100,7 @@ class RegisterAppInterfaceRequestTest
: msg_(CreateMessage())
, command_(CreateCommand<RegisterAppInterfaceRequest>(msg_))
, app_name_("test_app_name_")
+ , app2_name_("test_app2_name_")
, lock_ptr_(std::make_shared<sync_primitives::Lock>())
, mock_application_helper_(
application_manager_test::MockApplicationHelper::
@@ -112,7 +119,7 @@ class RegisterAppInterfaceRequestTest
void InitBasicMessage() {
(*msg_)[am::strings::params][am::strings::connection_key] = kConnectionKey;
- (*msg_)[am::strings::msg_params][am::strings::app_id] = kAppId;
+ (*msg_)[am::strings::msg_params][am::strings::app_id] = kAppId1;
(*msg_)[am::strings::msg_params][am::strings::full_app_id] = kFullAppId;
(*msg_)[am::strings::msg_params][am::strings::app_name] = app_name_;
(*msg_)[am::strings::msg_params][am::strings::language_desired] =
@@ -130,11 +137,11 @@ class RegisterAppInterfaceRequestTest
MockAppPtr CreateBasicMockedApp() {
MockAppPtr mock_app = CreateMockApp();
ON_CALL(*mock_app, name()).WillByDefault(ReturnRef(app_name_));
- ON_CALL(*mock_app, mac_address()).WillByDefault(ReturnRef(kMacAddress));
+ ON_CALL(*mock_app, mac_address()).WillByDefault(ReturnRef(kMacAddress1));
ON_CALL(*mock_app, app_icon_path()).WillByDefault(ReturnRef(kDummyString));
ON_CALL(*mock_app, language()).WillByDefault(ReturnRef(kMobileLanguage));
ON_CALL(*mock_app, ui_language()).WillByDefault(ReturnRef(kMobileLanguage));
- ON_CALL(*mock_app, policy_app_id()).WillByDefault(Return(kAppId));
+ ON_CALL(*mock_app, policy_app_id()).WillByDefault(Return(kAppId1));
ON_CALL(*mock_app, msg_version())
.WillByDefault(ReturnRef(mock_semantic_version));
return mock_app;
@@ -154,7 +161,7 @@ class RegisterAppInterfaceRequestTest
void InitGetters() {
ON_CALL(app_mngr_, GetCorrectMobileIDFromMessage(msg_))
- .WillByDefault(Return(kAppId));
+ .WillByDefault(Return(kAppId1));
ON_CALL(app_mngr_, IsHMICooperating()).WillByDefault(Return(true));
ON_CALL(app_mngr_, resume_controller())
.WillByDefault(ReturnRef(mock_resume_crt_));
@@ -168,7 +175,7 @@ class RegisterAppInterfaceRequestTest
.WillByDefault(ReturnRef(kDummyString));
ON_CALL(app_mngr_settings_, supported_diag_modes())
.WillByDefault(ReturnRef(kDummyDiagModes));
- ON_CALL(mock_policy_handler_, GetAppRequestTypes(_))
+ ON_CALL(mock_policy_handler_, GetAppRequestTypes(_, _))
.WillByDefault(Return(std::vector<std::string>()));
ON_CALL(mock_policy_handler_, GetAppRequestTypeState(_))
.WillByDefault(Return(policy::RequestType::State::EMPTY));
@@ -180,7 +187,7 @@ class RegisterAppInterfaceRequestTest
.WillByDefault(Return(policy::DeviceConsent::kDeviceAllowed));
ON_CALL(app_mngr_, GetDeviceTransportType(_))
.WillByDefault(Return(hmi_apis::Common_TransportType::WIFI));
- ON_CALL(app_mngr_, IsAppInReconnectMode(_)).WillByDefault(Return(false));
+ ON_CALL(app_mngr_, IsAppInReconnectMode(_, _)).WillByDefault(Return(false));
ON_CALL(app_mngr_, application_by_policy_id(_))
.WillByDefault(Return(ApplicationSharedPtr()));
ON_CALL(mock_hmi_interfaces_, GetInterfaceState(_))
@@ -201,7 +208,7 @@ class RegisterAppInterfaceRequestTest
void SetCommonExpectionsOnSwitchedApplication(
MockAppPtr mock_app, mobile_apis::Result::eType response_result_code) {
- EXPECT_CALL(mock_policy_handler_, AddApplication(_, _)).Times(0);
+ EXPECT_CALL(mock_policy_handler_, AddApplication(_, _, _)).Times(0);
EXPECT_CALL(
mock_rpc_service_,
@@ -212,13 +219,15 @@ class RegisterAppInterfaceRequestTest
ManageHMICommand(
HMIResultCodeIs(
hmi_apis::FunctionID::BasicCommunication_OnAppRegistered),
- _)).Times(0);
+ _))
+ .Times(0);
EXPECT_CALL(
mock_rpc_service_,
ManageHMICommand(
HMIResultCodeIs(hmi_apis::FunctionID::Buttons_OnButtonSubscription),
- _)).Times(0);
+ _))
+ .Times(0);
EXPECT_CALL(
mock_rpc_service_,
@@ -248,6 +257,7 @@ class RegisterAppInterfaceRequestTest
std::shared_ptr<RegisterAppInterfaceRequest> command_;
const utils::custom_string::CustomString app_name_;
+ const utils::custom_string::CustomString app2_name_;
std::shared_ptr<sync_primitives::Lock> lock_ptr_;
am::ApplicationSet app_set_;
@@ -278,7 +288,7 @@ TEST_F(RegisterAppInterfaceRequestTest, Init_SUCCESS) {
TEST_F(RegisterAppInterfaceRequestTest, Run_MinimalData_SUCCESS) {
InitBasicMessage();
- (*msg_)[am::strings::msg_params][am::strings::hash_id] = kAppId;
+ (*msg_)[am::strings::msg_params][am::strings::hash_id] = kAppId1;
EXPECT_CALL(app_mngr_, IsStopping())
.WillOnce(Return(false))
.WillOnce(Return(true))
@@ -287,20 +297,32 @@ TEST_F(RegisterAppInterfaceRequestTest, Run_MinimalData_SUCCESS) {
EXPECT_CALL(app_mngr_, updateRequestTimeout(_, _, _));
EXPECT_CALL(app_mngr_, IsApplicationForbidden(_, _)).WillOnce(Return(false));
+ connection_handler::DeviceHandle handle = 1;
+ ON_CALL(mock_connection_handler_,
+ GetDataOnSessionKey(kConnectionKey, _, _, _))
+ .WillByDefault(DoAll(SetArgPointee<3>(handle), Return(0)));
+ ON_CALL(mock_session_observer_, GetDataOnDeviceID(handle, _, _, _, _))
+ .WillByDefault(DoAll(SetArgPointee<3>(kMacAddress1), Return(0)));
+
MockAppPtr mock_app = CreateBasicMockedApp();
- EXPECT_CALL(app_mngr_, application(kConnectionKey))
- .WillOnce(Return(ApplicationSharedPtr()))
- .WillRepeatedly(Return(mock_app));
+ EXPECT_CALL(app_mngr_, reregister_application_by_policy_id(kAppId1))
+ .WillOnce(Return(ApplicationSharedPtr()));
+ EXPECT_CALL(app_mngr_, application(kMacAddress1, kAppId1))
+ .WillRepeatedly(Return(ApplicationSharedPtr()));
ON_CALL(app_mngr_, applications())
.WillByDefault(
Return(DataAccessor<am::ApplicationSet>(app_set_, lock_ptr_)));
+
+ EXPECT_CALL(app_mngr_, application(kConnectionKey))
+ .WillOnce(Return(mock_app));
+
ON_CALL(mock_policy_handler_, PolicyEnabled()).WillByDefault(Return(true));
- ON_CALL(mock_policy_handler_, GetInitialAppData(kAppId, _, _))
+ ON_CALL(mock_policy_handler_, GetInitialAppData(kAppId1, _, _))
.WillByDefault(Return(true));
policy::StatusNotifier notify_upd_manager =
std::make_shared<utils::CallNothing>();
- ON_CALL(mock_policy_handler_, AddApplication(_, _))
+ ON_CALL(mock_policy_handler_, AddApplication(kMacAddress1, kAppId1, _))
.WillByDefault(Return(notify_upd_manager));
EXPECT_CALL(app_mngr_, RegisterApplication(msg_)).WillOnce(Return(mock_app));
@@ -309,16 +331,19 @@ TEST_F(RegisterAppInterfaceRequestTest, Run_MinimalData_SUCCESS) {
ManageHMICommand(
HMIResultCodeIs(
hmi_apis::FunctionID::BasicCommunication_OnAppRegistered),
- _)).WillOnce(Return(true));
+ _))
+ .WillOnce(Return(true));
EXPECT_CALL(
mock_rpc_service_,
ManageHMICommand(
HMIResultCodeIs(hmi_apis::FunctionID::Buttons_OnButtonSubscription),
- _)).WillOnce(Return(true));
+ _))
+ .WillOnce(Return(true));
EXPECT_CALL(mock_rpc_service_,
ManageMobileCommand(_, am::commands::Command::SOURCE_SDL))
.Times(2);
EXPECT_CALL(app_mngr_, SendDriverDistractionState(_));
+ ASSERT_TRUE(command_->Init());
command_->Run();
}
@@ -356,10 +381,21 @@ TEST_F(RegisterAppInterfaceRequestTest,
EXPECT_CALL(app_mngr_, updateRequestTimeout(_, _, _));
EXPECT_CALL(app_mngr_, IsApplicationForbidden(_, _)).WillOnce(Return(false));
+ connection_handler::DeviceHandle handle = 1;
+ ON_CALL(mock_connection_handler_,
+ GetDataOnSessionKey(kConnectionKey, _, _, _))
+ .WillByDefault(DoAll(SetArgPointee<3>(handle), Return(0)));
+ ON_CALL(mock_session_observer_, GetDataOnDeviceID(_, _, _, _, _))
+ .WillByDefault(DoAll(SetArgPointee<3>(kMacAddress1), Return(0)));
+
MockAppPtr mock_app = CreateBasicMockedApp();
+ EXPECT_CALL(app_mngr_, reregister_application_by_policy_id(kAppId1))
+ .WillOnce(Return(ApplicationSharedPtr()));
+ EXPECT_CALL(app_mngr_, application(kMacAddress1, kAppId1))
+ .WillRepeatedly(Return(ApplicationSharedPtr()));
+
EXPECT_CALL(app_mngr_, application(kConnectionKey))
- .WillOnce(Return(ApplicationSharedPtr()))
- .WillRepeatedly(Return(mock_app));
+ .WillOnce(Return(mock_app));
MessageSharedPtr expected_message =
CreateMessage(smart_objects::SmartType_Map);
@@ -397,11 +433,11 @@ TEST_F(RegisterAppInterfaceRequestTest,
.WillByDefault(
Return(DataAccessor<am::ApplicationSet>(app_set_, lock_ptr_)));
ON_CALL(mock_policy_handler_, PolicyEnabled()).WillByDefault(Return(true));
- ON_CALL(mock_policy_handler_, GetInitialAppData(kAppId, _, _))
+ ON_CALL(mock_policy_handler_, GetInitialAppData(kAppId1, _, _))
.WillByDefault(Return(true));
policy::StatusNotifier notify_upd_manager =
std::make_shared<utils::CallNothing>();
- ON_CALL(mock_policy_handler_, AddApplication(_, _))
+ ON_CALL(mock_policy_handler_, AddApplication(kMacAddress1, kAppId1, _))
.WillByDefault(Return(notify_upd_manager));
EXPECT_CALL(app_mngr_, RegisterApplication(msg_)).WillOnce(Return(mock_app));
@@ -413,29 +449,34 @@ TEST_F(RegisterAppInterfaceRequestTest,
ManageHMICommand(
HMIResultCodeIs(
hmi_apis::FunctionID::BasicCommunication_OnAppRegistered),
- _)).WillOnce(Return(true));
+ _))
+ .WillOnce(Return(true));
EXPECT_CALL(
mock_rpc_service_,
ManageHMICommand(
HMIResultCodeIs(hmi_apis::FunctionID::Buttons_OnButtonSubscription),
- _)).WillOnce(Return(true));
- EXPECT_CALL(mock_rpc_service_,
- ManageHMICommand(
- HMIResultCodeIs(hmi_apis::FunctionID::VR_ChangeRegistration),
- _)).WillOnce(Return(true));
- EXPECT_CALL(mock_rpc_service_,
- ManageHMICommand(
- HMIResultCodeIs(hmi_apis::FunctionID::TTS_ChangeRegistration),
- _)).WillOnce(Return(true));
- EXPECT_CALL(mock_rpc_service_,
- ManageHMICommand(
- HMIResultCodeIs(hmi_apis::FunctionID::UI_ChangeRegistration),
- _)).WillOnce(Return(true));
+ _))
+ .WillOnce(Return(true));
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::VR_ChangeRegistration), _))
+ .WillOnce(Return(true));
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::TTS_ChangeRegistration), _))
+ .WillOnce(Return(true));
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::UI_ChangeRegistration), _))
+ .WillOnce(Return(true));
EXPECT_CALL(mock_rpc_service_,
ManageMobileCommand(_, am::commands::Command::SOURCE_SDL))
.Times(2);
EXPECT_CALL(app_mngr_, SendDriverDistractionState(_));
-
+ ASSERT_TRUE(command_->Init());
command_->Run();
}
@@ -447,10 +488,19 @@ TEST_F(RegisterAppInterfaceRequestTest,
(*msg_)[am::strings::msg_params][am::strings::hash_id] = request_hash_id;
MockAppPtr mock_app = CreateBasicMockedApp();
- EXPECT_CALL(app_mngr_, application_by_policy_id(kAppId))
- .WillRepeatedly(Return(mock_app));
+ app_set_.insert(mock_app);
+ EXPECT_CALL(app_mngr_, reregister_application_by_policy_id(kAppId1))
+ .WillOnce(Return(mock_app));
+
+ connection_handler::DeviceHandle device_id = 1;
+ ON_CALL(mock_connection_handler_,
+ GetDataOnSessionKey(kConnectionKey, _, _, _))
+ .WillByDefault(DoAll(SetArgPointee<3>(device_id), Return(0)));
+
+ ON_CALL(mock_session_observer_, GetDataOnDeviceID(device_id, _, _, _, _))
+ .WillByDefault(DoAll(SetArgPointee<3>(kMacAddress1), Return(0)));
- EXPECT_CALL(app_mngr_, IsAppInReconnectMode(kAppId)).WillOnce(Return(true));
+ EXPECT_CALL(*mock_app, device()).WillOnce(Return(kDeviceHandle));
EXPECT_CALL(app_mngr_, ProcessReconnection(_, kConnectionKey));
@@ -460,7 +510,8 @@ TEST_F(RegisterAppInterfaceRequestTest,
mock_resume_crt_,
CheckApplicationHash(
std::static_pointer_cast<application_manager::Application>(mock_app),
- request_hash_id)).WillOnce(Return(true));
+ request_hash_id))
+ .WillOnce(Return(true));
EXPECT_CALL(mock_resume_crt_, RemoveApplicationFromSaved(_)).Times(0);
@@ -472,6 +523,7 @@ TEST_F(RegisterAppInterfaceRequestTest,
SetCommonExpectionsOnSwitchedApplication(mock_app,
mobile_apis::Result::SUCCESS);
+ ASSERT_TRUE(command_->Init());
command_->Run();
}
@@ -482,11 +534,18 @@ TEST_F(RegisterAppInterfaceRequestTest,
const std::string request_hash_id = "abc123";
(*msg_)[am::strings::msg_params][am::strings::hash_id] = request_hash_id;
- MockAppPtr mock_app = CreateBasicMockedApp();
- EXPECT_CALL(app_mngr_, application_by_policy_id(kAppId))
- .WillRepeatedly(Return(mock_app));
+ connection_handler::DeviceHandle device_id = 1;
+ ON_CALL(mock_connection_handler_,
+ GetDataOnSessionKey(kConnectionKey, _, _, _))
+ .WillByDefault(DoAll(SetArgPointee<3>(device_id), Return(0)));
- EXPECT_CALL(app_mngr_, IsAppInReconnectMode(kAppId)).WillOnce(Return(true));
+ ON_CALL(mock_session_observer_, GetDataOnDeviceID(device_id, _, _, _, _))
+ .WillByDefault(DoAll(SetArgPointee<3>(kMacAddress1), Return(0)));
+
+ MockAppPtr mock_app = CreateBasicMockedApp();
+ EXPECT_CALL(app_mngr_, reregister_application_by_policy_id(kAppId1))
+ .WillOnce(Return(mock_app));
+ EXPECT_CALL(*mock_app, device()).WillOnce(Return(kDeviceHandle));
EXPECT_CALL(app_mngr_, ProcessReconnection(_, kConnectionKey));
@@ -494,7 +553,8 @@ TEST_F(RegisterAppInterfaceRequestTest,
mock_resume_crt_,
CheckApplicationHash(
std::static_pointer_cast<application_manager::Application>(mock_app),
- request_hash_id)).WillOnce(Return(false));
+ request_hash_id))
+ .WillOnce(Return(false));
EXPECT_CALL(
mock_application_helper_,
@@ -509,7 +569,7 @@ TEST_F(RegisterAppInterfaceRequestTest,
SetCommonExpectionsOnSwitchedApplication(mock_app,
mobile_apis::Result::RESUME_FAILED);
-
+ ASSERT_TRUE(command_->Init());
command_->Run();
}
@@ -517,11 +577,18 @@ TEST_F(RegisterAppInterfaceRequestTest,
SwitchApplication_NoHash_ExpectCleanupResumeFailed) {
InitBasicMessage();
- MockAppPtr mock_app = CreateBasicMockedApp();
- EXPECT_CALL(app_mngr_, application_by_policy_id(kAppId))
- .WillRepeatedly(Return(mock_app));
+ connection_handler::DeviceHandle device_id = 1;
+ ON_CALL(mock_connection_handler_,
+ GetDataOnSessionKey(kConnectionKey, _, _, _))
+ .WillByDefault(DoAll(SetArgPointee<3>(device_id), Return(0)));
- EXPECT_CALL(app_mngr_, IsAppInReconnectMode(kAppId)).WillOnce(Return(true));
+ ON_CALL(mock_session_observer_, GetDataOnDeviceID(device_id, _, _, _, _))
+ .WillByDefault(DoAll(SetArgPointee<3>(kMacAddress1), Return(0)));
+
+ MockAppPtr mock_app = CreateBasicMockedApp();
+ EXPECT_CALL(app_mngr_, reregister_application_by_policy_id(kAppId1))
+ .WillOnce(Return(mock_app));
+ EXPECT_CALL(*mock_app, device()).WillOnce(Return(kDeviceHandle));
EXPECT_CALL(app_mngr_, ProcessReconnection(_, kConnectionKey));
@@ -539,6 +606,137 @@ TEST_F(RegisterAppInterfaceRequestTest,
SetCommonExpectionsOnSwitchedApplication(mock_app,
mobile_apis::Result::RESUME_FAILED);
+ ASSERT_TRUE(command_->Init());
+ command_->Run();
+}
+
+TEST_F(RegisterAppInterfaceRequestTest,
+ RegisterApp_SameAppId_SameDeviceFailed) {
+ using namespace am;
+
+ InitBasicMessage();
+
+ MockAppPtr mock_app1 = CreateBasicMockedApp();
+
+ app_set_.insert(mock_app1);
+ ON_CALL(app_mngr_, applications())
+ .WillByDefault(
+ Return(DataAccessor<am::ApplicationSet>(app_set_, lock_ptr_)));
+
+ MockAppPtr mock_app2 = CreateBasicMockedApp();
+
+ connection_handler::DeviceHandle device_id = 1;
+ ON_CALL(mock_connection_handler_,
+ GetDataOnSessionKey(kConnectionKey, _, _, _))
+ .WillByDefault(DoAll(SetArgPointee<3>(device_id), Return(0)));
+
+ ON_CALL(mock_session_observer_, GetDataOnDeviceID(device_id, _, _, _, _))
+ .WillByDefault(DoAll(SetArgPointee<3>(kMacAddress1), Return(0)));
+
+ EXPECT_CALL(app_mngr_, reregister_application_by_policy_id(kAppId1))
+ .WillOnce(Return(ApplicationSharedPtr()));
+ EXPECT_CALL(app_mngr_, application(kMacAddress1, kAppId1))
+ .WillOnce(Return(mock_app1));
+
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).Times(0);
+
+ EXPECT_CALL(mock_rpc_service_,
+ ManageMobileCommand(
+ MobileResultCodeIs(
+ mobile_apis::Result::APPLICATION_REGISTERED_ALREADY),
+ am::commands::Command::SOURCE_SDL));
+
+ ASSERT_TRUE(command_->Init());
+ command_->Run();
+}
+
+TEST_F(RegisterAppInterfaceRequestTest,
+ RegisterApp_SameAppId_DifferentDevicesSuccess) {
+ MockAppPtr mock_app1 = CreateBasicMockedApp();
+ const connection_handler::DeviceHandle device_id1 = 1u;
+ ON_CALL(*mock_app1, device()).WillByDefault(Return(device_id1));
+ app_set_.insert(mock_app1);
+ ON_CALL(app_mngr_, applications())
+ .WillByDefault(
+ Return(DataAccessor<am::ApplicationSet>(app_set_, lock_ptr_)));
+
+ InitBasicMessage();
+ (*msg_)[am::strings::params][am::strings::connection_key] = kConnectionKey2;
+ EXPECT_CALL(app_mngr_, IsStopping())
+ .WillOnce(Return(false))
+ .WillOnce(Return(true))
+ .WillOnce(Return(false));
+ ON_CALL(app_mngr_, IsHMICooperating()).WillByDefault(Return(false));
+ EXPECT_CALL(app_mngr_, updateRequestTimeout(kConnectionKey2, _, _));
+ EXPECT_CALL(app_mngr_, IsApplicationForbidden(kConnectionKey2, kAppId1))
+ .WillOnce(Return(false));
+
+ connection_handler::DeviceHandle device_id2 = 2u;
+ ON_CALL(mock_connection_handler_,
+ GetDataOnSessionKey(kConnectionKey2, _, _, _))
+ .WillByDefault(DoAll(SetArgPointee<3>(device_id2), Return(0)));
+
+ ON_CALL(mock_session_observer_, GetDataOnDeviceID(device_id2, _, _, _, _))
+ .WillByDefault(DoAll(SetArgPointee<3>(kMacAddress2), Return(0)));
+
+ MockAppPtr mock_app2 = CreateBasicMockedApp();
+
+ ON_CALL(*mock_app2, device()).WillByDefault(Return(device_id2));
+ ON_CALL(*mock_app2, mac_address()).WillByDefault(ReturnRef(kMacAddress2));
+ EXPECT_CALL(app_mngr_, application(kMacAddress2, kAppId1))
+ .WillRepeatedly(Return(ApplicationSharedPtr()));
+ EXPECT_CALL(app_mngr_, reregister_application_by_policy_id(kAppId1))
+ .WillOnce(Return(ApplicationSharedPtr()));
+
+ EXPECT_CALL(app_mngr_, application(kConnectionKey2))
+ .WillOnce(Return(mock_app2));
+
+ ON_CALL(mock_policy_handler_, PolicyEnabled()).WillByDefault(Return(true));
+ ON_CALL(mock_policy_handler_, GetInitialAppData(kAppId1, _, _))
+ .WillByDefault(Return(true));
+ policy::StatusNotifier notify_upd_manager =
+ std::make_shared<utils::CallNothing>();
+ ON_CALL(mock_policy_handler_, AddApplication(kMacAddress2, kAppId1, _))
+ .WillByDefault(Return(notify_upd_manager));
+
+ EXPECT_CALL(app_mngr_, RegisterApplication(msg_)).WillOnce(Return(mock_app2));
+
+ EXPECT_CALL(mock_hmi_interfaces_, GetInterfaceState(_))
+ .WillRepeatedly(Return(am::HmiInterfaces::STATE_AVAILABLE));
+
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(
+ hmi_apis::FunctionID::BasicCommunication_OnAppRegistered),
+ _))
+ .WillOnce(Return(true));
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::Buttons_OnButtonSubscription),
+ _))
+ .WillOnce(Return(true));
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::VR_ChangeRegistration), _))
+ .WillOnce(Return(true));
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::TTS_ChangeRegistration), _))
+ .WillOnce(Return(true));
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::UI_ChangeRegistration), _))
+ .WillOnce(Return(true));
+ EXPECT_CALL(mock_rpc_service_,
+ ManageMobileCommand(_, am::commands::Command::SOURCE_SDL))
+ .Times(2);
+ EXPECT_CALL(app_mngr_, SendDriverDistractionState(_));
+
+ ASSERT_TRUE(command_->Init());
command_->Run();
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/reset_global_properties_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/reset_global_properties_test.cc
index 38585319e4..98c0ad098a 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/reset_global_properties_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/reset_global_properties_test.cc
@@ -37,17 +37,17 @@
#include "mobile/reset_global_properties_request.h"
#include "mobile/reset_global_properties_response.h"
-#include "gtest/gtest.h"
-#include "smart_objects/smart_object.h"
-#include "interfaces/HMI_API.h"
-#include "interfaces/MOBILE_API.h"
-#include "application_manager/smart_object_keys.h"
-#include "application_manager/commands/commands_test.h"
#include "application_manager/commands/command_request_test.h"
-#include "application_manager/mock_application_manager.h"
+#include "application_manager/commands/commands_test.h"
+#include "application_manager/event_engine/event.h"
#include "application_manager/mock_application.h"
+#include "application_manager/mock_application_manager.h"
#include "application_manager/mock_message_helper.h"
-#include "application_manager/event_engine/event.h"
+#include "application_manager/smart_object_keys.h"
+#include "gtest/gtest.h"
+#include "interfaces/HMI_API.h"
+#include "interfaces/MOBILE_API.h"
+#include "smart_objects/smart_object.h"
namespace test {
namespace components {
@@ -61,11 +61,11 @@ using ::testing::ReturnRef;
namespace am = ::application_manager;
-using sdl_rpc_plugin::commands::ResetGlobalPropertiesRequest;
-using sdl_rpc_plugin::commands::ResetGlobalPropertiesResponse;
+using am::MockMessageHelper;
using am::commands::MessageSharedPtr;
using am::event_engine::Event;
-using am::MockMessageHelper;
+using sdl_rpc_plugin::commands::ResetGlobalPropertiesRequest;
+using sdl_rpc_plugin::commands::ResetGlobalPropertiesResponse;
typedef std::shared_ptr<ResetGlobalPropertiesRequest>
ResetGlobalPropertiesRequestPtr;
@@ -237,10 +237,11 @@ TEST_F(ResetGlobalPropertiesRequestTest, Run_SUCCESS) {
EXPECT_CALL(*mock_app_, timeout_prompt())
.WillOnce(Return(so_help_prompt.get()));
- EXPECT_CALL(mock_rpc_service_,
- ManageHMICommand(
- HMIResultCodeIs(hmi_apis::FunctionID::UI_SetGlobalProperties),
- _)).WillOnce(Return(true));
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::UI_SetGlobalProperties), _))
+ .WillOnce(Return(true));
EXPECT_CALL(
mock_rpc_service_,
ManageHMICommand(
@@ -275,10 +276,11 @@ TEST_F(ResetGlobalPropertiesRequestTest,
smart_objects::SmartType_Map);
EXPECT_CALL(mock_message_helper_, CreateAppVrHelp(_))
.WillOnce(Return(vr_help));
- EXPECT_CALL(mock_rpc_service_,
- ManageHMICommand(
- HMIResultCodeIs(hmi_apis::FunctionID::UI_SetGlobalProperties),
- _)).WillOnce(Return(true));
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::UI_SetGlobalProperties), _))
+ .WillOnce(Return(true));
command_->Run();
@@ -321,10 +323,11 @@ TEST_F(ResetGlobalPropertiesRequestTest,
(*ui_msg)[am::strings::params][am::strings::correlation_id] = kCorrelationId;
(*ui_msg)[am::strings::params][am::hmi_response::code] =
hmi_apis::Common_Result::eType::SUCCESS;
- EXPECT_CALL(mock_rpc_service_,
- ManageHMICommand(
- HMIResultCodeIs(hmi_apis::FunctionID::UI_SetGlobalProperties),
- _)).WillOnce(Return(true));
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::UI_SetGlobalProperties), _))
+ .WillOnce(Return(true));
EXPECT_CALL(
mock_rpc_service_,
ManageHMICommand(
@@ -364,10 +367,11 @@ TEST_F(ResetGlobalPropertiesRequestTest, OnEvent_InvalidApp_NoHashUpdate) {
EXPECT_CALL(*mock_app_, reset_vr_help());
EXPECT_CALL(*mock_app_, set_reset_global_properties_active(true));
- EXPECT_CALL(mock_rpc_service_,
- ManageHMICommand(
- HMIResultCodeIs(hmi_apis::FunctionID::UI_SetGlobalProperties),
- _)).WillOnce(Return(true));
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::UI_SetGlobalProperties), _))
+ .WillOnce(Return(true));
smart_objects::SmartObjectSPtr vr_help =
std::make_shared<smart_objects::SmartObject>(
smart_objects::SmartType_Map);
@@ -414,10 +418,11 @@ TEST_F(ResetGlobalPropertiesRequestTest,
EXPECT_CALL(*mock_app_, set_reset_global_properties_active(true));
- EXPECT_CALL(mock_rpc_service_,
- ManageHMICommand(
- HMIResultCodeIs(hmi_apis::FunctionID::UI_SetGlobalProperties),
- _)).WillOnce(Return(true));
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::UI_SetGlobalProperties), _))
+ .WillOnce(Return(true));
EXPECT_CALL(
mock_rpc_service_,
ManageHMICommand(
@@ -480,10 +485,11 @@ TEST_F(ResetGlobalPropertiesRequestTest,
EXPECT_CALL(*mock_app_, set_reset_global_properties_active(true));
- EXPECT_CALL(mock_rpc_service_,
- ManageHMICommand(
- HMIResultCodeIs(hmi_apis::FunctionID::UI_SetGlobalProperties),
- _)).WillOnce(Return(true));
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::UI_SetGlobalProperties), _))
+ .WillOnce(Return(true));
EXPECT_CALL(
mock_rpc_service_,
ManageHMICommand(
@@ -545,10 +551,11 @@ TEST_F(ResetGlobalPropertiesRequestTest,
EXPECT_CALL(*mock_app_, set_reset_global_properties_active(true));
- EXPECT_CALL(mock_rpc_service_,
- ManageHMICommand(
- HMIResultCodeIs(hmi_apis::FunctionID::UI_SetGlobalProperties),
- _)).WillOnce(Return(true));
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::UI_SetGlobalProperties), _))
+ .WillOnce(Return(true));
EXPECT_CALL(
mock_rpc_service_,
ManageHMICommand(
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/scrollable_message_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/scrollable_message_test.cc
index cf25a82972..6b17aa238d 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/scrollable_message_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/scrollable_message_test.cc
@@ -31,20 +31,20 @@
*/
#include <stdint.h>
-#include <string>
#include <set>
+#include <string>
#include "mobile/scrollable_message_request.h"
-#include "gtest/gtest.h"
#include "application_manager/commands/command_request_test.h"
+#include "application_manager/event_engine/event.h"
#include "application_manager/mock_application.h"
#include "application_manager/mock_application_manager.h"
-#include "application_manager/mock_message_helper.h"
-#include "application_manager/event_engine/event.h"
-#include "application_manager/mock_hmi_interface.h"
#include "application_manager/mock_hmi_capabilities.h"
+#include "application_manager/mock_hmi_interface.h"
+#include "application_manager/mock_message_helper.h"
#include "application_manager/policies/mock_policy_handler_interface.h"
+#include "gtest/gtest.h"
namespace test {
namespace components {
@@ -57,10 +57,10 @@ namespace hmi_response = am::hmi_response;
namespace mobile_result = mobile_apis::Result;
namespace am = ::application_manager;
-using sdl_rpc_plugin::commands::ScrollableMessageRequest;
+using am::MockMessageHelper;
using am::commands::CommandImpl;
using am::commands::MessageSharedPtr;
-using am::MockMessageHelper;
+using sdl_rpc_plugin::commands::ScrollableMessageRequest;
using ::testing::_;
using ::testing::Eq;
using ::testing::Ref;
@@ -175,7 +175,7 @@ TEST_F(ScrollableMessageRequestTest, Init_CorrectTimeout_SUCCESS) {
mobile_apis::InteractionMode::MANUAL_ONLY;
EXPECT_EQ(kDefaultTimeout_, command_->default_timeout());
command_->Init();
- EXPECT_EQ(kTimeOut, command_->default_timeout());
+ EXPECT_EQ(kTimeOut + kDefaultTimeout_, command_->default_timeout());
}
TEST_F(ScrollableMessageRequestTest, Init_CorrectTimeout_UNSUCCESS) {
@@ -183,7 +183,7 @@ TEST_F(ScrollableMessageRequestTest, Init_CorrectTimeout_UNSUCCESS) {
mobile_apis::InteractionMode::MANUAL_ONLY;
EXPECT_EQ(kDefaultTimeout_, command_->default_timeout());
command_->Init();
- EXPECT_EQ(kTimeOut, command_->default_timeout());
+ EXPECT_EQ(kDefaultTimeout_, command_->default_timeout());
}
TEST_F(ScrollableMessageRequestTest, Run_ApplicationIsNotRegistered_UNSUCCESS) {
@@ -282,4 +282,4 @@ TEST_F(ScrollableMessageRequestTest,
} // namespace mobile_commands_test
} // namespace commands_test
} // namespace components
-} // namespace tests
+} // namespace test
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/send_haptic_data_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/send_haptic_data_test.cc
index 19f799448a..3cb9642021 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/send_haptic_data_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/send_haptic_data_test.cc
@@ -32,15 +32,15 @@
#include "gtest/gtest.h"
-#include "application_manager/commands/commands_test.h"
#include "application_manager/commands/command_request_test.h"
+#include "application_manager/commands/commands_test.h"
#include "mobile/send_haptic_data_request.h"
#include "mobile/send_haptic_data_response.h"
-#include "interfaces/MOBILE_API.h"
#include "application_manager/application.h"
#include "application_manager/mock_application.h"
+#include "interfaces/MOBILE_API.h"
namespace test {
namespace components {
@@ -53,9 +53,9 @@ using ::testing::Return;
namespace am = ::application_manager;
+using am::commands::MessageSharedPtr;
using sdl_rpc_plugin::commands::SendHapticDataRequest;
using sdl_rpc_plugin::commands::SendHapticDataResponse;
-using am::commands::MessageSharedPtr;
typedef std::shared_ptr<SendHapticDataRequest> SendHapticDataRequestPtr;
typedef std::shared_ptr<SendHapticDataResponse> SendHapticDataResponsePtr;
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/send_location_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/send_location_request_test.cc
index 4cab3db2a3..5d90453278 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/send_location_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/send_location_request_test.cc
@@ -32,10 +32,10 @@
#include <stdint.h>
#include <string>
-#include "gtest/gtest.h"
-#include "mobile/send_location_request.h"
#include "application_manager/mock_hmi_capabilities.h"
#include "application_manager/mock_message_helper.h"
+#include "gtest/gtest.h"
+#include "mobile/send_location_request.h"
#include "application_manager/commands/command_request_test.h"
@@ -45,11 +45,11 @@ namespace commands_test {
namespace mobile_commands_test {
namespace send_location_request {
+using application_manager::MockMessageHelper;
using application_manager::commands::MessageSharedPtr;
using sdl_rpc_plugin::commands::SendLocationRequest;
-using application_manager::MockMessageHelper;
-using test::components::application_manager_test::MockHMICapabilities;
using smart_objects::SmartObject;
+using test::components::application_manager_test::MockHMICapabilities;
using testing::_;
using testing::Return;
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/set_app_icon_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/set_app_icon_test.cc
index d8d1faca47..116a796312 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/set_app_icon_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/set_app_icon_test.cc
@@ -31,20 +31,20 @@
*/
#include <stdint.h>
-#include <string>
#include <set>
+#include <string>
#include "mobile/set_app_icon_request.h"
-#include "gtest/gtest.h"
#include "application_manager/commands/command_request_test.h"
+#include "application_manager/event_engine/event.h"
#include "application_manager/mock_application.h"
#include "application_manager/mock_application_manager.h"
+#include "application_manager/mock_hmi_interface.h"
+#include "application_manager/mock_message_helper.h"
+#include "gtest/gtest.h"
#include "protocol_handler/mock_protocol_handler.h"
#include "protocol_handler/mock_protocol_handler_settings.h"
-#include "application_manager/mock_message_helper.h"
-#include "application_manager/event_engine/event.h"
-#include "application_manager/mock_hmi_interface.h"
namespace test {
namespace components {
@@ -53,11 +53,11 @@ namespace mobile_commands_test {
namespace set_app_icon_request {
namespace am = application_manager;
-using sdl_rpc_plugin::commands::SetAppIconRequest;
+using am::MockHmiInterfaces;
+using am::MockMessageHelper;
using am::commands::CommandImpl;
using am::commands::MessageSharedPtr;
-using am::MockMessageHelper;
-using am::MockHmiInterfaces;
+using sdl_rpc_plugin::commands::SetAppIconRequest;
using test::components::protocol_handler_test::MockProtocolHandler;
using test::components::protocol_handler_test::MockProtocolHandlerSettings;
using ::testing::_;
@@ -170,4 +170,4 @@ TEST_F(SetAppIconRequestTest, OnEvent_UI_UNSUPPORTED_RESOURCE) {
} // namespace mobile_commands_test
} // namespace commands_test
} // namespace components
-} // namespace tests
+} // namespace test
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/set_display_layout_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/set_display_layout_test.cc
index 10ca925739..cde15a2318 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/set_display_layout_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/set_display_layout_test.cc
@@ -31,19 +31,19 @@
*/
#include <stdint.h>
-#include <string>
#include <set>
+#include <string>
#include "mobile/set_display_layout_request.h"
-#include "gtest/gtest.h"
#include "application_manager/commands/command_request_test.h"
+#include "application_manager/event_engine/event.h"
#include "application_manager/mock_application.h"
#include "application_manager/mock_application_manager.h"
-#include "application_manager/mock_message_helper.h"
-#include "application_manager/event_engine/event.h"
-#include "application_manager/mock_hmi_interface.h"
#include "application_manager/mock_hmi_capabilities.h"
+#include "application_manager/mock_hmi_interface.h"
+#include "application_manager/mock_message_helper.h"
+#include "gtest/gtest.h"
namespace test {
namespace components {
@@ -53,10 +53,10 @@ namespace set_display_layout_request {
namespace am = application_manager;
namespace mobile_result = mobile_apis::Result;
-using sdl_rpc_plugin::commands::SetDisplayLayoutRequest;
+using am::MockMessageHelper;
using am::commands::CommandImpl;
using am::commands::MessageSharedPtr;
-using am::MockMessageHelper;
+using sdl_rpc_plugin::commands::SetDisplayLayoutRequest;
using ::testing::_;
using ::testing::Return;
using ::testing::ReturnRef;
@@ -160,6 +160,7 @@ TEST_F(SetDisplayLayoutRequestTest,
ManageMobileCommand(_, am::commands::Command::CommandSource::SOURCE_SDL))
.WillOnce(DoAll(SaveArg<0>(&ui_command_result), Return(true)));
+ command->Init();
command->on_event(event);
ResultCommandExpectations(ui_command_result, "UI is not supported by system");
@@ -178,6 +179,7 @@ TEST_F(SetDisplayLayoutRequestTest, Run_InvalidApp_UNSUCCESS) {
MobileResultCodeIs(mobile_result::APPLICATION_NOT_REGISTERED),
am::commands::Command::CommandSource::SOURCE_SDL));
+ command->Init();
command->Run();
}
@@ -188,7 +190,7 @@ TEST_F(SetDisplayLayoutRequestTest, Run_SUCCESS) {
MockAppPtr mock_app(CreateMockApp());
EXPECT_CALL(app_mngr_, application(kConnectionKey))
.WillOnce(Return(mock_app));
- EXPECT_CALL(*mock_app, display_layout()).WillOnce(ReturnRef(kLayout));
+ EXPECT_CALL(*mock_app, display_layout()).WillOnce(Return(kLayout));
EXPECT_CALL(*mock_app, app_id()).WillOnce(Return(kAppId));
EXPECT_CALL(app_mngr_, GetNextHMICorrelationID())
@@ -204,20 +206,60 @@ TEST_F(SetDisplayLayoutRequestTest, Run_SUCCESS) {
ManageHMICommand(CheckMshCorrId(kCorrelationKey), _))
.WillOnce(Return(true));
+ command->Init();
command->Run();
}
TEST_F(SetDisplayLayoutRequestTest, OnEvent_InvalidEventId_UNSUCCESS) {
- CommandPtr command(CreateCommand<SetDisplayLayoutRequest>());
+ MessageSharedPtr msg(CreateMessage(smart_objects::SmartType_Map));
+ (*msg)[am::strings::params][am::strings::connection_key] = kConnectionKey;
+ CommandPtr command(CreateCommand<SetDisplayLayoutRequest>(msg));
+
am::event_engine::Event event(hmi_apis::FunctionID::INVALID_ENUM);
- SmartObject msg(smart_objects::SmartType_Map);
- event.set_smart_object(msg);
+ event.set_smart_object(*msg);
+ MockAppPtr mock_app(CreateMockApp());
+ EXPECT_CALL(app_mngr_, application(kConnectionKey))
+ .WillOnce(Return(mock_app));
+ command->Init();
+ command->on_event(event);
+}
+
+TEST_F(SetDisplayLayoutRequestTest, OnEvent_AppVersion_v6_WARNING) {
+ am::event_engine::Event event(hmi_apis::FunctionID::UI_SetDisplayLayout);
+ MessageSharedPtr msg = CreateMessage();
+
+ (*msg)[am::strings::params][am::hmi_response::code] =
+ hmi_apis::Common_Result::SUCCESS;
+ (*msg)[am::strings::msg_params][am::hmi_response::display_capabilities] = 0;
+ (*msg)[am::strings::params][am::strings::connection_key] = kConnectionKey;
+ event.set_smart_object(*msg);
+
+ MessageSharedPtr dispaly_capabilities_msg = CreateMessage();
+ (*dispaly_capabilities_msg)[am::hmi_response::templates_available] =
+ "templates_available";
+
+ EXPECT_CALL(mock_hmi_capabilities_, display_capabilities())
+ .WillOnce(Return(dispaly_capabilities_msg.get()));
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageMobileCommand(MobileResultCodeIs(mobile_result::WARNINGS),
+ am::commands::Command::CommandSource::SOURCE_SDL));
+
+ CommandPtr command(CreateCommand<SetDisplayLayoutRequest>(msg));
+ MockAppPtr mock_app(CreateMockApp());
+ EXPECT_CALL(app_mngr_, application(kConnectionKey))
+ .WillOnce(Return(mock_app));
+ ::application_manager::Version app_version;
+ app_version.max_supported_api_version =
+ ::application_manager::APIVersion::kAPIV6;
+ EXPECT_CALL(*mock_app, version()).WillOnce(ReturnRef(app_version));
+ command->Init();
command->on_event(event);
}
-TEST_F(SetDisplayLayoutRequestTest, OnEvent_SUCCESS) {
+TEST_F(SetDisplayLayoutRequestTest, OnEvent_AppVersion_v5_SUCCESS) {
am::event_engine::Event event(hmi_apis::FunctionID::UI_SetDisplayLayout);
MessageSharedPtr msg = CreateMessage();
@@ -239,6 +281,15 @@ TEST_F(SetDisplayLayoutRequestTest, OnEvent_SUCCESS) {
am::commands::Command::CommandSource::SOURCE_SDL));
CommandPtr command(CreateCommand<SetDisplayLayoutRequest>(msg));
+ MockAppPtr mock_app(CreateMockApp());
+ EXPECT_CALL(app_mngr_, application(kConnectionKey))
+ .WillOnce(Return(mock_app));
+ ::application_manager::Version app_version;
+ app_version.max_supported_api_version =
+ ::application_manager::APIVersion::kAPIV5;
+ EXPECT_CALL(*mock_app, version()).WillOnce(ReturnRef(app_version));
+
+ command->Init();
command->on_event(event);
}
@@ -246,4 +297,4 @@ TEST_F(SetDisplayLayoutRequestTest, OnEvent_SUCCESS) {
} // namespace mobile_commands_test
} // namespace commands_test
} // namespace components
-} // namespace tests
+} // namespace test
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/set_global_properties_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/set_global_properties_test.cc
index 94dbbc8b44..9b72d41f7e 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/set_global_properties_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/set_global_properties_test.cc
@@ -32,19 +32,20 @@
#include <stdint.h>
#include <memory>
-#include <string>
#include <set>
+#include <string>
#include "mobile/set_global_properties_request.h"
-#include "gtest/gtest.h"
#include "application_manager/commands/command_request_test.h"
+#include "application_manager/event_engine/event.h"
+#include "application_manager/message_helper.h"
#include "application_manager/mock_application.h"
-#include "application_manager/mock_help_prompt_manager.h"
#include "application_manager/mock_application_manager.h"
-#include "application_manager/mock_message_helper.h"
-#include "application_manager/event_engine/event.h"
+#include "application_manager/mock_help_prompt_manager.h"
#include "application_manager/mock_hmi_interface.h"
+#include "application_manager/mock_message_helper.h"
+#include "gtest/gtest.h"
namespace test {
namespace components {
@@ -53,15 +54,15 @@ namespace mobile_commands_test {
namespace set_global_properties_request {
namespace am = application_manager;
-using sdl_rpc_plugin::commands::SetGlobalPropertiesRequest;
+using am::CommandsMap;
+using am::MockMessageHelper;
using am::commands::CommandImpl;
using am::commands::MessageSharedPtr;
-using am::MockMessageHelper;
-using am::CommandsMap;
-using utils::custom_string::CustomString;
+using sdl_rpc_plugin::commands::SetGlobalPropertiesRequest;
using ::testing::_;
using ::testing::Return;
using ::testing::ReturnRef;
+using utils::custom_string::CustomString;
namespace {
const int32_t kCommandId = 1;
@@ -70,6 +71,13 @@ const uint32_t kCmdId = 1u;
const uint32_t kConnectionKey = 1u;
const std::string kText = "one";
const uint32_t kPosition = 1u;
+
+const std::vector<hmi_apis::Common_Result::eType> success_result_codes{
+ hmi_apis::Common_Result::SUCCESS,
+ hmi_apis::Common_Result::WARNINGS,
+ hmi_apis::Common_Result::WRONG_LANGUAGE,
+ hmi_apis::Common_Result::RETRY,
+ hmi_apis::Common_Result::SAVED};
} // namespace
class SetGlobalPropertiesRequestTest
@@ -233,9 +241,16 @@ class SetGlobalPropertiesRequestTest
ON_CALL(app_mngr_, application(kConnectionKey))
.WillByDefault(Return(mock_app_));
ON_CALL(*mock_app_, app_id()).WillByDefault(Return(kConnectionKey));
- ON_CALL(mock_hmi_interfaces_,
- GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI))
+ ON_CALL(mock_hmi_interfaces_, GetInterfaceState(_))
.WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE));
+ ON_CALL(mock_app_manager_, hmi_interfaces())
+ .WillByDefault(ReturnRef(mock_hmi_interfaces_));
+ ON_CALL(mock_message_helper_,
+ MobileToHMIResult(mobile_apis::Result::UNSUPPORTED_RESOURCE))
+ .WillByDefault(Return(hmi_apis::Common_Result::UNSUPPORTED_RESOURCE));
+ ON_CALL(mock_message_helper_,
+ MobileToHMIResult(mobile_apis::Result::WARNINGS))
+ .WillByDefault(Return(hmi_apis::Common_Result::WARNINGS));
}
void ResultCommandExpectations(MessageSharedPtr msg,
@@ -243,8 +258,8 @@ class SetGlobalPropertiesRequestTest
EXPECT_EQ((*msg)[am::strings::msg_params][am::strings::success].asBool(),
true);
EXPECT_EQ(
- (*msg)[am::strings::msg_params][am::strings::result_code].asInt(),
- static_cast<int32_t>(hmi_apis::Common_Result::UNSUPPORTED_RESOURCE));
+ static_cast<int32_t>(hmi_apis::Common_Result::UNSUPPORTED_RESOURCE),
+ (*msg)[am::strings::msg_params][am::strings::result_code].asInt());
EXPECT_EQ((*msg)[am::strings::msg_params][am::strings::info].asString(),
info);
}
@@ -265,10 +280,128 @@ class SetGlobalPropertiesRequestTest
GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_TTS))
.WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE));
}
+
+ // Checks total result code for each properties
+ void PrepareResultCodeForResponse_CheckTotalCode(
+ const hmi_apis::Common_Result::eType& ui_result,
+ const hmi_apis::Common_Result::eType& tts_result,
+ const hmi_apis::Common_Result::eType& rc_result,
+ const mobile_apis::Result::eType expected_total_result_code) {
+ using namespace application_manager;
+ using namespace hmi_apis;
+
+ commands::ResponseInfo ui_properties_info(
+ ui_result, HmiInterfaces::HMI_INTERFACE_UI, mock_app_manager_);
+ commands::ResponseInfo tts_properties_info(
+ tts_result, HmiInterfaces::HMI_INTERFACE_TTS, mock_app_manager_);
+ commands::ResponseInfo rc_properties_info(
+ rc_result, HmiInterfaces::HMI_INTERFACE_RC, mock_app_manager_);
+
+ MessageSharedPtr msg = CreateMsgParams();
+ std::shared_ptr<SetGlobalPropertiesRequest> command(
+ CreateCommand<SetGlobalPropertiesRequest>(msg));
+
+ auto result = command->PrepareResultCodeForResponse(
+ ui_properties_info, tts_properties_info, rc_properties_info);
+
+ EXPECT_EQ(expected_total_result_code, result);
+ }
+
+ // Sets in rotation for each result UNSUPPROTED result code and checks total
+ // result code
+ void PrepareResultCodeForResponse_CheckAllResultsForSpecifiedTotalResult(
+ mobile_apis::Result::eType expected_total_result_code) {
+ using namespace application_manager;
+ using namespace hmi_apis;
+
+ Common_Result::eType ui_result =
+ MessageHelper::MobileToHMIResult(expected_total_result_code);
+ Common_Result::eType tts_result = Common_Result::SUCCESS;
+ Common_Result::eType rc_result = Common_Result::SUCCESS;
+
+ PrepareResultCodeForResponse_CheckTotalCode(
+ ui_result, tts_result, rc_result, expected_total_result_code);
+
+ ui_result = Common_Result::SUCCESS;
+ tts_result = MessageHelper::MobileToHMIResult(expected_total_result_code);
+
+ PrepareResultCodeForResponse_CheckTotalCode(
+ ui_result, tts_result, rc_result, expected_total_result_code);
+
+ tts_result = Common_Result::SUCCESS;
+ rc_result = MessageHelper::MobileToHMIResult(expected_total_result_code);
+
+ PrepareResultCodeForResponse_CheckTotalCode(
+ ui_result, tts_result, rc_result, expected_total_result_code);
+ }
+
+ void PrepareResultForMobileResponse_CheckTotalReault(
+ const hmi_apis::Common_Result::eType& ui_result,
+ const hmi_apis::Common_Result::eType& tts_result,
+ const hmi_apis::Common_Result::eType& rc_result,
+ const bool expected_total_result) {
+ using namespace application_manager;
+ using namespace hmi_apis;
+
+ commands::ResponseInfo ui_properties_info(
+ ui_result, HmiInterfaces::HMI_INTERFACE_UI, mock_app_manager_);
+ commands::ResponseInfo tts_properties_info(
+ tts_result, HmiInterfaces::HMI_INTERFACE_TTS, mock_app_manager_);
+ commands::ResponseInfo rc_properties_info(
+ rc_result, HmiInterfaces::HMI_INTERFACE_RC, mock_app_manager_);
+
+ MessageSharedPtr msg = CreateMsgParams();
+ std::shared_ptr<SetGlobalPropertiesRequest> command(
+ CreateCommand<SetGlobalPropertiesRequest>(msg));
+
+ bool result = command->PrepareResultForMobileResponse(
+ ui_properties_info, tts_properties_info, rc_properties_info);
+
+ EXPECT_EQ(expected_total_result, result);
+ }
+
+ void PrepareResultForMobileResponse_CheckResultsForAllCases() {
+ using namespace application_manager;
+ using namespace hmi_apis;
+
+ Common_Result::eType ui_result = Common_Result::SUCCESS;
+ Common_Result::eType tts_result = Common_Result::SUCCESS;
+ Common_Result::eType rc_result = Common_Result::SUCCESS;
+
+ PrepareResultForMobileResponse_CheckTotalReault(
+ ui_result, tts_result, rc_result, true);
+
+ // Result code isn't success
+ EXPECT_FALSE(helpers::in_range(success_result_codes,
+ Common_Result::UNSUPPORTED_REQUEST));
+
+ ui_result = Common_Result::UNSUPPORTED_REQUEST;
+ tts_result = Common_Result::SUCCESS;
+ rc_result = Common_Result::SUCCESS;
+
+ PrepareResultForMobileResponse_CheckTotalReault(
+ ui_result, tts_result, rc_result, false);
+
+ ui_result = Common_Result::SUCCESS;
+ tts_result = Common_Result::UNSUPPORTED_REQUEST;
+ rc_result = Common_Result::SUCCESS;
+
+ PrepareResultForMobileResponse_CheckTotalReault(
+ ui_result, tts_result, rc_result, false);
+
+ ui_result = Common_Result::SUCCESS;
+ tts_result = Common_Result::SUCCESS;
+ rc_result = Common_Result::UNSUPPORTED_REQUEST;
+
+ PrepareResultForMobileResponse_CheckTotalReault(
+ ui_result, tts_result, rc_result, false);
+ }
+
std::shared_ptr<sync_primitives::Lock> lock_ptr_;
MockAppPtr mock_app_;
std::shared_ptr<application_manager_test::MockHelpPromptManager>
mock_help_prompt_manager_;
+ NiceMock<MockApplicationManager> mock_app_manager_;
};
TEST_F(SetGlobalPropertiesRequestTest,
@@ -314,22 +447,25 @@ TEST_F(SetGlobalPropertiesRequestTest,
EXPECT_CALL(*mock_app_, help_prompt_manager())
.WillRepeatedly(ReturnRef(*mock_help_prompt_manager_.get()));
EXPECT_CALL(*mock_help_prompt_manager_,
- OnSetGlobalPropertiesReceived(_, false)).Times(2);
+ OnSetGlobalPropertiesReceived(_, false))
+ .Times(2);
EXPECT_CALL(
mock_message_helper_,
VerifyTtsFiles(
(*msg_vr)[am::strings::msg_params][am::strings::help_prompt], _, _))
.WillOnce(Return(mobile_apis::Result::SUCCESS));
- EXPECT_CALL(mock_rpc_service_,
- ManageHMICommand(
- HMIResultCodeIs(hmi_apis::FunctionID::UI_SetGlobalProperties),
- _)).WillOnce(Return(true));
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::UI_SetGlobalProperties), _))
+ .WillOnce(Return(true));
EXPECT_CALL(
mock_rpc_service_,
ManageHMICommand(
HMIResultCodeIs(hmi_apis::FunctionID::TTS_SetGlobalProperties), _))
.WillOnce(Return(true));
+
(*msg_vr)[am::strings::params][am::hmi_response::code] =
hmi_apis::Common_Result::SUCCESS;
Event event_vr(hmi_apis::FunctionID::TTS_SetGlobalProperties);
@@ -414,7 +550,8 @@ TEST_F(SetGlobalPropertiesRequestTest,
command->Run();
EXPECT_CALL(*mock_help_prompt_manager_,
- OnSetGlobalPropertiesReceived(_, true)).Times(2);
+ OnSetGlobalPropertiesReceived(_, true))
+ .Times(2);
command->on_event(event_ui);
command->on_event(event_tts);
@@ -1369,6 +1506,51 @@ TEST_F(SetGlobalPropertiesRequestTest,
static_cast<int32_t>(hmi_apis::Common_Result::WARNINGS));
}
+TEST_F(SetGlobalPropertiesRequestTest,
+ PrepareResultCodeForResponse_AllResultsAreSUCCESS_TotalResultSUCCESS) {
+ using namespace application_manager;
+ using namespace hmi_apis;
+ const auto expected_total_result = mobile_apis::Result::eType::SUCCESS;
+
+ Common_Result::eType ui_result = Common_Result::SUCCESS;
+ Common_Result::eType tts_result = Common_Result::SUCCESS;
+ Common_Result::eType rc_result = Common_Result::SUCCESS;
+
+ app_mngr::commands::ResponseInfo ui_properties_info(
+ ui_result, HmiInterfaces::HMI_INTERFACE_UI, mock_app_manager_);
+
+ app_mngr::commands::ResponseInfo tts_properties_info(
+ tts_result, HmiInterfaces::HMI_INTERFACE_TTS, mock_app_manager_);
+
+ app_mngr::commands::ResponseInfo rc_properties_info(
+ rc_result, HmiInterfaces::HMI_INTERFACE_RC, mock_app_manager_);
+
+ MessageSharedPtr msg = CreateMsgParams();
+ std::shared_ptr<SetGlobalPropertiesRequest> command(
+ CreateCommand<SetGlobalPropertiesRequest>(msg));
+
+ auto result = command->PrepareResultCodeForResponse(
+ ui_properties_info, tts_properties_info, rc_properties_info);
+
+ EXPECT_EQ(expected_total_result, result);
+}
+
+TEST_F(SetGlobalPropertiesRequestTest,
+ PrepareResultCodeForResponse_UNSUPPORTED) {
+ PrepareResultCodeForResponse_CheckAllResultsForSpecifiedTotalResult(
+ mobile_apis::Result::UNSUPPORTED_RESOURCE);
+}
+
+TEST_F(SetGlobalPropertiesRequestTest, PrepareResultCodeForResponse_WARNINGS) {
+ PrepareResultCodeForResponse_CheckAllResultsForSpecifiedTotalResult(
+ mobile_apis::Result::WARNINGS);
+}
+
+TEST_F(SetGlobalPropertiesRequestTest,
+ PrepareResultForMobileResponse_AllCases) {
+ PrepareResultForMobileResponse_CheckResultsForAllCases();
+}
+
} // namespace set_global_properties_request
} // namespace mobile_commands_test
} // namespace commands_test
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/set_media_clock_timer_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/set_media_clock_timer_test.cc
index 04a7da60cf..86d15e76f2 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/set_media_clock_timer_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/set_media_clock_timer_test.cc
@@ -35,13 +35,13 @@
#include "mobile/set_media_clock_timer_request.h"
-#include "gtest/gtest.h"
#include "application_manager/commands/command_request_test.h"
-#include "application_manager/mock_application_manager.h"
-#include "application_manager/mock_application.h"
-#include "application_manager/mock_message_helper.h"
#include "application_manager/event_engine/event.h"
+#include "application_manager/mock_application.h"
+#include "application_manager/mock_application_manager.h"
#include "application_manager/mock_hmi_interface.h"
+#include "application_manager/mock_message_helper.h"
+#include "gtest/gtest.h"
namespace test {
namespace components {
@@ -50,10 +50,10 @@ namespace mobile_commands_test {
namespace set_media_clock_timer_request {
namespace am = ::application_manager;
-using sdl_rpc_plugin::commands::SetMediaClockRequest;
+using am::MockMessageHelper;
using am::commands::MessageSharedPtr;
using am::event_engine::Event;
-using am::MockMessageHelper;
+using sdl_rpc_plugin::commands::SetMediaClockRequest;
using ::testing::_;
using ::testing::Return;
using ::testing::ReturnRef;
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/show_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/show_test.cc
index 4540980b9e..b8cfdd4bfc 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/show_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/show_test.cc
@@ -31,20 +31,21 @@
*/
#include <stdint.h>
+#include <array>
#include <memory>
-#include <string>
#include <set>
+#include <string>
#include "mobile/show_request.h"
-#include "gtest/gtest.h"
#include "application_manager/commands/command_request_test.h"
+#include "application_manager/event_engine/event.h"
#include "application_manager/mock_application.h"
#include "application_manager/mock_application_manager.h"
-#include "application_manager/mock_message_helper.h"
-#include "application_manager/event_engine/event.h"
#include "application_manager/mock_hmi_interface.h"
+#include "application_manager/mock_message_helper.h"
#include "application_manager/policies/mock_policy_handler_interface.h"
+#include "gtest/gtest.h"
namespace test {
namespace components {
@@ -53,10 +54,10 @@ namespace mobile_commands_test {
namespace show_request {
namespace am = application_manager;
-using sdl_rpc_plugin::commands::ShowRequest;
+using am::MockMessageHelper;
using am::commands::CommandImpl;
using am::commands::MessageSharedPtr;
-using am::MockMessageHelper;
+using sdl_rpc_plugin::commands::ShowRequest;
using test::components::policy_test::MockPolicyHandlerInterface;
using ::testing::_;
using ::testing::Return;
@@ -68,8 +69,28 @@ const uint32_t kAppId = 1u;
const uint32_t kCmdId = 1u;
const uint32_t kConnectionKey = 2u;
const uint32_t kFunctionID = 3u;
+const std::string kCurrentTemplatelayout = "current_template_layout";
+const std::string kNewTemplateLayout = "new_template_layout";
+const app_mngr::WindowID kCurrentWindowID = 1;
+typedef std::array<int, 3> rgb_color_scheme;
+const rgb_color_scheme kCurrentDayColorRGB = {75, 75, 75};
+const rgb_color_scheme kCurrentNightColorRGB = {200, 200, 200};
+const rgb_color_scheme kNewDayColorRGB = {80, 80, 80};
+const rgb_color_scheme kNewNightColorRGB = {222, 222, 222};
+const am::WindowID kDefaultWindowId =
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW;
} // namespace
+MATCHER_P2(CheckMessageToMobile, result_code, success, "") {
+ const bool is_success =
+ (*arg)[am::strings::msg_params][am::strings::success].asBool() == success;
+
+ const bool is_result_code_correct =
+ (*arg)[am::strings::msg_params][am::strings::result_code].asInt() ==
+ static_cast<int32_t>(result_code);
+ return is_success && is_result_code_correct;
+}
+
class ShowRequestTest : public CommandRequestTest<CommandsTestMocks::kIsNice> {
public:
ShowRequestTest() {
@@ -104,6 +125,101 @@ class ShowRequestTest : public CommandRequestTest<CommandsTestMocks::kIsNice> {
return msg;
}
+ protected:
+ void SetUp() OVERRIDE {
+ ON_CALL(app_mngr_, application(kConnectionKey))
+ .WillByDefault(Return(mock_app_));
+ ON_CALL(*mock_app_, app_id()).WillByDefault(Return(kConnectionKey));
+ ON_CALL(*mock_app_, WindowIdExists(kCurrentWindowID))
+ .WillByDefault(Return(true));
+ ON_CALL(*mock_app_, window_layout(kCurrentWindowID))
+ .WillByDefault(Return(kCurrentTemplatelayout));
+ }
+
+ smart_objects::SmartObject CreateColorScheme(
+ const rgb_color_scheme& rgb_color_scheme) {
+ using namespace application_manager;
+
+ smart_objects::SmartObject primary_color(smart_objects::SmartType_Map);
+ smart_objects::SmartObject secondary_color(smart_objects::SmartType_Map);
+ smart_objects::SmartObject background_color(smart_objects::SmartType_Map);
+
+ primary_color[strings::red] = rgb_color_scheme[0];
+ primary_color[strings::green] = rgb_color_scheme[1];
+ primary_color[strings::blue] = rgb_color_scheme[2];
+
+ secondary_color[strings::red] = rgb_color_scheme[0];
+ secondary_color[strings::green] = rgb_color_scheme[1];
+ secondary_color[strings::blue] = rgb_color_scheme[2];
+
+ background_color[strings::red] = rgb_color_scheme[0];
+ background_color[strings::green] = rgb_color_scheme[1];
+ background_color[strings::blue] = rgb_color_scheme[2];
+
+ smart_objects::SmartObject color_scheme(smart_objects::SmartType_Map);
+ color_scheme[strings::primary_color] = primary_color;
+ color_scheme[strings::secondary_color] = secondary_color;
+ color_scheme[strings::background_color] = background_color;
+
+ return color_scheme;
+ }
+
+ smart_objects::SmartObject CreateTemplateConfiguration(
+ const std::string& layout) {
+ using namespace application_manager;
+
+ smart_objects::SmartObject template_configuration(
+ smart_objects::SmartType_Map);
+
+ template_configuration[strings::template_layout] = layout;
+
+ template_configuration[strings::day_color_scheme] =
+ CreateColorScheme(kCurrentDayColorRGB);
+
+ template_configuration[strings::night_color_scheme] =
+ CreateColorScheme(kCurrentNightColorRGB);
+
+ return template_configuration;
+ }
+
+ MessageSharedPtr CreateMessageWithTemplateLayout(const std::string& layout) {
+ auto msg = CreateMsgParams();
+ (*msg)[app_mngr::strings::msg_params][app_mngr::strings::window_id] =
+ kCurrentWindowID;
+ (*msg)[am::strings::msg_params][am::strings::template_configuration] =
+ CreateTemplateConfiguration(layout);
+
+ return msg;
+ }
+
+ std::shared_ptr<ShowRequest> SetupHelperLayout(
+ const std::string& layout,
+ const rgb_color_scheme& day_colors,
+ const rgb_color_scheme& night_colors) {
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_Show),
+ Command::CommandSource::SOURCE_SDL_TO_HMI))
+ .WillOnce(Return(true));
+ EXPECT_CALL(*mock_app_, app_id()).WillOnce(Return(kConnectionKey));
+ EXPECT_CALL(*mock_app_, WindowIdExists(kCurrentWindowID))
+ .WillOnce(Return(true));
+ EXPECT_CALL(app_mngr_, application(kConnectionKey))
+ .WillOnce(Return(mock_app_));
+ const auto current_day_color_scheme = CreateColorScheme(day_colors);
+ ON_CALL(*mock_app_, day_color_scheme(kCurrentWindowID))
+ .WillByDefault(Return(current_day_color_scheme));
+ const auto current_night_color_scheme = CreateColorScheme(night_colors);
+ ON_CALL(*mock_app_, night_color_scheme(kCurrentWindowID))
+ .WillByDefault(Return(current_night_color_scheme));
+ ON_CALL(*mock_app_, window_layout(kCurrentWindowID))
+ .WillByDefault(Return(kCurrentTemplatelayout));
+
+ auto msg = CreateMessageWithTemplateLayout(layout);
+
+ auto command(CreateCommand<ShowRequest>(msg));
+ return command;
+ }
+
void TestSetupHelper(MessageSharedPtr msg,
hmi_apis::Common_TextFieldName::eType field_name,
const char* field) {
@@ -269,9 +385,9 @@ TEST_F(ShowRequestTest, Run_SoftButtonExists_SUCCESS) {
msg_params[am::hmi_request::show_strings] =
smart_objects::SmartObject(smart_objects::SmartType_Array);
- EXPECT_CALL(
- mock_message_helper_,
- SubscribeApplicationToSoftButton(creation_msg_params, _, kFunctionID));
+ EXPECT_CALL(mock_message_helper_,
+ SubscribeApplicationToSoftButton(
+ creation_msg_params, _, kFunctionID, kDefaultWindowId));
EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _));
EXPECT_CALL(*mock_app_, set_show_command(msg_params));
@@ -319,7 +435,8 @@ TEST_F(ShowRequestTest, Run_SoftButtonExists_Canceled) {
EXPECT_CALL(*mock_app_, app_id()).Times(0);
- EXPECT_CALL(mock_message_helper_, SubscribeApplicationToSoftButton(_, _, _))
+ EXPECT_CALL(mock_message_helper_,
+ SubscribeApplicationToSoftButton(_, _, _, kDefaultWindowId))
.Times(0);
EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).Times(0);
EXPECT_CALL(*mock_app_, set_show_command(_)).Times(0);
@@ -729,10 +846,14 @@ TEST_F(ShowRequestTest, Run_MainField1_MetadataTagWithNoFieldData) {
hmi_apis::Common_Result::SUCCESS;
(*ev_msg)[am::strings::msg_params][am::strings::app_id] = kConnectionKey;
(*ev_msg)[am::strings::msg_params][am::strings::info] = "";
+ (*ev_msg)[am::strings::params][am::strings::connection_key] = kConnectionKey;
Event event(hmi_apis::FunctionID::UI_Show);
event.set_smart_object(*ev_msg);
+ EXPECT_CALL(app_mngr_, application(kConnectionKey))
+ .WillOnce(Return(mock_app_));
+
MessageSharedPtr ui_command_result;
EXPECT_CALL(
mock_rpc_service_,
@@ -886,34 +1007,328 @@ TEST_F(ShowRequestTest, Run_CustomPresets_WrongSyntax) {
command->Run();
}
-TEST_F(ShowRequestTest, Run_InvalidApp_Canceled) {
+TEST_F(ShowRequestTest,
+ Run_AppDoesNotExist_ExpectAppNotRegisteredResponseToMobile) {
+ const auto result_code = mobile_apis::Result::APPLICATION_NOT_REGISTERED;
+ EXPECT_CALL(mock_rpc_service_,
+ ManageMobileCommand(CheckMessageToMobile(result_code, false),
+ Command::CommandSource::SOURCE_SDL))
+ .WillOnce(Return(true));
+ EXPECT_CALL(app_mngr_, application(kConnectionKey)).WillOnce(Return(nullptr));
+
+ auto msg = CreateMsgParams();
+ auto command = CreateCommand<ShowRequest>(msg);
+ ASSERT_TRUE(command->Init());
+ command->Run();
+}
+
+TEST_F(ShowRequestTest, Run_EmptyParams_Canceled) {
MessageSharedPtr msg = CreateMsgParams();
std::shared_ptr<ShowRequest> command(CreateCommand<ShowRequest>(msg));
EXPECT_CALL(app_mngr_, application(kConnectionKey))
- .WillOnce(Return(MockAppPtr()));
+ .WillOnce(Return(mock_app_));
EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _));
EXPECT_CALL(*mock_app_, app_id()).Times(0);
EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).Times(0);
EXPECT_CALL(*mock_app_, set_show_command(_)).Times(0);
+ ASSERT_TRUE(command->Init());
command->Run();
}
-TEST_F(ShowRequestTest, Run_EmptyParams_Canceled) {
- MessageSharedPtr msg = CreateMsgParams();
+TEST_F(ShowRequestTest,
+ Run_WindowWithIDDoesNotExist_ExpectInvalidIDResponseToMobile) {
+ const auto result_code = mobile_apis::Result::INVALID_ID;
+ EXPECT_CALL(mock_rpc_service_,
+ ManageMobileCommand(CheckMessageToMobile(result_code, false),
+ Command::CommandSource::SOURCE_SDL))
+ .WillOnce(Return(true));
+ EXPECT_CALL(app_mngr_, application(kConnectionKey))
+ .WillOnce(Return(mock_app_));
+ ON_CALL(*mock_app_, WindowIdExists(kCurrentWindowID))
+ .WillByDefault(Return(false));
- std::shared_ptr<ShowRequest> command(CreateCommand<ShowRequest>(msg));
+ auto msg = CreateMsgParams();
+ (*msg)[am::strings::msg_params][am::strings::window_id] = kCurrentWindowID;
+
+ auto command = CreateCommand<ShowRequest>(msg);
+ ASSERT_TRUE(command->Init());
+ command->Run();
+}
+
+TEST_F(ShowRequestTest,
+ Run_NoLayoutChangeWithoutBothColorScheme_SendRequestToHMI_SUCCESS) {
+ auto msg = CreateMsgParams();
+ (*msg)[app_mngr::strings::msg_params][app_mngr::strings::window_id] =
+ kCurrentWindowID;
+ (*msg)[am::strings::msg_params][am::strings::template_configuration]
+ [am::strings::template_layout] = kCurrentTemplatelayout;
+
+ auto command(CreateCommand<ShowRequest>(msg));
+
+ auto message_to_hmi = CreateMessage();
+
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _))
+ .WillOnce(DoAll(SaveArg<0>(&message_to_hmi), Return(true)));
+
+ ASSERT_TRUE(command->Init());
+ command->Run();
+
+ const auto template_layout =
+ (*message_to_hmi)[am::strings::msg_params]
+ [am::strings::template_configuration]
+ [am::strings::template_layout]
+ .asString();
+ EXPECT_EQ(kCurrentTemplatelayout, template_layout);
+}
+
+TEST_F(ShowRequestTest,
+ Run_NoLayoutChangeDayColorSchemesNotEqual_Response_REJECTED) {
+ auto msg = CreateMessageWithTemplateLayout(kCurrentTemplatelayout);
+
+ const auto current_day_color_scheme = CreateColorScheme(kNewDayColorRGB);
+
+ auto command(CreateCommand<ShowRequest>(msg));
+
+ ON_CALL(*mock_app_, day_color_scheme(kCurrentWindowID))
+ .WillByDefault(Return(current_day_color_scheme));
+
+ auto message_to_mobile = CreateMessage();
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageMobileCommand(_, am::commands::Command::CommandSource::SOURCE_SDL))
+ .WillOnce(DoAll(SaveArg<0>(&message_to_mobile), Return(true)));
+
+ ASSERT_TRUE(command->Init());
+ command->Run();
+
+ const bool success =
+ (*message_to_mobile)[am::strings::msg_params][am::strings::success]
+ .asBool();
+ EXPECT_FALSE(success);
+
+ const auto result_code = static_cast<mobile_apis::Result::eType>(
+ (*message_to_mobile)[am::strings::msg_params][am::strings::result_code]
+ .asUInt());
+
+ EXPECT_EQ(mobile_apis::Result::REJECTED, result_code);
+}
+
+TEST_F(ShowRequestTest,
+ Run_NoLayoutChangeNightColorSchemesNotEqual_Response_REJECTED) {
+ auto msg = CreateMessageWithTemplateLayout(kCurrentTemplatelayout);
+
+ const auto current_night_color_scheme = CreateColorScheme(kNewNightColorRGB);
+
+ auto command(CreateCommand<ShowRequest>(msg));
+
+ ON_CALL(*mock_app_, day_color_scheme(kCurrentWindowID))
+ .WillByDefault(Return(current_night_color_scheme));
+
+ auto message_to_mobile = CreateMessage();
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageMobileCommand(_, am::commands::Command::CommandSource::SOURCE_SDL))
+ .WillOnce(DoAll(SaveArg<0>(&message_to_mobile), Return(true)));
+
+ ASSERT_TRUE(command->Init());
+ command->Run();
+
+ const bool success =
+ (*message_to_mobile)[am::strings::msg_params][am::strings::success]
+ .asBool();
+ EXPECT_FALSE(success);
+ const auto result_code = static_cast<mobile_apis::Result::eType>(
+ (*message_to_mobile)[am::strings::msg_params][am::strings::result_code]
+ .asUInt());
+
+ EXPECT_EQ(mobile_apis::Result::REJECTED, result_code);
+}
+
+TEST_F(ShowRequestTest,
+ Run_LayoutNotChangeBothColorSchemeEqual_SendRequestToHMI_SUCCESS) {
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_Show),
+ Command::CommandSource::SOURCE_SDL_TO_HMI))
+ .WillOnce(Return(true));
+ EXPECT_CALL(*mock_app_, app_id()).WillOnce(Return(kConnectionKey));
+ EXPECT_CALL(*mock_app_, WindowIdExists(kCurrentWindowID))
+ .WillOnce(Return(true));
EXPECT_CALL(app_mngr_, application(kConnectionKey))
.WillOnce(Return(mock_app_));
- EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _));
- EXPECT_CALL(*mock_app_, app_id()).Times(0);
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).Times(0);
- EXPECT_CALL(*mock_app_, set_show_command(_)).Times(0);
+ const auto current_day_color_scheme = CreateColorScheme(kCurrentDayColorRGB);
+ ON_CALL(*mock_app_, day_color_scheme(kCurrentWindowID))
+ .WillByDefault(Return(current_day_color_scheme));
+ const auto current_night_color_scheme =
+ CreateColorScheme(kCurrentNightColorRGB);
+ ON_CALL(*mock_app_, night_color_scheme(kCurrentWindowID))
+ .WillByDefault(Return(current_night_color_scheme));
+ ON_CALL(*mock_app_, window_layout(kCurrentWindowID))
+ .WillByDefault(Return(kCurrentTemplatelayout));
+
+ auto msg = CreateMessageWithTemplateLayout(kCurrentTemplatelayout);
+
+ auto command(CreateCommand<ShowRequest>(msg));
+ ASSERT_TRUE(command->Init());
+ command->Run();
+}
+
+TEST_F(ShowRequestTest,
+ Run_LayoutChangeBothColorSchemeNotEqual_SendRequestToHMI_SUCCESS) {
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_Show),
+ Command::CommandSource::SOURCE_SDL_TO_HMI))
+ .WillOnce(Return(true));
+ EXPECT_CALL(*mock_app_, app_id()).WillOnce(Return(kConnectionKey));
+ EXPECT_CALL(*mock_app_, WindowIdExists(kCurrentWindowID))
+ .WillOnce(Return(true));
+ EXPECT_CALL(app_mngr_, application(kConnectionKey))
+ .WillOnce(Return(mock_app_));
+ const auto current_day_color_scheme = CreateColorScheme(kNewDayColorRGB);
+ ON_CALL(*mock_app_, day_color_scheme(kCurrentWindowID))
+ .WillByDefault(Return(current_day_color_scheme));
+ const auto current_night_color_scheme = CreateColorScheme(kNewNightColorRGB);
+ ON_CALL(*mock_app_, night_color_scheme(kCurrentWindowID))
+ .WillByDefault(Return(current_night_color_scheme));
+ ON_CALL(*mock_app_, window_layout(kCurrentWindowID))
+ .WillByDefault(Return(kCurrentTemplatelayout));
+
+ auto msg = CreateMessageWithTemplateLayout(kNewTemplateLayout);
+
+ auto command(CreateCommand<ShowRequest>(msg));
+ ASSERT_TRUE(command->Init());
+ command->Run();
+}
+
+TEST_F(ShowRequestTest, OnEvent_SuccessResultCode_ExpectSetWindowLayoutOnly) {
+ // Precondition
+ auto command =
+ SetupHelperLayout(kNewTemplateLayout, kNewDayColorRGB, kNewNightColorRGB);
+ ASSERT_TRUE(command->Init());
+ command->Run();
+ // Expectation
+ EXPECT_CALL(*mock_app_,
+ set_window_layout(kCurrentWindowID, kNewTemplateLayout));
+ EXPECT_CALL(*mock_app_, set_day_color_scheme(_, _));
+ EXPECT_CALL(*mock_app_, set_night_color_scheme(_, _));
+ EXPECT_CALL(mock_rpc_service_,
+ ManageMobileCommand(
+ CheckMessageToMobile(mobile_apis::Result::SUCCESS, true),
+ Command::CommandSource::SOURCE_SDL));
+ EXPECT_CALL(app_mngr_, application(kConnectionKey))
+ .WillOnce(Return(mock_app_));
+
+ auto msg = CreateMessage();
+ (*msg)[am::strings::params][am::hmi_response::code] =
+ hmi_apis::Common_Result::eType::SUCCESS;
+ (*msg)[am::strings::msg_params] = SmartObject(smart_objects::SmartType_Map);
+
+ Event event(hmi_apis::FunctionID::UI_Show);
+ event.set_smart_object(*msg);
+
+ command->on_event(event);
+}
+
+TEST_F(ShowRequestTest,
+ OnEvent_SuccessResultCode_ExpectSetWindowLayoutAndSetDayColorScheme) {
+ // Precondition
+ auto command = SetupHelperLayout(
+ kNewTemplateLayout, kCurrentDayColorRGB, kNewNightColorRGB);
+ ASSERT_TRUE(command->Init());
+ command->Run();
+ // Expectation
+ EXPECT_CALL(*mock_app_,
+ set_window_layout(kCurrentWindowID, kNewTemplateLayout));
+ EXPECT_CALL(*mock_app_,
+ set_day_color_scheme(kCurrentWindowID,
+ CreateColorScheme(kCurrentDayColorRGB)));
+ EXPECT_CALL(*mock_app_, set_night_color_scheme(_, _));
+ EXPECT_CALL(mock_rpc_service_,
+ ManageMobileCommand(
+ CheckMessageToMobile(mobile_apis::Result::SUCCESS, true),
+ Command::CommandSource::SOURCE_SDL));
+ EXPECT_CALL(app_mngr_, application(kConnectionKey))
+ .WillOnce(Return(mock_app_));
+
+ auto msg = CreateMessage();
+ (*msg)[am::strings::params][am::hmi_response::code] =
+ hmi_apis::Common_Result::eType::SUCCESS;
+ (*msg)[am::strings::msg_params] = SmartObject(smart_objects::SmartType_Map);
+
+ Event event(hmi_apis::FunctionID::UI_Show);
+ event.set_smart_object(*msg);
+
+ command->on_event(event);
+}
+TEST_F(ShowRequestTest,
+ OnEvent_SuccessResultCode_ExpectSetWindowLayoutAndBothColorScheme) {
+ // Precondition
+ auto command = SetupHelperLayout(
+ kNewTemplateLayout, kCurrentDayColorRGB, kCurrentNightColorRGB);
+ ASSERT_TRUE(command->Init());
command->Run();
+ // Expectation
+ EXPECT_CALL(*mock_app_,
+ set_window_layout(kCurrentWindowID, kNewTemplateLayout));
+ EXPECT_CALL(*mock_app_,
+ set_day_color_scheme(kCurrentWindowID,
+ CreateColorScheme(kCurrentDayColorRGB)));
+ EXPECT_CALL(*mock_app_,
+ set_night_color_scheme(kCurrentWindowID,
+ CreateColorScheme(kCurrentNightColorRGB)));
+ EXPECT_CALL(mock_rpc_service_,
+ ManageMobileCommand(
+ CheckMessageToMobile(mobile_apis::Result::SUCCESS, true),
+ Command::CommandSource::SOURCE_SDL));
+ EXPECT_CALL(app_mngr_, application(kConnectionKey))
+ .WillOnce(Return(mock_app_));
+
+ auto msg = CreateMessage();
+ (*msg)[am::strings::params][am::hmi_response::code] =
+ hmi_apis::Common_Result::eType::SUCCESS;
+ (*msg)[am::strings::msg_params] = SmartObject(smart_objects::SmartType_Map);
+
+ Event event(hmi_apis::FunctionID::UI_Show);
+ event.set_smart_object(*msg);
+
+ command->on_event(event);
+}
+
+TEST_F(ShowRequestTest,
+ OnEvent_SuccessResultCode_ExpectBothColorSchemeWithoutSetWindowLayout) {
+ // Precondition
+ auto command = SetupHelperLayout(
+ kCurrentTemplatelayout, kCurrentDayColorRGB, kCurrentNightColorRGB);
+ ASSERT_TRUE(command->Init());
+ command->Run();
+ // Expectation
+ EXPECT_CALL(*mock_app_, set_window_layout(_, _)).Times(0);
+ EXPECT_CALL(*mock_app_,
+ set_day_color_scheme(kCurrentWindowID,
+ CreateColorScheme(kCurrentDayColorRGB)));
+ EXPECT_CALL(*mock_app_,
+ set_night_color_scheme(kCurrentWindowID,
+ CreateColorScheme(kCurrentNightColorRGB)));
+ EXPECT_CALL(mock_rpc_service_,
+ ManageMobileCommand(
+ CheckMessageToMobile(mobile_apis::Result::SUCCESS, true),
+ Command::CommandSource::SOURCE_SDL));
+ EXPECT_CALL(app_mngr_, application(kConnectionKey))
+ .WillOnce(Return(mock_app_));
+
+ auto msg = CreateMessage();
+ (*msg)[am::strings::params][am::hmi_response::code] =
+ hmi_apis::Common_Result::eType::SUCCESS;
+ (*msg)[am::strings::msg_params] = SmartObject(smart_objects::SmartType_Map);
+
+ Event event(hmi_apis::FunctionID::UI_Show);
+ event.set_smart_object(*msg);
+
+ command->on_event(event);
}
TEST_F(ShowRequestTest, OnEvent_SuccessResultCode_SUCCESS) {
@@ -931,7 +1346,7 @@ TEST_F(ShowRequestTest, OnEvent_SuccessResultCode_SUCCESS) {
event.set_smart_object(*msg);
EXPECT_CALL(app_mngr_, application(_)).WillRepeatedly(Return(mock_app_));
-
+ ASSERT_TRUE(command->Init());
command->on_event(event);
}
@@ -957,6 +1372,10 @@ TEST_F(ShowRequestTest, OnEvent_WrongFunctionID_Canceled) {
MessageSharedPtr msg = CreateMessage();
(*msg)[am::strings::params][am::hmi_response::code] =
mobile_apis::Result::SUCCESS;
+ (*msg)[am::strings::params][am::strings::connection_key] = kConnectionKey;
+
+ ON_CALL(app_mngr_, application(kConnectionKey))
+ .WillByDefault(Return(mock_app_));
std::shared_ptr<ShowRequest> command(CreateCommand<ShowRequest>(msg));
EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _)).Times(0);
@@ -971,4 +1390,4 @@ TEST_F(ShowRequestTest, OnEvent_WrongFunctionID_Canceled) {
} // namespace mobile_commands_test
} // namespace commands_test
} // namespace components
-} // namespace tests
+} // namespace test
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/simple_notification_commands_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/simple_notification_commands_test.cc
index d96a9d7643..6e85aff281 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/simple_notification_commands_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/simple_notification_commands_test.cc
@@ -35,16 +35,16 @@
#include "gtest/gtest.h"
-#include "smart_objects/smart_object.h"
-#include "application_manager/smart_object_keys.h"
-#include "application_manager/mock_message_helper.h"
#include "application_manager/commands/command_impl.h"
#include "application_manager/commands/commands_test.h"
+#include "application_manager/mock_message_helper.h"
+#include "application_manager/smart_object_keys.h"
#include "mobile/on_app_interface_unregistered_notification.h"
#include "mobile/on_audio_pass_thru_notification.h"
#include "mobile/on_driver_distraction_notification.h"
#include "mobile/on_language_change_notification.h"
#include "mobile/on_permissions_change_notification.h"
+#include "smart_objects/smart_object.h"
namespace test {
namespace components {
@@ -56,8 +56,8 @@ namespace am = ::application_manager;
namespace commands = sdl_rpc_plugin::commands;
using ::testing::_;
-using ::testing::Types;
using ::testing::Return;
+using ::testing::Types;
template <class Command>
class MobileNotificationCommandsTest
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/simple_response_commands_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/simple_response_commands_test.cc
index bbd39874e0..0034dcf916 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/simple_response_commands_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/simple_response_commands_test.cc
@@ -38,37 +38,36 @@
#include "application_manager/commands/commands_test.h"
#include "application_manager/mock_application_manager.h"
-#include "mobile/delete_command_response.h"
+#include "mobile/add_command_response.h"
+#include "mobile/add_sub_menu_response.h"
#include "mobile/alert_maneuver_response.h"
#include "mobile/alert_response.h"
-#include "mobile/list_files_response.h"
-#include "mobile/subscribe_button_response.h"
-#include "mobile/add_sub_menu_response.h"
+#include "mobile/change_registration_response.h"
+#include "mobile/delete_command_response.h"
#include "mobile/dial_number_response.h"
#include "mobile/end_audio_pass_thru_response.h"
-#include "mobile/unregister_app_interface_response.h"
-#include "mobile/unsubscribe_button_response.h"
-#include "mobile/unsubscribe_way_points_response.h"
-#include "mobile/update_turn_list_response.h"
-#include "mobile/slider_response.h"
-#include "mobile/speak_response.h"
-#include "mobile/subscribe_way_points_response.h"
-#include "mobile/system_response.h"
+#include "mobile/generic_response.h"
#include "mobile/get_way_points_response.h"
-#include "mobile/perform_interaction_response.h"
+#include "mobile/list_files_response.h"
#include "mobile/perform_audio_pass_thru_response.h"
+#include "mobile/perform_interaction_response.h"
+#include "mobile/scrollable_message_response.h"
+#include "mobile/send_location_response.h"
+#include "mobile/set_app_icon_response.h"
+#include "mobile/set_display_layout_response.h"
#include "mobile/set_global_properties_response.h"
#include "mobile/set_media_clock_timer_response.h"
#include "mobile/show_constant_tbt_response.h"
#include "mobile/show_response.h"
-#include "mobile/add_command_response.h"
-#include "mobile/send_location_response.h"
-#include "mobile/set_app_icon_response.h"
-#include "mobile/set_display_layout_response.h"
-#include "mobile/generic_response.h"
-#include "mobile/set_app_icon_response.h"
-#include "mobile/scrollable_message_response.h"
-#include "mobile/change_registration_response.h"
+#include "mobile/slider_response.h"
+#include "mobile/speak_response.h"
+#include "mobile/subscribe_button_response.h"
+#include "mobile/subscribe_way_points_response.h"
+#include "mobile/system_response.h"
+#include "mobile/unregister_app_interface_response.h"
+#include "mobile/unsubscribe_button_response.h"
+#include "mobile/unsubscribe_way_points_response.h"
+#include "mobile/update_turn_list_response.h"
namespace test {
namespace components {
@@ -120,7 +119,8 @@ typedef Types<commands::ListFilesResponse,
commands::SendLocationResponse,
commands::SetAppIconResponse,
commands::SetDisplayLayoutResponse,
- commands::ChangeRegistrationResponse> ResponseCommandsList;
+ commands::ChangeRegistrationResponse>
+ ResponseCommandsList;
TYPED_TEST_CASE(MobileResponseCommandsTest, ResponseCommandsList);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/slider_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/slider_test.cc
index 14e670a387..0450f06ee1 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/slider_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/slider_test.cc
@@ -31,19 +31,19 @@
*/
#include <stdint.h>
-#include <string>
#include <set>
+#include <string>
#include "mobile/slider_request.h"
-#include "gtest/gtest.h"
#include "application_manager/commands/command_request_test.h"
+#include "application_manager/event_engine/event.h"
#include "application_manager/mock_application.h"
#include "application_manager/mock_application_manager.h"
-#include "application_manager/mock_message_helper.h"
-#include "application_manager/event_engine/event.h"
#include "application_manager/mock_hmi_interface.h"
+#include "application_manager/mock_message_helper.h"
#include "application_manager/policies/mock_policy_handler_interface.h"
+#include "gtest/gtest.h"
namespace test {
namespace components {
@@ -52,11 +52,11 @@ namespace mobile_commands_test {
namespace slider_request {
namespace am = application_manager;
-using sdl_rpc_plugin::commands::SliderRequest;
+using am::MockMessageHelper;
using am::commands::CommandImpl;
using am::commands::MessageSharedPtr;
-using am::MockMessageHelper;
using policy_test::MockPolicyHandlerInterface;
+using sdl_rpc_plugin::commands::SliderRequest;
using ::testing::_;
using ::testing::Return;
using ::testing::ReturnRef;
@@ -337,4 +337,4 @@ TEST_F(SliderRequestTest, OnEvent_UISliderAborted_SUCCESS) {
} // namespace mobile_commands_test
} // namespace commands_test
} // namespace components
-} // namespace tests
+} // namespace test
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/speak_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/speak_request_test.cc
index 5dcbd7e6b9..87320d3a7a 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/speak_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/speak_request_test.cc
@@ -31,26 +31,26 @@
POSSIBILITY OF SUCH DAMAGE.
*/
+#include "mobile/speak_request.h"
#include <string>
#include "gtest/gtest.h"
-#include "mobile/speak_request.h"
-#include "application_manager/commands/commands_test.h"
#include "application_manager/commands/command_request_test.h"
+#include "application_manager/commands/commands_test.h"
#include "interfaces/HMI_API.h"
#include "interfaces/MOBILE_API.h"
#include "utils/helpers.h"
-#include "smart_objects/smart_object.h"
-#include "utils/custom_string.h"
#include "application_manager/application.h"
-#include "application_manager/smart_object_keys.h"
+#include "application_manager/event_engine/event.h"
#include "application_manager/mock_application.h"
#include "application_manager/mock_application_manager.h"
-#include "application_manager/mock_message_helper.h"
-#include "application_manager/event_engine/event.h"
#include "application_manager/mock_hmi_interface.h"
+#include "application_manager/mock_message_helper.h"
+#include "application_manager/smart_object_keys.h"
+#include "smart_objects/smart_object.h"
+#include "utils/custom_string.h"
namespace test {
namespace components {
@@ -62,24 +62,24 @@ namespace am = application_manager;
namespace mobile_result = mobile_apis::Result;
namespace hmi_response = ::application_manager::hmi_response;
namespace strings = ::application_manager::strings;
-using am::commands::CommandImpl;
using am::ApplicationManager;
-using am::commands::MessageSharedPtr;
using am::ApplicationSharedPtr;
using am::MockMessageHelper;
+using am::commands::CommandImpl;
+using am::commands::MessageSharedPtr;
using ::testing::_;
-using ::testing::Return;
-using ::testing::ReturnRef;
using sdl_rpc_plugin::commands::SpeakRequest;
using ::test::components::application_manager_test::MockApplication;
+using ::testing::Return;
+using ::testing::ReturnRef;
typedef std::shared_ptr<SpeakRequest> CommandPtr;
namespace {
const uint32_t kAppId = 10u;
const uint32_t kConnectionKey = 5u;
-}
+} // namespace
class SpeakRequestTest : public CommandRequestTest<CommandsTestMocks::kIsNice> {
public:
@@ -402,5 +402,5 @@ TEST_F(SpeakRequestTest, OnEvent_ApplicationIsNotRegistered_UNSUCCESS) {
} // namespace speak_request
} // namespace mobile_commands_test
} // namespace commands_test
-} // namespace component
+} // namespace components
} // namespace test
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/subscribe_button_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/subscribe_button_request_test.cc
index df3e778ee6..786f2b6bd1 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/subscribe_button_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/subscribe_button_request_test.cc
@@ -35,16 +35,16 @@
#include "gtest/gtest.h"
-#include "smart_objects/smart_object.h"
-#include "application_manager/commands/commands_test.h"
-#include "application_manager/commands/command_request_test.h"
#include "application_manager/application.h"
-#include "application_manager/mock_application_manager.h"
+#include "application_manager/commands/command_request_test.h"
+#include "application_manager/commands/commands_test.h"
#include "application_manager/mock_application.h"
+#include "application_manager/mock_application_manager.h"
#include "application_manager/mock_hmi_capabilities.h"
-#include "mobile/subscribe_button_request.h"
-#include "interfaces/MOBILE_API.h"
#include "application_manager/smart_object_keys.h"
+#include "interfaces/MOBILE_API.h"
+#include "mobile/subscribe_button_request.h"
+#include "smart_objects/smart_object.h"
namespace test {
namespace components {
@@ -53,13 +53,13 @@ namespace mobile_commands_test {
namespace subscribe_button_request {
using ::testing::_;
+using ::testing::DoAll;
using ::testing::Return;
using ::testing::ReturnRef;
-using ::testing::DoAll;
using ::testing::SaveArg;
namespace am = ::application_manager;
-using sdl_rpc_plugin::commands::SubscribeButtonRequest;
using am::commands::MessageSharedPtr;
+using sdl_rpc_plugin::commands::SubscribeButtonRequest;
typedef std::shared_ptr<SubscribeButtonRequest> CommandPtr;
@@ -106,6 +106,23 @@ TEST_F(SubscribeButtonRequestTest, Run_SubscriptionNotAllowed_UNSUCCESS) {
.asInt()));
}
+TEST_F(SubscribeButtonRequestTest, Run_NavSubscriptionNotAllowed_UNSUCCESS) {
+ MessageSharedPtr msg(CreateMessage());
+ (*msg)[am::strings::msg_params][am::strings::button_name] =
+ mobile_apis::ButtonName::NAV_CENTER_LOCATION;
+ CommandPtr command(CreateCommand<SubscribeButtonRequest>(msg));
+
+ MockAppPtr app(CreateMockApp());
+ ON_CALL(app_mngr_, application(_)).WillByDefault(Return(app));
+ ON_CALL(*app, is_navi()).WillByDefault(Return(false));
+
+ MessageSharedPtr result_msg(CatchMobileCommandResult(CallRun(*command)));
+ EXPECT_EQ(mobile_apis::Result::REJECTED,
+ static_cast<mobile_apis::Result::eType>(
+ (*result_msg)[am::strings::msg_params][am::strings::result_code]
+ .asInt()));
+}
+
TEST_F(SubscribeButtonRequestTest, Run_UiIsNotSupported_UNSUCCESS) {
CommandPtr command(CreateCommand<SubscribeButtonRequest>());
@@ -199,7 +216,55 @@ TEST_F(SubscribeButtonRequestTest, Run_SUCCESS) {
EXPECT_EQ(mobile_apis::Result::SUCCESS,
static_cast<mobile_apis::Result::eType>(
(*mobile_result_msg)[am::strings::msg_params]
- [am::strings::result_code].asInt()));
+ [am::strings::result_code]
+ .asInt()));
+}
+
+TEST_F(SubscribeButtonRequestTest, Run_NAV_SUCCESS) {
+ const mobile_apis::ButtonName::eType kButtonName =
+ mobile_apis::ButtonName::NAV_CENTER_LOCATION;
+
+ MessageSharedPtr msg(CreateMessage());
+ (*msg)[am::strings::msg_params][am::strings::button_name] = kButtonName;
+ CommandPtr command(CreateCommand<SubscribeButtonRequest>(msg));
+
+ MockAppPtr app(CreateMockApp());
+ ON_CALL(app_mngr_, application(_)).WillByDefault(Return(app));
+ ON_CALL(*app, msg_version()).WillByDefault(ReturnRef(mock_semantic_version));
+ ON_CALL(*app, is_navi()).WillByDefault(Return(true));
+
+ ON_CALL(mock_hmi_capabilities_, is_ui_cooperating())
+ .WillByDefault(Return(true));
+
+ MessageSharedPtr button_caps_ptr(CreateMessage(smart_objects::SmartType_Map));
+ (*button_caps_ptr)[0][am::hmi_response::button_name] = kButtonName;
+
+ ON_CALL(mock_hmi_capabilities_, button_capabilities())
+ .WillByDefault(Return(button_caps_ptr.get()));
+
+ ON_CALL(*app, IsSubscribedToButton(_)).WillByDefault(Return(false));
+
+ MessageSharedPtr hmi_result_msg;
+
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _))
+ .WillOnce(DoAll(SaveArg<0>(&hmi_result_msg), Return(true)));
+
+ MessageSharedPtr mobile_result_msg;
+ EXPECT_CALL(this->mock_rpc_service_, ManageMobileCommand(_, _))
+ .WillOnce(DoAll(SaveArg<0>(&mobile_result_msg), Return(true)));
+ ASSERT_TRUE(command->Init());
+ command->Run();
+
+ EXPECT_EQ(hmi_apis::FunctionID::Buttons_OnButtonSubscription,
+ static_cast<hmi_apis::FunctionID::eType>(
+ (*hmi_result_msg)[am::strings::params][am::strings::function_id]
+ .asInt()));
+
+ EXPECT_EQ(mobile_apis::Result::SUCCESS,
+ static_cast<mobile_apis::Result::eType>(
+ (*mobile_result_msg)[am::strings::msg_params]
+ [am::strings::result_code]
+ .asInt()));
}
TEST_F(SubscribeButtonRequestTest, Run_SUCCESS_App_Base_RPC_Version) {
@@ -252,7 +317,8 @@ TEST_F(SubscribeButtonRequestTest, Run_SUCCESS_App_Base_RPC_Version) {
EXPECT_EQ(mobile_apis::Result::SUCCESS,
static_cast<mobile_apis::Result::eType>(
(*mobile_result_msg)[am::strings::msg_params]
- [am::strings::result_code].asInt()));
+ [am::strings::result_code]
+ .asInt()));
}
} // namespace subscribe_button_request
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/subscribe_way_points_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/subscribe_way_points_request_test.cc
index d08c13b3f3..56e4e05d48 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/subscribe_way_points_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/subscribe_way_points_request_test.cc
@@ -32,17 +32,17 @@
#include "gtest/gtest.h"
-#include "smart_objects/smart_object.h"
-#include "application_manager/commands/commands_test.h"
-#include "application_manager/commands/command_request_test.h"
#include "application_manager/application.h"
-#include "application_manager/mock_application_manager.h"
+#include "application_manager/commands/command_request_test.h"
+#include "application_manager/commands/commands_test.h"
#include "application_manager/mock_application.h"
+#include "application_manager/mock_application_manager.h"
#include "application_manager/mock_hmi_capabilities.h"
#include "application_manager/mock_message_helper.h"
-#include "mobile/subscribe_way_points_request.h"
-#include "interfaces/MOBILE_API.h"
#include "application_manager/smart_object_keys.h"
+#include "interfaces/MOBILE_API.h"
+#include "mobile/subscribe_way_points_request.h"
+#include "smart_objects/smart_object.h"
namespace test {
namespace components {
@@ -52,14 +52,14 @@ namespace subscribe_way_points_request {
using ::testing::_;
using ::testing::A;
+using ::testing::DoAll;
+using ::testing::InSequence;
using ::testing::Return;
using ::testing::ReturnRef;
-using ::testing::DoAll;
using ::testing::SaveArg;
-using ::testing::InSequence;
namespace am = ::application_manager;
-using sdl_rpc_plugin::commands::SubscribeWayPointsRequest;
using am::commands::MessageSharedPtr;
+using sdl_rpc_plugin::commands::SubscribeWayPointsRequest;
typedef std::shared_ptr<SubscribeWayPointsRequest> CommandPtr;
@@ -90,7 +90,8 @@ TEST_F(SubscribeWayPointsRequestTest, Run_SUCCESS) {
EXPECT_EQ(mobile_apis::Result::SUCCESS,
static_cast<mobile_apis::Result::eType>(
(*mobile_result_msg)[am::strings::msg_params]
- [am::strings::result_code].asInt()));
+ [am::strings::result_code]
+ .asInt()));
}
TEST_F(SubscribeWayPointsRequestTest, OnEvent_SUCCESS) {
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/system_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/system_request_test.cc
index 298661dc74..211888d6be 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/system_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/system_request_test.cc
@@ -31,18 +31,18 @@
*/
#include <stdint.h>
-#include <string>
#include <set>
+#include <string>
#include "gtest/gtest.h"
-#include "mobile/system_request.h"
#include "application_manager/commands/command_request_test.h"
+#include "application_manager/event_engine/event.h"
#include "application_manager/mock_application.h"
#include "application_manager/mock_application_manager.h"
-#include "application_manager/event_engine/event.h"
#include "application_manager/mock_hmi_interface.h"
#include "application_manager/policies/mock_policy_handler_interface.h"
+#include "mobile/system_request.h"
namespace test {
namespace components {
@@ -51,13 +51,13 @@ namespace mobile_commands_test {
namespace system_request {
namespace am = application_manager;
-using sdl_rpc_plugin::commands::SystemRequest;
+using am::MessageType;
+using am::MockHmiInterfaces;
using am::commands::CommandImpl;
using am::commands::MessageSharedPtr;
-using am::MockHmiInterfaces;
using am::event_engine::Event;
-using am::MessageType;
using policy_test::MockPolicyHandlerInterface;
+using sdl_rpc_plugin::commands::SystemRequest;
using ::testing::_;
using ::testing::DoAll;
@@ -74,6 +74,7 @@ const std::string kAppStorageFolder = "fake-storage";
const std::string kSystemFilesPath = "/fake/system/files";
const std::string kFileName = "Filename";
const uint32_t kHmiAppId = 3u;
+const connection_handler::DeviceHandle kDeviceId = 1u;
} // namespace
class SystemRequestTest
@@ -99,13 +100,15 @@ class SystemRequestTest
ON_CALL(*mock_app_, policy_app_id()).WillByDefault(Return(kAppPolicyId));
ON_CALL(*mock_app_, folder_name()).WillByDefault(Return(kAppFolderName));
ON_CALL(*mock_app_, hmi_app_id()).WillByDefault(Return(kHmiAppId));
+ ON_CALL(*mock_app_, device()).WillByDefault(Return(kDeviceId));
ON_CALL(app_mngr_settings_, system_files_path())
.WillByDefault(ReturnRef(kSystemFilesPath));
ON_CALL(app_mngr_settings_, app_storage_folder())
.WillByDefault(ReturnRef(kAppStorageFolder));
- ON_CALL(mock_policy_handler_, IsRequestTypeAllowed(kAppPolicyId, _))
+ ON_CALL(mock_policy_handler_,
+ IsRequestTypeAllowed(kDeviceId, kAppPolicyId, _))
.WillByDefault(Return(true));
}
@@ -146,9 +149,10 @@ TEST_F(SystemRequestTest,
PreConditions();
- EXPECT_CALL(mock_policy_handler_,
- IsRequestTypeAllowed(kAppPolicyId,
- mobile_apis::RequestType::OEM_SPECIFIC))
+ EXPECT_CALL(
+ mock_policy_handler_,
+ IsRequestTypeAllowed(
+ kDeviceId, kAppPolicyId, mobile_apis::RequestType::OEM_SPECIFIC))
.WillOnce(Return(true));
EXPECT_CALL(mock_policy_handler_,
@@ -191,9 +195,10 @@ TEST_F(
PreConditions();
- EXPECT_CALL(mock_policy_handler_,
- IsRequestTypeAllowed(kAppPolicyId,
- mobile_apis::RequestType::OEM_SPECIFIC))
+ EXPECT_CALL(
+ mock_policy_handler_,
+ IsRequestTypeAllowed(
+ kDeviceId, kAppPolicyId, mobile_apis::RequestType::OEM_SPECIFIC))
.WillOnce(Return(true));
EXPECT_CALL(mock_policy_handler_,
@@ -216,9 +221,10 @@ TEST_F(SystemRequestTest, Run_RequestTypeDisallowed_SendDisallowedResponse) {
PreConditions();
- EXPECT_CALL(mock_policy_handler_,
- IsRequestTypeAllowed(kAppPolicyId,
- mobile_apis::RequestType::OEM_SPECIFIC))
+ EXPECT_CALL(
+ mock_policy_handler_,
+ IsRequestTypeAllowed(
+ kDeviceId, kAppPolicyId, mobile_apis::RequestType::OEM_SPECIFIC))
.WillOnce(Return(false));
ExpectManageMobileCommandWithResultCode(mobile_apis::Result::DISALLOWED);
@@ -229,6 +235,37 @@ TEST_F(SystemRequestTest, Run_RequestTypeDisallowed_SendDisallowedResponse) {
command->Run();
}
+TEST_F(SystemRequestTest, Run_RequestType_IconURL_Success) {
+ PreConditions();
+ MessageSharedPtr msg = CreateIVSUMessage();
+ (*msg)[am::strings::msg_params][am::strings::request_type] =
+ mobile_apis::RequestType::ICON_URL;
+
+ const std::string url = "https://www.appsfakeiconurlendpoint.com/icon.png";
+
+ (*msg)[am::strings::msg_params][am::strings::file_name] = url;
+ const std::vector<uint8_t> binary_data = {1u, 2u};
+ (*msg)[am::strings::params][am::strings::binary_data] = binary_data;
+
+ EXPECT_CALL(mock_policy_handler_,
+ IsRequestTypeAllowed(
+ kDeviceId, kAppPolicyId, mobile_apis::RequestType::ICON_URL))
+ .WillOnce(Return(true));
+ EXPECT_CALL(app_mngr_settings_, app_icons_folder())
+ .WillOnce(ReturnRef(kAppStorageFolder));
+ EXPECT_CALL(app_mngr_, PolicyIDByIconUrl(url)).WillOnce(Return(kAppPolicyId));
+
+ EXPECT_CALL(app_mngr_,
+ SaveBinary(binary_data, kAppStorageFolder, kAppPolicyId, 0u))
+ .WillOnce(Return(mobile_apis::Result::SUCCESS));
+
+ EXPECT_CALL(app_mngr_, SetIconFileFromSystemRequest(kAppPolicyId)).Times(1);
+
+ std::shared_ptr<SystemRequest> command(CreateCommand<SystemRequest>(msg));
+ ASSERT_TRUE(command->Init());
+ command->Run();
+}
+
} // namespace system_request
} // namespace mobile_commands_test
} // namespace commands_test
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/unregister_app_interface_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/unregister_app_interface_request_test.cc
index 771374348b..f244acb8d6 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/unregister_app_interface_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/unregister_app_interface_request_test.cc
@@ -51,8 +51,8 @@ namespace mobile_result = mobile_apis::Result;
using ::testing::_;
-using sdl_rpc_plugin::commands::UnregisterAppInterfaceRequest;
using am::commands::MessageSharedPtr;
+using sdl_rpc_plugin::commands::UnregisterAppInterfaceRequest;
typedef std::shared_ptr<UnregisterAppInterfaceRequest> CommandPtr;
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/unsubscribe_button_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/unsubscribe_button_request_test.cc
index 22893b771c..98d20dbbc4 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/unsubscribe_button_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/unsubscribe_button_request_test.cc
@@ -5,8 +5,8 @@
#include "application_manager/commands/command_request_test.h"
#include "application_manager/mock_application_manager.h"
-#include "application_manager/mock_message_helper.h"
#include "application_manager/mock_hmi_capabilities.h"
+#include "application_manager/mock_message_helper.h"
#include "mobile/unsubscribe_button_request.h"
namespace test {
@@ -20,8 +20,8 @@ namespace mobile_result = mobile_apis::Result;
using ::testing::_;
-using sdl_rpc_plugin::commands::UnsubscribeButtonRequest;
using am::commands::MessageSharedPtr;
+using sdl_rpc_plugin::commands::UnsubscribeButtonRequest;
typedef std::shared_ptr<UnsubscribeButtonRequest> CommandPtr;
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/unsubscribe_way_points_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/unsubscribe_way_points_request_test.cc
index 05e15a78af..3165d57d44 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/unsubscribe_way_points_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/unsubscribe_way_points_request_test.cc
@@ -34,18 +34,18 @@
#include <string>
#include "gtest/gtest.h"
-#include "mobile/unsubscribe_way_points_request.h"
#include "interfaces/MOBILE_API.h"
+#include "mobile/unsubscribe_way_points_request.h"
-#include "smart_objects/smart_object.h"
-#include "application_manager/commands/commands_test.h"
-#include "application_manager/commands/command_request_test.h"
#include "application_manager/application.h"
-#include "application_manager/mock_application_manager.h"
+#include "application_manager/commands/command_request_test.h"
+#include "application_manager/commands/commands_test.h"
+#include "application_manager/event_engine/event.h"
#include "application_manager/mock_application.h"
+#include "application_manager/mock_application_manager.h"
#include "application_manager/mock_message_helper.h"
#include "application_manager/smart_object_keys.h"
-#include "application_manager/event_engine/event.h"
+#include "smart_objects/smart_object.h"
namespace test {
namespace components {
@@ -59,8 +59,8 @@ namespace mobile_result = mobile_apis::Result;
using ::testing::_;
using ::testing::Return;
-using sdl_rpc_plugin::commands::UnsubscribeWayPointsRequest;
using am::commands::MessageSharedPtr;
+using sdl_rpc_plugin::commands::UnsubscribeWayPointsRequest;
namespace {
const uint32_t kConnectionKey = 3u;
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/update_turn_list_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/update_turn_list_request_test.cc
index 78fca8681a..44628a8e89 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/update_turn_list_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/update_turn_list_request_test.cc
@@ -34,20 +34,20 @@
#include <string>
#include "gtest/gtest.h"
-#include "mobile/update_turn_list_request.h"
#include "interfaces/MOBILE_API.h"
+#include "mobile/update_turn_list_request.h"
-#include "smart_objects/smart_object.h"
-#include "application_manager/commands/commands_test.h"
-#include "application_manager/commands/command_request_test.h"
#include "application_manager/application.h"
-#include "application_manager/mock_application_manager.h"
+#include "application_manager/commands/command_request_test.h"
+#include "application_manager/commands/commands_test.h"
+#include "application_manager/event_engine/event.h"
#include "application_manager/mock_application.h"
-#include "application_manager/mock_message_helper.h"
+#include "application_manager/mock_application_manager.h"
#include "application_manager/mock_hmi_capabilities.h"
+#include "application_manager/mock_message_helper.h"
#include "application_manager/policies/mock_policy_handler_interface.h"
#include "application_manager/smart_object_keys.h"
-#include "application_manager/event_engine/event.h"
+#include "smart_objects/smart_object.h"
namespace test {
namespace components {
@@ -59,14 +59,14 @@ namespace am = ::application_manager;
namespace mobile_result = mobile_apis::Result;
using ::testing::_;
+using ::testing::Eq;
+using ::testing::Ref;
using ::testing::Return;
using ::testing::ReturnRef;
-using ::testing::Ref;
-using ::testing::Eq;
-using sdl_rpc_plugin::commands::UpdateTurnListRequest;
using am::commands::MessageSharedPtr;
using application_manager_test::MockHMICapabilities;
+using sdl_rpc_plugin::commands::UpdateTurnListRequest;
namespace {
const uint32_t kConnectionKey = 3u;
@@ -208,7 +208,8 @@ TEST_F(UpdateTurnListRequestTest, Run_ValidTurnList_SUCCESS) {
(*command_msg_)[am::strings::msg_params][am::strings::turn_list][0]
[am::strings::turn_icon],
Eq(mock_app),
- Ref(app_mngr_))).WillOnce(Return(mobile_result::SUCCESS));
+ Ref(app_mngr_)))
+ .WillOnce(Return(mobile_result::SUCCESS));
EXPECT_CALL(mock_message_helper_,
SubscribeApplicationToSoftButton(_, _, kFunctionId));
@@ -223,8 +224,8 @@ TEST_F(UpdateTurnListRequestTest, Run_ValidTurnList_SUCCESS) {
.keyExists(am::hmi_request::navi_text));
EXPECT_TRUE((*result_msg)[am::strings::msg_params][am::strings::turn_list][0]
- [am::hmi_request::navi_text].keyExists(
- am::hmi_request::field_name));
+ [am::hmi_request::navi_text]
+ .keyExists(am::hmi_request::field_name));
EXPECT_EQ(
hmi_apis::Common_TextFieldName::turnText,
(*result_msg)[am::strings::msg_params][am::strings::turn_list][0]
@@ -232,8 +233,8 @@ TEST_F(UpdateTurnListRequestTest, Run_ValidTurnList_SUCCESS) {
.asInt());
EXPECT_TRUE((*result_msg)[am::strings::msg_params][am::strings::turn_list][0]
- [am::hmi_request::navi_text].keyExists(
- am::hmi_request::field_text));
+ [am::hmi_request::navi_text]
+ .keyExists(am::hmi_request::field_text));
EXPECT_EQ(
kNavigationText,
(*result_msg)[am::strings::msg_params][am::strings::turn_list][0]
@@ -268,7 +269,8 @@ TEST_F(UpdateTurnListRequestTest, Run_ValidTurnList_WARNINGS) {
(*command_msg_)[am::strings::msg_params][am::strings::turn_list][0]
[am::strings::turn_icon],
Eq(mock_app),
- Ref(app_mngr_))).WillOnce(Return(mobile_result::WARNINGS));
+ Ref(app_mngr_)))
+ .WillOnce(Return(mobile_result::WARNINGS));
EXPECT_CALL(mock_message_helper_,
SubscribeApplicationToSoftButton(_, _, kFunctionId));
@@ -283,8 +285,8 @@ TEST_F(UpdateTurnListRequestTest, Run_ValidTurnList_WARNINGS) {
.keyExists(am::hmi_request::navi_text));
EXPECT_TRUE((*result_msg)[am::strings::msg_params][am::strings::turn_list][0]
- [am::hmi_request::navi_text].keyExists(
- am::hmi_request::field_name));
+ [am::hmi_request::navi_text]
+ .keyExists(am::hmi_request::field_name));
EXPECT_EQ(
hmi_apis::Common_TextFieldName::turnText,
(*result_msg)[am::strings::msg_params][am::strings::turn_list][0]
@@ -292,8 +294,8 @@ TEST_F(UpdateTurnListRequestTest, Run_ValidTurnList_WARNINGS) {
.asInt());
EXPECT_TRUE((*result_msg)[am::strings::msg_params][am::strings::turn_list][0]
- [am::hmi_request::navi_text].keyExists(
- am::hmi_request::field_text));
+ [am::hmi_request::navi_text]
+ .keyExists(am::hmi_request::field_text));
EXPECT_EQ(
kNavigationText,
(*result_msg)[am::strings::msg_params][am::strings::turn_list][0]