summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLevchenko <slevchenko@SLevchenko-lws-unq>2016-06-07 14:01:29 +0300
committerokozlovlux <okozlov@luxoft.com>2016-08-23 14:26:27 +0300
commit0ebc98982b89de28bf1ee421281ddf8ff45eb97b (patch)
tree5f20c5c8552242e934a3cfa3153a986a4af053dc
parentad7336cf7befae1d82521c691496510449c1581f (diff)
downloadsdl_core-0ebc98982b89de28bf1ee421281ddf8ff45eb97b.tar.gz
Create tools to test commands
Been done: - Added specific abstract classes for commands testing (CommandsTest and CommandRequestTest); - Been added unit tests for base command classes (CommandImpl, CommandRequestImpl, CommandResponseImpl); - Been added unit tests for next mobile response commands: - ListFilesResponse - ReadDIDResponse - AlertManeuverResponse - AlertResponse - SubscribeButtonResponse Related to: APPLINK-24911
-rw-r--r--src/components/application_manager/CMakeLists.txt473
-rw-r--r--src/components/application_manager/include/application_manager/application.h4
-rw-r--r--src/components/application_manager/include/application_manager/application_impl.h4
-rw-r--r--src/components/application_manager/src/application_impl.cc2
-rw-r--r--src/components/application_manager/src/commands/mobile/alert_request.cc2
-rw-r--r--src/components/application_manager/src/commands/mobile/get_vehicle_data_request.cc2
-rw-r--r--src/components/application_manager/src/commands/mobile/on_permissions_change_notification.cc3
-rw-r--r--src/components/application_manager/src/commands/mobile/read_did_request.cc2
-rw-r--r--src/components/application_manager/src/commands/mobile/subscribe_button_request.cc3
-rw-r--r--src/components/application_manager/src/commands/mobile/unsubscribe_button_request.cc12
-rw-r--r--src/components/application_manager/test/CMakeLists.txt7
-rw-r--r--src/components/application_manager/test/application_impl_test.cc36
-rw-r--r--src/components/application_manager/test/commands/CMakeLists.txt61
-rw-r--r--src/components/application_manager/test/commands/command_impl_test.cc281
-rw-r--r--src/components/application_manager/test/commands/command_request_impl_test.cc504
-rw-r--r--src/components/application_manager/test/commands/command_response_impl_test.cc184
-rw-r--r--src/components/application_manager/test/commands/mobile/CMakeLists.txt61
-rw-r--r--src/components/application_manager/test/commands/mobile/add_command_request_test.cc334
-rw-r--r--src/components/application_manager/test/commands/mobile/add_sub_menu_request_test.cc219
-rw-r--r--src/components/application_manager/test/commands/mobile/alert_maneuver_request_test.cc189
-rw-r--r--src/components/application_manager/test/commands/mobile/alert_request_test.cc237
-rw-r--r--src/components/application_manager/test/commands/mobile/delete_command_request_test.cc256
-rw-r--r--src/components/application_manager/test/commands/mobile/diagnostic_message_request_test.cc182
-rw-r--r--src/components/application_manager/test/commands/mobile/dial_number_request_test.cc185
-rw-r--r--src/components/application_manager/test/commands/mobile/end_audio_pass_thru_request_test.cc118
-rw-r--r--src/components/application_manager/test/commands/mobile/get_dtcs_request_test.cc132
-rw-r--r--src/components/application_manager/test/commands/mobile/get_vehicle_data_request_test.cc252
-rw-r--r--src/components/application_manager/test/commands/mobile/list_files_request_test.cc128
-rw-r--r--src/components/application_manager/test/commands/mobile/on_button_notification_commands_test.cc345
-rw-r--r--src/components/application_manager/test/commands/mobile/on_command_notification_test.cc135
-rw-r--r--src/components/application_manager/test/commands/mobile/on_hash_change_notification_test.cc126
-rw-r--r--src/components/application_manager/test/commands/mobile/on_hmi_status_notification_from_mobile_test.cc278
-rw-r--r--src/components/application_manager/test/commands/mobile/on_hmi_status_notification_test.cc213
-rw-r--r--src/components/application_manager/test/commands/mobile/on_keyboard_input_notification_test.cc171
-rw-r--r--src/components/application_manager/test/commands/mobile/on_system_request_notification_test.cc215
-rw-r--r--src/components/application_manager/test/commands/mobile/on_tbt_client_state_notification_test.cc138
-rw-r--r--src/components/application_manager/test/commands/mobile/on_touch_event_notification_test.cc135
-rw-r--r--src/components/application_manager/test/commands/mobile/on_vehicle_data_notification_test.cc146
-rw-r--r--src/components/application_manager/test/commands/mobile/on_way_point_change_notification_test.cc114
-rw-r--r--src/components/application_manager/test/commands/mobile/read_did_request_test.cc159
-rw-r--r--src/components/application_manager/test/commands/mobile/simple_notification_commands_test.cc95
-rw-r--r--src/components/application_manager/test/commands/mobile/simple_response_commands_test.cc105
-rw-r--r--src/components/application_manager/test/commands/mobile/subscribe_button_request_test.cc202
-rw-r--r--src/components/application_manager/test/commands/mobile/unregister_app_interface_request_test.cc116
-rw-r--r--src/components/application_manager/test/commands/mobile/unsubscribe_button_request_test.cc103
-rw-r--r--src/components/application_manager/test/commands/mobile/unsubscribe_vehicle_request_test.cc291
-rw-r--r--src/components/application_manager/test/commands/mobile/unsubscribe_vehicle_response_test.cc109
-rw-r--r--src/components/application_manager/test/commands/mobile/unsubscribe_way_points_request_test.cc~ff89c63... Cover UnsubscribeWayPoints and UpdateTurnList by Unit Tests.169
-rw-r--r--src/components/application_manager/test/commands/mobile/update_turn_list_request_test.cc314
-rw-r--r--src/components/application_manager/test/include/application_manager/commands/command_request_test.h141
-rw-r--r--src/components/application_manager/test/include/application_manager/commands/commands_test.h144
-rw-r--r--src/components/application_manager/test/include/application_manager/mock_application.h2
-rw-r--r--src/components/application_manager/test/include/application_manager/mock_hmi_capabilities.h177
-rw-r--r--src/components/application_manager/test/include/application_manager/mock_message_helper.h79
-rw-r--r--src/components/application_manager/test/mock_message_helper.cc150
55 files changed, 7965 insertions, 280 deletions
diff --git a/src/components/application_manager/CMakeLists.txt b/src/components/application_manager/CMakeLists.txt
index 4137a67891..32848b1c6d 100644
--- a/src/components/application_manager/CMakeLists.txt
+++ b/src/components/application_manager/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (c) 2014, Ford Motor Company
+# Copyright (c) 2016, Ford Motor Company
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@@ -96,255 +96,258 @@ file (GLOB RESUMPTION
${AM_SOURCE_DIR}/src/resumption/*
)
-
file (GLOB APP_LAUNCH
${AM_SOURCE_DIR}/src/app_launch/*
)
+set (COMMANDS_SOURCE_DIR
+ ${AM_SOURCE_DIR}/src/commands
+)
file (GLOB MOBILE_COMMANDS_SOURCES
- ${AM_SOURCE_DIR}/src/commands/*
- ${AM_SOURCE_DIR}/src/commands/mobile/*
+ ${COMMANDS_SOURCE_DIR}/*
+ ${COMMANDS_SOURCE_DIR}/mobile/*
)
+
set (HMI_COMMANDS_SOURCES
- ${AM_SOURCE_DIR}/src/commands/hmi/request_to_hmi.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/response_from_hmi.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/request_from_hmi.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/response_to_hmi.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/notification_to_hmi.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/notification_from_hmi.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/allow_all_apps_request.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/allow_all_apps_response.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/allow_app_request.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/allow_app_response.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/update_sdl_request.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/update_sdl_response.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/activate_app_request.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/activate_app_response.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/get_system_info_request.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/get_system_info_response.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/sdl_get_list_of_permissions_request.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/sdl_get_list_of_permissions_response.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/sdl_get_user_friendly_message_request.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/sdl_get_user_friendly_message_response.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/sdl_get_status_update_request.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/sdl_get_status_update_response.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/on_status_update_notification.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/sdl_activate_app_response.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/sdl_activate_app_request.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/mixing_audio_supported_request.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/mixing_audio_supported_response.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/update_app_list_request.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/update_app_list_response.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/on_update_device_list.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/update_device_list_request.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/update_device_list_response.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/on_audio_data_streaming_notification.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/on_video_data_streaming_notification.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/on_sdl_consent_needed_notification.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/on_sdl_persistence_complete_notification.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/on_exit_all_applications_notification.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/on_exit_application_notification.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/on_navi_way_point_change_notification.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/on_start_device_discovery.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/close_popup_request.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/close_popup_response.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/on_app_activated_notification.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/button_get_capabilities_request.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/button_get_capabilities_response.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/vr_is_ready_request.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/vr_is_ready_response.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/vr_add_command_request.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/vr_add_command_response.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/vr_delete_command_request.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/vr_delete_command_response.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/vr_change_registration_request.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/vr_change_registration_response.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/vr_get_supported_languages_request.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/vr_get_supported_languages_response.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/vr_get_language_request.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/vr_get_language_response.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/vr_get_capabilities_request.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/vr_get_capabilities_response.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/tts_is_ready_request.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/tts_is_ready_response.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/tts_change_registration_request.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/tts_change_registration_response.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/tts_get_language_request.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/tts_get_language_response.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/tts_get_supported_languages_request.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/tts_get_supported_languages_response.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/tts_stop_speaking_request.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/tts_stop_speaking_response.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/tts_speak_request.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/tts_speak_response.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/tts_set_global_properties_request.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/tts_set_global_properties_response.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/tts_get_capabilities_request.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/tts_get_capabilities_response.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/vr_perform_interaction_request.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/vr_perform_interaction_response.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/ui_add_command_request.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/ui_add_command_response.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/ui_delete_command_request.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/ui_delete_command_response.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/ui_add_submenu_request.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/ui_add_submenu_response.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/ui_delete_submenu_request.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/ui_delete_submenu_response.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/ui_get_supported_languages_request.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/ui_get_supported_languages_response.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/ui_get_language_request.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/ui_get_language_response.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/ui_get_capabilities_request.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/ui_get_capabilities_response.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/ui_change_registration_request.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/ui_change_registration_response.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/ui_show_request.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/ui_show_response.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/ui_alert_request.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/ui_alert_response.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/ui_slider_request.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/ui_scrollable_message_request.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/ui_scrollable_message_response.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/ui_set_global_properties_request.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/ui_set_global_properties_response.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/ui_slider_response.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/ui_is_ready_request.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/ui_is_ready_response.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/ui_perform_audio_pass_thru_request.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/ui_perform_audio_pass_thru_response.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/ui_end_audio_pass_thru_request.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/ui_end_audio_pass_thru_response.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/ui_perform_interaction_request.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/ui_perform_interaction_response.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/ui_set_app_icon_request.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/ui_set_app_icon_response.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/ui_set_media_clock_timer_request.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/ui_set_media_clock_timer_response.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/ui_show_request.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/ui_show_response.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/vi_is_ready_request.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/vi_is_ready_response.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/vi_read_did_request.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/vi_read_did_response.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/vi_get_dtcs_request.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/vi_get_dtcs_response.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/vi_diagnostic_message_request.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/vi_diagnostic_message_response.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/vi_get_vehicle_type_request.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/vi_get_vehicle_type_response.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/navi_is_ready_request.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/navi_is_ready_response.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/navi_alert_maneuver_request.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/navi_alert_maneuver_response.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/navi_update_turn_list_request.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/navi_update_turn_list_response.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/navi_show_constant_tbt_request.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/navi_show_constant_tbt_response.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/navi_send_location_request.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/navi_send_location_response.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/navi_subscribe_way_points_request.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/navi_subscribe_way_points_response.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/navi_unsubscribe_way_points_request.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/navi_unsubscribe_way_points_response.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/on_ready_notification.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/on_system_context_notification.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/on_device_chosen_notification.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/on_allow_sdl_functionality_notification.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/on_app_permission_consent_notification.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/on_app_registered_notification.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/on_app_permission_changed_notification.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/on_app_unregistered_notification.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/on_driver_distraction_notification.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/on_ignition_cycle_over_notification.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/on_system_info_changed_notification.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/on_file_removed_notification.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/on_tts_started_notification.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/on_tts_stopped_notification.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/on_vr_started_notification.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/on_vr_stopped_notification.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/on_vr_command_notification.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/on_ui_command_notification.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/on_navi_tbt_client_state_notification.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/on_app_deactivated_notification.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/on_tts_language_change_notification.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/on_vr_language_change_notification.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/on_ui_language_change_notification.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/on_button_event_notification.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/on_button_press_notification.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/on_button_subscription_notification.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/on_find_applications.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/on_ui_keyboard_input_notification.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/on_ui_touch_event_notification.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/on_ui_reset_timeout_notification.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/navi_start_stream_request.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/navi_start_stream_response.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/navi_stop_stream_request.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/navi_stop_stream_response.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/navi_audio_start_stream_request.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/navi_audio_start_stream_response.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/navi_audio_stop_stream_request.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/navi_audio_stop_stream_response.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/navi_get_way_points_request.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/navi_get_way_points_response.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/on_system_request_notification.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/on_put_file_notification.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/on_resume_audio_source_notification.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/on_sdl_close_notification.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/ui_set_display_layout_request.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/ui_set_display_layout_response.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/on_record_start_notification.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/add_statistics_info_notification.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/on_system_error_notification.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/basic_communication_system_request.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/basic_communication_system_response.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/sdl_policy_update.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/sdl_policy_update_response.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/on_received_policy_update.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/on_policy_update.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/get_urls.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/get_urls_response.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/on_device_state_changed_notification.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/on_tts_reset_timeout_notification.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/dial_number_request.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/dial_number_response.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/on_event_changed_notification.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/request_to_hmi.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/response_from_hmi.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/request_from_hmi.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/response_to_hmi.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/notification_to_hmi.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/notification_from_hmi.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/allow_all_apps_request.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/allow_all_apps_response.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/allow_app_request.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/allow_app_response.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/update_sdl_request.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/update_sdl_response.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/activate_app_request.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/activate_app_response.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/get_system_info_request.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/get_system_info_response.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/sdl_get_list_of_permissions_request.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/sdl_get_list_of_permissions_response.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/sdl_get_user_friendly_message_request.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/sdl_get_user_friendly_message_response.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/sdl_get_status_update_request.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/sdl_get_status_update_response.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/on_status_update_notification.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/sdl_activate_app_response.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/sdl_activate_app_request.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/mixing_audio_supported_request.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/mixing_audio_supported_response.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/update_app_list_request.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/update_app_list_response.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/on_update_device_list.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/update_device_list_request.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/update_device_list_response.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/on_audio_data_streaming_notification.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/on_video_data_streaming_notification.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/on_sdl_consent_needed_notification.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/on_sdl_persistence_complete_notification.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/on_exit_all_applications_notification.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/on_exit_application_notification.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/on_navi_way_point_change_notification.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/on_start_device_discovery.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/close_popup_request.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/close_popup_response.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/on_app_activated_notification.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/button_get_capabilities_request.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/button_get_capabilities_response.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/vr_is_ready_request.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/vr_is_ready_response.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/vr_add_command_request.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/vr_add_command_response.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/vr_delete_command_request.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/vr_delete_command_response.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/vr_change_registration_request.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/vr_change_registration_response.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/vr_get_supported_languages_request.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/vr_get_supported_languages_response.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/vr_get_language_request.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/vr_get_language_response.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/vr_get_capabilities_request.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/vr_get_capabilities_response.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/tts_is_ready_request.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/tts_is_ready_response.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/tts_change_registration_request.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/tts_change_registration_response.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/tts_get_language_request.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/tts_get_language_response.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/tts_get_supported_languages_request.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/tts_get_supported_languages_response.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/tts_stop_speaking_request.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/tts_stop_speaking_response.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/tts_speak_request.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/tts_speak_response.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/tts_set_global_properties_request.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/tts_set_global_properties_response.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/tts_get_capabilities_request.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/tts_get_capabilities_response.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/vr_perform_interaction_request.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/vr_perform_interaction_response.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/ui_add_command_request.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/ui_add_command_response.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/ui_delete_command_request.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/ui_delete_command_response.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/ui_add_submenu_request.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/ui_add_submenu_response.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/ui_delete_submenu_request.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/ui_delete_submenu_response.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/ui_get_supported_languages_request.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/ui_get_supported_languages_response.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/ui_get_language_request.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/ui_get_language_response.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/ui_get_capabilities_request.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/ui_get_capabilities_response.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/ui_change_registration_request.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/ui_change_registration_response.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/ui_show_request.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/ui_show_response.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/ui_alert_request.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/ui_alert_response.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/ui_slider_request.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/ui_scrollable_message_request.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/ui_scrollable_message_response.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/ui_set_global_properties_request.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/ui_set_global_properties_response.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/ui_slider_response.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/ui_is_ready_request.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/ui_is_ready_response.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/ui_perform_audio_pass_thru_request.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/ui_perform_audio_pass_thru_response.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/ui_end_audio_pass_thru_request.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/ui_end_audio_pass_thru_response.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/ui_perform_interaction_request.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/ui_perform_interaction_response.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/ui_set_app_icon_request.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/ui_set_app_icon_response.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/ui_set_media_clock_timer_request.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/ui_set_media_clock_timer_response.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/ui_show_request.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/ui_show_response.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/vi_is_ready_request.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/vi_is_ready_response.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/vi_read_did_request.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/vi_read_did_response.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/vi_get_dtcs_request.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/vi_get_dtcs_response.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/vi_diagnostic_message_request.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/vi_diagnostic_message_response.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/vi_get_vehicle_type_request.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/vi_get_vehicle_type_response.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/navi_is_ready_request.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/navi_is_ready_response.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/navi_alert_maneuver_request.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/navi_alert_maneuver_response.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/navi_update_turn_list_request.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/navi_update_turn_list_response.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/navi_show_constant_tbt_request.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/navi_show_constant_tbt_response.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/navi_send_location_request.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/navi_send_location_response.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/navi_subscribe_way_points_request.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/navi_subscribe_way_points_response.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/navi_unsubscribe_way_points_request.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/navi_unsubscribe_way_points_response.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/on_ready_notification.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/on_system_context_notification.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/on_device_chosen_notification.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/on_allow_sdl_functionality_notification.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/on_app_permission_consent_notification.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/on_app_registered_notification.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/on_app_permission_changed_notification.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/on_app_unregistered_notification.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/on_driver_distraction_notification.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/on_ignition_cycle_over_notification.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/on_system_info_changed_notification.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/on_file_removed_notification.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/on_tts_started_notification.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/on_tts_stopped_notification.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/on_vr_started_notification.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/on_vr_stopped_notification.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/on_vr_command_notification.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/on_ui_command_notification.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/on_navi_tbt_client_state_notification.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/on_app_deactivated_notification.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/on_tts_language_change_notification.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/on_vr_language_change_notification.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/on_ui_language_change_notification.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/on_button_event_notification.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/on_button_press_notification.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/on_button_subscription_notification.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/on_find_applications.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/on_ui_keyboard_input_notification.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/on_ui_touch_event_notification.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/on_ui_reset_timeout_notification.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/navi_start_stream_request.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/navi_start_stream_response.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/navi_stop_stream_request.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/navi_stop_stream_response.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/navi_audio_start_stream_request.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/navi_audio_start_stream_response.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/navi_audio_stop_stream_request.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/navi_audio_stop_stream_response.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/navi_get_way_points_request.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/navi_get_way_points_response.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/on_system_request_notification.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/on_put_file_notification.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/on_resume_audio_source_notification.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/on_sdl_close_notification.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/ui_set_display_layout_request.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/ui_set_display_layout_response.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/on_record_start_notification.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/add_statistics_info_notification.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/on_system_error_notification.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/basic_communication_system_request.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/basic_communication_system_response.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/sdl_policy_update.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/sdl_policy_update_response.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/on_received_policy_update.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/on_policy_update.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/get_urls.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/get_urls_response.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/on_device_state_changed_notification.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/on_tts_reset_timeout_notification.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/dial_number_request.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/dial_number_response.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/on_event_changed_notification.cc
)
set (HMI_COMMANDS_SOURCES_JSON
- ${AM_SOURCE_DIR}/src/commands/hmi/vi_get_vehicle_data_request.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/vi_get_vehicle_data_response.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/vi_subscribe_vehicle_data_request.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/vi_subscribe_vehicle_data_response.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/vi_unsubscribe_vehicle_data_request.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/vi_unsubscribe_vehicle_data_response.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/on_vi_vehicle_data_notification.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/vi_get_vehicle_data_request.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/vi_get_vehicle_data_response.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/vi_subscribe_vehicle_data_request.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/vi_subscribe_vehicle_data_response.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/vi_unsubscribe_vehicle_data_request.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/vi_unsubscribe_vehicle_data_response.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/on_vi_vehicle_data_notification.cc
)
set (HMI_COMMANDS_SOURCES_DBUS
- ${AM_SOURCE_DIR}/src/commands/hmi/on_vi_gps_data_notification.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/on_vi_speed_notification.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/on_vi_rpm_notification.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/on_vi_fuel_level_notification.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/on_vi_fuel_level_state_notification.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/on_vi_instant_fuel_consumption_notification.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/on_vi_external_temperature_notification.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/on_vi_vin_notification.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/on_vi_prndl_notification.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/on_vi_tire_pressure_notification.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/on_vi_odometer_notification.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/on_vi_belt_status_notification.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/on_vi_body_information_notification.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/on_vi_device_status_notification.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/on_vi_driver_braking_notification.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/on_vi_wiper_status_notification.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/on_vi_head_lamp_status_notification.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/on_vi_engine_torque_notification.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/on_vi_acc_pedal_position_notification.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/on_vi_steering_wheel_angle_notification.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/on_vi_my_key_notification.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/on_vi_gps_data_notification.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/on_vi_speed_notification.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/on_vi_rpm_notification.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/on_vi_fuel_level_notification.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/on_vi_fuel_level_state_notification.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/on_vi_instant_fuel_consumption_notification.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/on_vi_external_temperature_notification.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/on_vi_vin_notification.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/on_vi_prndl_notification.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/on_vi_tire_pressure_notification.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/on_vi_odometer_notification.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/on_vi_belt_status_notification.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/on_vi_body_information_notification.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/on_vi_device_status_notification.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/on_vi_driver_braking_notification.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/on_vi_wiper_status_notification.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/on_vi_head_lamp_status_notification.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/on_vi_engine_torque_notification.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/on_vi_acc_pedal_position_notification.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/on_vi_steering_wheel_angle_notification.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/on_vi_my_key_notification.cc
)
if (${HMI_JSON_API})
diff --git a/src/components/application_manager/include/application_manager/application.h b/src/components/application_manager/include/application_manager/application.h
index c1b68c2eff..3ec667d911 100644
--- a/src/components/application_manager/include/application_manager/application.h
+++ b/src/components/application_manager/include/application_manager/application.h
@@ -580,8 +580,8 @@ class Application : public virtual InitialApplicationData,
* @param source Limits source, e.g. policy table, config file etc.
* @return true, if - excedeed, otherwise - false
*/
- virtual bool IsCommandLimitsExceeded(mobile_apis::FunctionID::eType cmd_id,
- TLimitSource source) = 0;
+ virtual bool AreCommandLimitsExceeded(mobile_apis::FunctionID::eType cmd_id,
+ TLimitSource source) = 0;
/**
* Returns object for recording statistics
diff --git a/src/components/application_manager/include/application_manager/application_impl.h b/src/components/application_manager/include/application_manager/application_impl.h
index 972cf4b10f..8658963aef 100644
--- a/src/components/application_manager/include/application_manager/application_impl.h
+++ b/src/components/application_manager/include/application_manager/application_impl.h
@@ -201,8 +201,8 @@ class ApplicationImpl : public virtual InitialApplicationDataImpl,
UsageStatistics& usage_report();
- bool IsCommandLimitsExceeded(mobile_apis::FunctionID::eType cmd_id,
- TLimitSource source);
+ bool AreCommandLimitsExceeded(mobile_apis::FunctionID::eType cmd_id,
+ TLimitSource source);
virtual void SubscribeToSoftButtons(int32_t cmd_id,
const SoftButtonID& softbuttons_id);
virtual bool IsSubscribedToSoftButton(const uint32_t softbutton_id);
diff --git a/src/components/application_manager/src/application_impl.cc b/src/components/application_manager/src/application_impl.cc
index a159a7c676..e06497f1da 100644
--- a/src/components/application_manager/src/application_impl.cc
+++ b/src/components/application_manager/src/application_impl.cc
@@ -698,7 +698,7 @@ UsageStatistics& ApplicationImpl::usage_report() {
return usage_report_;
}
-bool ApplicationImpl::IsCommandLimitsExceeded(
+bool ApplicationImpl::AreCommandLimitsExceeded(
mobile_apis::FunctionID::eType cmd_id, TLimitSource source) {
TimevalStruct current = date_time::DateTime::getCurrentTime();
switch (source) {
diff --git a/src/components/application_manager/src/commands/mobile/alert_request.cc b/src/components/application_manager/src/commands/mobile/alert_request.cc
index 53910a05b7..770900845b 100644
--- a/src/components/application_manager/src/commands/mobile/alert_request.cc
+++ b/src/components/application_manager/src/commands/mobile/alert_request.cc
@@ -263,7 +263,7 @@ bool AlertRequest::Validate(uint32_t app_id) {
}
if (mobile_apis::HMILevel::HMI_BACKGROUND == app->hmi_level() &&
- app->IsCommandLimitsExceeded(
+ app->AreCommandLimitsExceeded(
static_cast<mobile_apis::FunctionID::eType>(function_id()),
application_manager::TLimitSource::POLICY_TABLE)) {
LOG4CXX_ERROR(logger_, "Alert frequency is too high.");
diff --git a/src/components/application_manager/src/commands/mobile/get_vehicle_data_request.cc b/src/components/application_manager/src/commands/mobile/get_vehicle_data_request.cc
index 8b7010c6a1..330cbdef30 100644
--- a/src/components/application_manager/src/commands/mobile/get_vehicle_data_request.cc
+++ b/src/components/application_manager/src/commands/mobile/get_vehicle_data_request.cc
@@ -230,7 +230,7 @@ void GetVehicleDataRequest::Run() {
return;
}
- if (app->IsCommandLimitsExceeded(
+ if (app->AreCommandLimitsExceeded(
static_cast<mobile_apis::FunctionID::eType>(function_id()),
application_manager::TLimitSource::CONFIG_FILE)) {
LOG4CXX_ERROR(logger_, "GetVehicleData frequency is too high.");
diff --git a/src/components/application_manager/src/commands/mobile/on_permissions_change_notification.cc b/src/components/application_manager/src/commands/mobile/on_permissions_change_notification.cc
index a4167a802e..09c407b8b5 100644
--- a/src/components/application_manager/src/commands/mobile/on_permissions_change_notification.cc
+++ b/src/components/application_manager/src/commands/mobile/on_permissions_change_notification.cc
@@ -48,9 +48,6 @@ OnPermissionsChangeNotification::~OnPermissionsChangeNotification() {}
void OnPermissionsChangeNotification::Run() {
LOG4CXX_AUTO_TRACE(logger_);
- (*message_)[strings::params][strings::message_type] =
- static_cast<int32_t>(application_manager::MessageType::kNotification);
-
SendNotification();
}
diff --git a/src/components/application_manager/src/commands/mobile/read_did_request.cc b/src/components/application_manager/src/commands/mobile/read_did_request.cc
index 08ec8e179c..18482b5b63 100644
--- a/src/components/application_manager/src/commands/mobile/read_did_request.cc
+++ b/src/components/application_manager/src/commands/mobile/read_did_request.cc
@@ -65,7 +65,7 @@ void ReadDIDRequest::Run() {
return;
}
- if (app->IsCommandLimitsExceeded(
+ if (app->AreCommandLimitsExceeded(
static_cast<mobile_apis::FunctionID::eType>(function_id()),
application_manager::TLimitSource::CONFIG_FILE)) {
LOG4CXX_ERROR(logger_, "ReadDID frequency is too high.");
diff --git a/src/components/application_manager/src/commands/mobile/subscribe_button_request.cc b/src/components/application_manager/src/commands/mobile/subscribe_button_request.cc
index 7ec4e20fbd..eb6bbf545e 100644
--- a/src/components/application_manager/src/commands/mobile/subscribe_button_request.cc
+++ b/src/components/application_manager/src/commands/mobile/subscribe_button_request.cc
@@ -58,7 +58,7 @@ void SubscribeButtonRequest::Run() {
const mobile_apis::ButtonName::eType btn_id =
static_cast<mobile_apis::ButtonName::eType>(
- (*message_)[str::msg_params][str::button_name].asUInt());
+ (*message_)[str::msg_params][str::button_name].asInt());
if (!IsSubscriptionAllowed(app, btn_id)) {
LOG4CXX_ERROR(logger_,
@@ -101,7 +101,6 @@ bool SubscribeButtonRequest::IsSubscriptionAllowed(
(mobile_apis::ButtonName::TUNEDOWN == btn_id))) {
return false;
}
-
return true;
}
diff --git a/src/components/application_manager/src/commands/mobile/unsubscribe_button_request.cc b/src/components/application_manager/src/commands/mobile/unsubscribe_button_request.cc
index 86df8fabb1..e1bdba61a0 100644
--- a/src/components/application_manager/src/commands/mobile/unsubscribe_button_request.cc
+++ b/src/components/application_manager/src/commands/mobile/unsubscribe_button_request.cc
@@ -61,22 +61,16 @@ void UnsubscribeButtonRequest::Run() {
const uint32_t btn_id =
(*message_)[str::msg_params][str::button_name].asUInt();
- if (!app->IsSubscribedToButton(
+ if (!app->UnsubscribeFromButton(
static_cast<mobile_apis::ButtonName::eType>(btn_id))) {
LOG4CXX_ERROR(logger_, "App doesn't subscibe to button " << btn_id);
SendResponse(false, mobile_apis::Result::IGNORED);
return;
}
- app->UnsubscribeFromButton(
- static_cast<mobile_apis::ButtonName::eType>(btn_id));
-
SendUnsubscribeButtonNotification();
- const bool is_succedeed = true;
- SendResponse(is_succedeed, mobile_apis::Result::SUCCESS);
- if (is_succedeed) {
- app->UpdateHash();
- }
+ SendResponse(true, mobile_apis::Result::SUCCESS);
+ app->UpdateHash();
}
void UnsubscribeButtonRequest::SendUnsubscribeButtonNotification() {
diff --git a/src/components/application_manager/test/CMakeLists.txt b/src/components/application_manager/test/CMakeLists.txt
index cd418bd899..ba5d684df8 100644
--- a/src/components/application_manager/test/CMakeLists.txt
+++ b/src/components/application_manager/test/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (c) 2015, Ford Motor Company
+# Copyright (c) 2016, Ford Motor Company
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@@ -32,7 +32,7 @@
# application manager(AM) singleton while refactoring of AM is finished.
if (BUILD_TESTS)
-
+
include_directories(
${GMOCK_INCLUDE_DIRECTORY}
${CMAKE_BINARY_DIR}/src/components/
@@ -152,7 +152,7 @@ OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/libPolicy.so
set(CMAKE_EXE_LINKER_FLAGS
"${CMAKE_EXE_LINKER_FLAGS} -Wl,-rpath=${CMAKE_CURRENT_BINARY_DIR}")
create_test("application_manager_test" "${testSources}" "${testLibraries}" )
-# TODO [AKozoriz] : Fix not buildable tests
+# TODO [AKozoriz] : Fix not buildable tests
set(ResumptionData_SOURCES
${AM_TEST_DIR}/resumption/resumption_data_test.cc
${AM_TEST_DIR}/resumption/resumption_data_db_test.cc
@@ -172,3 +172,4 @@ OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/libPolicy.so
endif()
add_subdirectory(app_launch)
+add_subdirectory(commands)
diff --git a/src/components/application_manager/test/application_impl_test.cc b/src/components/application_manager/test/application_impl_test.cc
index 7989f11fce..0cd86ac99a 100644
--- a/src/components/application_manager/test/application_impl_test.cc
+++ b/src/components/application_manager/test/application_impl_test.cc
@@ -475,7 +475,7 @@ TEST_F(ApplicationImplTest, LoadPersistentFiles) {
EXPECT_EQ(FileType::AUDIO_MP3, test_file8->file_type);
}
-TEST_F(ApplicationImplTest, IsCommandLimitsExceeded_SetLimitFromConfig) {
+TEST_F(ApplicationImplTest, AreCommandLimitsExceeded_SetLimitFromConfig) {
std::pair<uint32_t, int32_t> get_frequency;
get_frequency.first = 5;
get_frequency.second = 1;
@@ -484,21 +484,21 @@ TEST_F(ApplicationImplTest, IsCommandLimitsExceeded_SetLimitFromConfig) {
EXPECT_CALL(mock_application_manager_settings_, get_vehicle_data_frequency())
.WillRepeatedly(ReturnRef(get_frequency));
for (uint32_t i = 0; i < get_frequency.first; i++) {
- EXPECT_FALSE(app_impl->IsCommandLimitsExceeded(FunctionID::ReadDIDID,
- TLimitSource::CONFIG_FILE));
+ EXPECT_FALSE(app_impl->AreCommandLimitsExceeded(FunctionID::ReadDIDID,
+ TLimitSource::CONFIG_FILE));
}
- EXPECT_TRUE(app_impl->IsCommandLimitsExceeded(FunctionID::ReadDIDID,
- TLimitSource::CONFIG_FILE));
+ EXPECT_TRUE(app_impl->AreCommandLimitsExceeded(FunctionID::ReadDIDID,
+ TLimitSource::CONFIG_FILE));
for (uint32_t i = 0; i < get_frequency.first; i++) {
- EXPECT_FALSE(app_impl->IsCommandLimitsExceeded(FunctionID::GetVehicleDataID,
- TLimitSource::CONFIG_FILE));
+ EXPECT_FALSE(app_impl->AreCommandLimitsExceeded(
+ FunctionID::GetVehicleDataID, TLimitSource::CONFIG_FILE));
}
- EXPECT_TRUE(app_impl->IsCommandLimitsExceeded(FunctionID::GetVehicleDataID,
- TLimitSource::CONFIG_FILE));
+ EXPECT_TRUE(app_impl->AreCommandLimitsExceeded(FunctionID::GetVehicleDataID,
+ TLimitSource::CONFIG_FILE));
}
-TEST_F(ApplicationImplTest, IsCommandLimitsExceeded_LimitFromPT) {
+TEST_F(ApplicationImplTest, AreCommandLimitsExceeded_LimitFromPT) {
policy_test::MockPolicyHandlerInterface policy_interface;
EXPECT_CALL(mock_application_manager_, GetPolicyHandler())
.WillRepeatedly(ReturnRef(policy_interface));
@@ -507,19 +507,19 @@ TEST_F(ApplicationImplTest, IsCommandLimitsExceeded_LimitFromPT) {
EXPECT_CALL(policy_interface, GetNotificationsNumber(_))
.WillOnce(Return(100u));
- EXPECT_FALSE(app_impl->IsCommandLimitsExceeded(FunctionID::ReadDIDID,
- TLimitSource::POLICY_TABLE));
+ EXPECT_FALSE(app_impl->AreCommandLimitsExceeded(FunctionID::ReadDIDID,
+ TLimitSource::POLICY_TABLE));
EXPECT_CALL(policy_interface, GetNotificationsNumber(_))
.WillOnce(Return(100u));
- EXPECT_FALSE(app_impl->IsCommandLimitsExceeded(FunctionID::GetVehicleDataID,
- TLimitSource::POLICY_TABLE));
+ EXPECT_FALSE(app_impl->AreCommandLimitsExceeded(FunctionID::GetVehicleDataID,
+ TLimitSource::POLICY_TABLE));
EXPECT_CALL(policy_interface, GetNotificationsNumber(_))
.WillRepeatedly(Return(0));
- EXPECT_TRUE(app_impl->IsCommandLimitsExceeded(FunctionID::ReadDIDID,
- TLimitSource::POLICY_TABLE));
- EXPECT_TRUE(app_impl->IsCommandLimitsExceeded(FunctionID::GetVehicleDataID,
- TLimitSource::POLICY_TABLE));
+ EXPECT_TRUE(app_impl->AreCommandLimitsExceeded(FunctionID::ReadDIDID,
+ TLimitSource::POLICY_TABLE));
+ EXPECT_TRUE(app_impl->AreCommandLimitsExceeded(FunctionID::GetVehicleDataID,
+ TLimitSource::POLICY_TABLE));
}
TEST_F(ApplicationImplTest, SubscribeToButton_UnsubscribeFromButton) {
diff --git a/src/components/application_manager/test/commands/CMakeLists.txt b/src/components/application_manager/test/commands/CMakeLists.txt
new file mode 100644
index 0000000000..e133ce51a5
--- /dev/null
+++ b/src/components/application_manager/test/commands/CMakeLists.txt
@@ -0,0 +1,61 @@
+# Copyright (c) 2016, 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_directories(
+ ${GMOCK_INCLUDE_DIRECTORY}
+ ${COMPONENTS_DIR}/application_manager/include/
+ ${COMPONENTS_DIR}/application_manager/test/include/
+)
+
+set(COMMANDS_TEST_SOURCE_DIR
+ ${COMPONENTS_DIR}/application_manager/test/commands
+)
+
+set (SOURCES
+ ${COMPONENTS_DIR}/application_manager/test/mock_message_helper.cc
+ ${COMMANDS_TEST_SOURCE_DIR}/command_impl_test.cc
+ ${COMMANDS_TEST_SOURCE_DIR}/command_response_impl_test.cc
+ ${COMMANDS_TEST_SOURCE_DIR}/command_request_impl_test.cc
+)
+
+set(LIBRARIES
+ gmock
+ Utils
+ ApplicationManager
+ connectionHandler
+ HMI_API
+ MOBILE_API
+ SmartObjects
+ jsoncpp
+)
+
+create_test("commands_test" "${SOURCES}" "${LIBRARIES}" )
+
+add_subdirectory(mobile)
diff --git a/src/components/application_manager/test/commands/command_impl_test.cc b/src/components/application_manager/test/commands/command_impl_test.cc
new file mode 100644
index 0000000000..48dd187402
--- /dev/null
+++ b/src/components/application_manager/test/commands/command_impl_test.cc
@@ -0,0 +1,281 @@
+/*
+ * Copyright (c) 2016, 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 <set>
+
+#include "gtest/gtest.h"
+#include "utils/shared_ptr.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/command_impl.h"
+#include "application_manager/application_manager.h"
+#include "application_manager/mock_application.h"
+
+namespace test {
+namespace components {
+namespace commands_test {
+
+using ::testing::Return;
+using ::testing::AtLeast;
+using ::testing::_;
+
+using ::utils::SharedPtr;
+namespace strings = ::application_manager::strings;
+using ::application_manager::commands::CommandImpl;
+using ::application_manager::ApplicationManager;
+using ::application_manager::commands::MessageSharedPtr;
+using ::application_manager::ApplicationSharedPtr;
+using ::test::components::application_manager_test::MockApplication;
+
+typedef SharedPtr<MockApplication> MockAppPtr;
+
+namespace {
+static const uint32_t kDefaultMsgCount_ = 5u;
+static const uint32_t kAppId1_ = 5u;
+static const uint32_t kAppId2_ = 10u;
+} // namespace
+
+class CommandImplTest : public CommandsTest<CommandsTestMocks::kIsNice> {
+ public:
+ class UnwrappedCommandImpl : CommandImpl {
+ public:
+ using CommandImpl::ReplaceMobileByHMIAppId;
+ using CommandImpl::ReplaceHMIByMobileAppId;
+
+ UnwrappedCommandImpl(const MessageSharedPtr& message,
+ ApplicationManager& application_manager)
+ : CommandImpl(message, application_manager) {}
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(UnwrappedCommandImpl);
+ };
+
+ // Create `SmartObject` which handle array of `SmartObjects`
+ static MessageSharedPtr CreateArrayMessage(
+ const size_t msg_count = kDefaultMsgCount_) {
+ MessageSharedPtr msg = CreateMessage(smart_objects::SmartType_Array);
+ smart_objects::SmartArray* array = msg->asArray();
+ for (size_t i = 0u; i < msg_count; ++i) {
+ SmartObject obj;
+ obj[strings::app_id] = i;
+ array->push_back(obj);
+ }
+ return msg;
+ }
+ // Create `SmartObject` which handle map of `SmartObjects`
+ static MessageSharedPtr CreateMapMessage(
+ const size_t msg_count = kDefaultMsgCount_) {
+ MessageSharedPtr msg = CreateMessage(smart_objects::SmartType_Map);
+ char key[] = {'A', '\0'};
+ for (size_t i = 0u; i < msg_count; ++i, ++key[0]) {
+ SmartObject obj;
+ obj[strings::app_id] = i;
+ (*msg)[key] = obj;
+ }
+ return msg;
+ }
+};
+
+typedef CommandImplTest::UnwrappedCommandImpl UCommandImpl;
+typedef SharedPtr<UCommandImpl> UCommandImplPtr;
+
+TEST_F(CommandImplTest, GetMethods_SUCCESS) {
+ MessageSharedPtr msg;
+ SharedPtr<CommandImpl> command =
+ CreateCommand<CommandImpl>(kDefaultTimeout_, msg);
+
+ // Current implementation always return `true`
+ EXPECT_TRUE(command->Init());
+ EXPECT_TRUE(command->CheckPermissions());
+ EXPECT_TRUE(command->CleanUp());
+
+ // Default value of `allowed_to_terminate_` is true
+ EXPECT_TRUE(command->AllowedToTerminate());
+ command->SetAllowedToTerminate(false);
+ EXPECT_FALSE(command->AllowedToTerminate());
+
+ const uint32_t kCorrelationId = 3u;
+ const int32_t kFunctionId = 4u;
+ const uint32_t kConnectionKey = 5u;
+
+ (*msg)[strings::params][strings::correlation_id] = kCorrelationId;
+ (*msg)[strings::params][strings::function_id] = kFunctionId;
+ (*msg)[strings::params][strings::connection_key] = kConnectionKey;
+
+ EXPECT_EQ(kDefaultTimeout_, command->default_timeout());
+ EXPECT_EQ(kCorrelationId, command->correlation_id());
+ EXPECT_EQ(kConnectionKey, command->connection_key());
+ EXPECT_EQ(kFunctionId, command->function_id());
+ EXPECT_NO_THROW(command->Run());
+ EXPECT_NO_THROW(command->onTimeOut());
+}
+
+TEST_F(CommandImplTest, ReplaceMobileByHMIAppId_NoAppIdInMessage_UNSUCCESS) {
+ MessageSharedPtr msg;
+ UCommandImplPtr command = CreateCommand<UCommandImpl>(msg);
+
+ EXPECT_CALL(app_mngr_, application(_)).Times(0);
+
+ command->ReplaceMobileByHMIAppId(*msg);
+}
+
+TEST_F(CommandImplTest, ReplaceMobileByHMIAppId_SUCCESS) {
+ MessageSharedPtr msg = CreateMessage();
+ (*msg)[strings::app_id] = kAppId1_;
+
+ UCommandImplPtr command = CreateCommand<UCommandImpl>(msg);
+
+ MockAppPtr app = CreateMockApp();
+
+ EXPECT_CALL(app_mngr_, application(kAppId1_)).WillOnce(Return(app));
+ ON_CALL(*app, hmi_app_id()).WillByDefault(Return(kAppId2_));
+
+ command->ReplaceMobileByHMIAppId(*msg);
+
+ EXPECT_EQ(kAppId2_, (*msg)[strings::app_id].asUInt());
+}
+
+TEST_F(CommandImplTest, ReplaceMobileByHMIAppId_Array_SUCCESS) {
+ MessageSharedPtr msg = CreateArrayMessage(kDefaultMsgCount_);
+ UCommandImplPtr command = CreateCommand<UCommandImpl>(msg);
+
+ MockAppPtr app = CreateMockApp();
+
+ EXPECT_CALL(app_mngr_, application(_))
+ .Times(kDefaultMsgCount_)
+ .WillRepeatedly(Return(app));
+ ON_CALL(*app, hmi_app_id()).WillByDefault(Return(kAppId2_));
+
+ command->ReplaceMobileByHMIAppId(*msg);
+
+ EXPECT_TRUE(msg->asArray());
+ smart_objects::SmartArray::const_iterator it(msg->asArray()->begin());
+ const smart_objects::SmartArray::const_iterator it_end(msg->asArray()->end());
+ for (; it != it_end; ++it) {
+ EXPECT_EQ(kAppId2_, (*it)[strings::app_id].asUInt());
+ }
+}
+
+TEST_F(CommandImplTest, ReplaceMobileByHMIAppId_Map_SUCCESS) {
+ MessageSharedPtr msg = CreateMapMessage(kDefaultMsgCount_);
+ UCommandImplPtr command = CreateCommand<UCommandImpl>(msg);
+
+ MockAppPtr app = CreateMockApp();
+
+ EXPECT_CALL(app_mngr_, application(_))
+ .Times(kDefaultMsgCount_)
+ .WillRepeatedly(Return(app));
+ ON_CALL(*app, hmi_app_id()).WillByDefault(Return(kAppId2_));
+
+ command->ReplaceMobileByHMIAppId(*msg);
+
+ std::set<std::string> keys(msg->enumerate());
+ std::set<std::string>::const_iterator key(keys.begin());
+ for (; key != keys.end(); ++key) {
+ EXPECT_EQ(kAppId2_, (*msg)[*key][strings::app_id].asUInt());
+ }
+}
+
+TEST_F(CommandImplTest, ReplaceHMIByMobileAppId_NoHMIAppIdInMessage_UNSUCCESS) {
+ MessageSharedPtr msg;
+ UCommandImplPtr command = CreateCommand<UCommandImpl>(msg);
+
+ EXPECT_CALL(app_mngr_, application_by_hmi_app(_)).Times(0);
+
+ command->ReplaceHMIByMobileAppId(*msg);
+}
+
+TEST_F(CommandImplTest, ReplaceHMIByMobileAppId_SUCCESS) {
+ MessageSharedPtr msg = CreateMessage();
+ (*msg)[strings::app_id] = kAppId1_;
+
+ UCommandImplPtr command = CreateCommand<UCommandImpl>(msg);
+
+ MockAppPtr app = CreateMockApp();
+
+ EXPECT_CALL(app_mngr_, application_by_hmi_app(kAppId1_))
+ .WillOnce(Return(app));
+ ON_CALL(*app, app_id()).WillByDefault(Return(kAppId2_));
+
+ command->ReplaceHMIByMobileAppId(*msg);
+
+ EXPECT_EQ(kAppId2_, (*msg)[strings::app_id].asUInt());
+}
+
+TEST_F(CommandImplTest, ReplaceHMIByMobileAppId_Array_SUCCESS) {
+ MessageSharedPtr msg = CreateArrayMessage(kDefaultMsgCount_);
+
+ UCommandImplPtr command = CreateCommand<UCommandImpl>(msg);
+ MockAppPtr app = CreateMockApp();
+
+ EXPECT_CALL(app_mngr_, application_by_hmi_app(_))
+ .Times(kDefaultMsgCount_)
+ .WillRepeatedly(Return(app));
+ ON_CALL(*app, app_id()).WillByDefault(Return(kAppId2_));
+
+ command->ReplaceHMIByMobileAppId(*msg);
+
+ EXPECT_TRUE(msg->asArray());
+ smart_objects::SmartArray::const_iterator it(msg->asArray()->begin());
+ const smart_objects::SmartArray::const_iterator it_end(msg->asArray()->end());
+ for (; it != it_end; ++it) {
+ EXPECT_EQ(kAppId2_, (*it)[strings::app_id].asUInt());
+ }
+}
+
+TEST_F(CommandImplTest, ReplaceHMIByMobileAppId_Map_SUCCESS) {
+ MessageSharedPtr msg = CreateMapMessage(kDefaultMsgCount_);
+
+ UCommandImplPtr command = CreateCommand<UCommandImpl>(msg);
+ MockAppPtr app = CreateMockApp();
+
+ EXPECT_CALL(app_mngr_, application_by_hmi_app(_))
+ .Times(kDefaultMsgCount_)
+ .WillRepeatedly(Return(app));
+ ON_CALL(*app, app_id()).WillByDefault(Return(kAppId2_));
+
+ command->ReplaceHMIByMobileAppId(*msg);
+
+ std::set<std::string> keys = msg->enumerate();
+ std::set<std::string>::const_iterator key = keys.begin();
+ for (; key != keys.end(); ++key) {
+ EXPECT_EQ(kAppId2_, (*msg)[*key][strings::app_id].asUInt());
+ }
+}
+
+} // namespace commands_test
+} // namespace components
+} // namespace test
diff --git a/src/components/application_manager/test/commands/command_request_impl_test.cc b/src/components/application_manager/test/commands/command_request_impl_test.cc
new file mode 100644
index 0000000000..9a44a34916
--- /dev/null
+++ b/src/components/application_manager/test/commands/command_request_impl_test.cc
@@ -0,0 +1,504 @@
+/*
+ * Copyright (c) 2016, 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 <algorithm>
+
+#include "gtest/gtest.h"
+#include "application_manager/commands/command_impl.h"
+#include "application_manager/commands/command_request_impl.h"
+#include "application_manager/commands/commands_test.h"
+#include "application_manager/commands/command_request_test.h"
+#include "utils/lock.h"
+#include "utils/shared_ptr.h"
+#include "utils/data_accessor.h"
+#include "smart_objects/smart_object.h"
+#include "application_manager/smart_object_keys.h"
+#include "application_manager/application_manager.h"
+#include "application_manager/mock_application.h"
+#include "application_manager/event_engine/event.h"
+#include "application_manager/mock_message_helper.h"
+#include "interfaces/MOBILE_API.h"
+
+namespace test {
+namespace components {
+namespace commands_test {
+
+namespace am = application_manager;
+namespace strings = am::strings;
+namespace hmi_response = am::hmi_response;
+
+using ::testing::_;
+using ::testing::Return;
+using ::testing::SaveArg;
+using ::testing::DoAll;
+
+using ::utils::SharedPtr;
+using am::commands::MessageSharedPtr;
+using am::CommandParametersPermissions;
+using am::event_engine::EventObserver;
+using am::commands::CommandImpl;
+using am::commands::CommandRequestImpl;
+using am::ApplicationManager;
+using am::ApplicationSet;
+using am::RPCParams;
+
+typedef am::commands::CommandRequestImpl::RequestState RequestState;
+
+namespace {
+const uint32_t kConnectionKey = 5u;
+const uint32_t kCorrelationId = 3u;
+const hmi_apis::FunctionID::eType kInvalidFunctionId =
+ hmi_apis::FunctionID::INVALID_ENUM;
+const std::string kPolicyAppId = "Test";
+const mobile_apis::Result::eType kMobResultSuccess =
+ mobile_apis::Result::SUCCESS;
+const std::string kDisallowedParam1 = "disallowed_param1";
+const std::string kDisallowedParam2 = "disallowed_param2";
+const std::string kAllowedParam = "allowed_param";
+const std::string kUndefinedParam = "undefined_params";
+const std::string kMissedParam = "missed_param";
+} // namespace
+
+class CommandRequestImplTest
+ : public CommandRequestTest<CommandsTestMocks::kIsNice> {
+ public:
+ class UnwrappedCommandRequestImpl : public CommandRequestImpl {
+ public:
+ using CommandRequestImpl::CheckAllowedParameters;
+ using CommandRequestImpl::RemoveDisallowedParameters;
+ using CommandRequestImpl::AddDisallowedParameters;
+ using CommandRequestImpl::HasDisallowedParams;
+
+ UnwrappedCommandRequestImpl(const MessageSharedPtr& message,
+ ApplicationManager& am)
+ : CommandRequestImpl(message, am) {}
+
+ const RequestState current_state() const {
+ return current_state_;
+ }
+ void set_current_state(const RequestState state) {
+ current_state_ = state;
+ }
+
+ CommandParametersPermissions& parameters_permissions() {
+ return parameters_permissions_;
+ }
+
+ CommandParametersPermissions& removed_parameters_permissions() {
+ return removed_parameters_permissions_;
+ }
+ };
+
+ CommandRequestImplTest() {
+ mock_message_helper_ = am::MockMessageHelper::message_helper_mock();
+ }
+ ~CommandRequestImplTest() {
+ mock_message_helper_ = NULL;
+ }
+
+ MockAppPtr InitAppSetDataAccessor(SharedPtr<ApplicationSet>& app_set) {
+ app_set = (!app_set ? ::utils::MakeShared<ApplicationSet>() : app_set);
+ MockAppPtr app(CreateMockApp());
+ app_set->insert(app);
+ EXPECT_CALL(app_mngr_, applications())
+ .WillOnce(
+ Return(DataAccessor<ApplicationSet>(*app_set, app_set_lock_)));
+ return app;
+ }
+
+ sync_primitives::Lock app_set_lock_;
+ am::MockMessageHelper* mock_message_helper_;
+};
+
+typedef CommandRequestImplTest::UnwrappedCommandRequestImpl UCommandRequestImpl;
+typedef SharedPtr<UCommandRequestImpl> CommandPtr;
+
+TEST_F(CommandRequestImplTest, OnTimeOut_StateCompleted_UNSUCCESS) {
+ CommandPtr command = CreateCommand<UCommandRequestImpl>();
+
+ // Should be called twice:
+ // First -- on `onTimeOut` method call
+ // Second -- on destruction;
+ EXPECT_CALL(event_dispatcher_, remove_observer(_)).Times(2);
+ EXPECT_CALL(app_mngr_, ManageMobileCommand(_, _)).Times(0);
+
+ // If `command` already done, then state should change to `kCompleted`.
+ command->set_current_state(RequestState::kCompleted);
+
+ command->onTimeOut();
+
+ EXPECT_EQ(RequestState::kCompleted, command->current_state());
+}
+
+TEST_F(CommandRequestImplTest, OnTimeOut_StateAwaitingHMIResponse_SUCCESS) {
+ MessageSharedPtr msg = CreateMessage(smart_objects::SmartType_Map);
+ (*msg)[strings::params][strings::correlation_id] = kCorrelationId;
+ (*msg)[strings::params][strings::function_id] = kInvalidFunctionId;
+ (*msg)[strings::params][strings::connection_key] = kConnectionKey;
+
+ CommandPtr command = CreateCommand<UCommandRequestImpl>(msg);
+
+ MessageSharedPtr dummy_msg(CreateMessage());
+ EXPECT_CALL(*mock_message_helper_, CreateNegativeResponse(_, _, _, _))
+ .WillOnce(Return(dummy_msg));
+ EXPECT_CALL(
+ app_mngr_,
+ ManageMobileCommand(dummy_msg, Command::CommandOrigin::ORIGIN_SDL));
+
+ command->onTimeOut();
+
+ // If `command` not done till now, then state should change to `kTimedOut`
+ // and sent it to application manager to deal with it.
+ EXPECT_EQ(RequestState::kTimedOut, command->current_state());
+}
+
+TEST_F(CommandRequestImplTest, CheckSyntax_SUCCESS) {
+ CommandPtr command = CreateCommand<UCommandRequestImpl>();
+
+ // Checking message syntax.
+ const std::string str1("\t\n");
+ EXPECT_FALSE(command->CheckSyntax(str1, false));
+ const std::string str2("\\n");
+ EXPECT_FALSE(command->CheckSyntax(str2, false));
+ const std::string str3("\\t");
+ EXPECT_FALSE(command->CheckSyntax(str3, false));
+ const std::string str4(" ");
+ EXPECT_FALSE(command->CheckSyntax(str4, false));
+ EXPECT_TRUE(command->CheckSyntax(str4, true));
+}
+
+TEST_F(CommandRequestImplTest, GetMobileResultCode_SUCCESS) {
+ union ResultU {
+ int32_t value_;
+ hmi_apis::Common_Result::eType hmi_;
+ mobile_apis::Result::eType mobile_;
+ };
+
+ CommandPtr command = CreateCommand<UCommandRequestImpl>();
+
+ // Run thru all possible accordance
+ // of HMI and Mobile result codes.
+ ResultU result_it;
+ for (result_it.hmi_ = hmi_apis::Common_Result::SUCCESS;
+ result_it.value_ < hmi_apis::Common_Result::TRUNCATED_DATA;
+ ++result_it.value_) {
+ if (result_it.hmi_ != hmi_apis::Common_Result::NO_DEVICES_CONNECTED &&
+ result_it.hmi_ != hmi_apis::Common_Result::NO_APPS_REGISTERED) {
+ EXPECT_EQ(result_it.mobile_,
+ command->GetMobileResultCode(result_it.hmi_));
+ }
+ }
+ EXPECT_EQ(mobile_apis::Result::APPLICATION_NOT_REGISTERED,
+ command->GetMobileResultCode(
+ hmi_apis::Common_Result::NO_DEVICES_CONNECTED));
+ EXPECT_EQ(mobile_apis::Result::APPLICATION_NOT_REGISTERED,
+ command->GetMobileResultCode(
+ hmi_apis::Common_Result::NO_APPS_REGISTERED));
+ EXPECT_EQ(
+ mobile_apis::Result::GENERIC_ERROR,
+ command->GetMobileResultCode(hmi_apis::Common_Result::TRUNCATED_DATA));
+}
+
+TEST_F(CommandRequestImplTest, BasicMethodsOverloads_SUCCESS) {
+ CommandPtr command = CreateCommand<UCommandRequestImpl>();
+
+ // Current implementation always return `true`
+ EXPECT_TRUE(command->Init());
+ EXPECT_TRUE(command->CleanUp());
+ EXPECT_NO_THROW(command->Run());
+ am::event_engine::Event event(kInvalidFunctionId);
+ EXPECT_NO_THROW(command->on_event(event));
+}
+
+TEST_F(CommandRequestImplTest, CreateHMINotification_SUCCESS) {
+ CommandPtr command = CreateCommand<UCommandRequestImpl>();
+
+ const std::string kTestParamsKey = "test_msg_params";
+
+ MessageSharedPtr msg_params = CreateMessage();
+ (*msg_params)[kTestParamsKey] = 0;
+
+ MessageSharedPtr result;
+
+ EXPECT_CALL(app_mngr_, ManageHMICommand(_))
+ .WillOnce(DoAll(SaveArg<0>(&result), Return(true)));
+
+ command->CreateHMINotification(kInvalidFunctionId, *msg_params);
+
+ // Check if message been formed and sent to application manager.
+ EXPECT_TRUE((*result).keyExists(strings::msg_params));
+ EXPECT_TRUE((*result)[strings::msg_params].keyExists(kTestParamsKey));
+}
+
+TEST_F(CommandRequestImplTest, SendHMIRequest_NoUseEvent_SUCCESS) {
+ CommandPtr command = CreateCommand<UCommandRequestImpl>();
+
+ EXPECT_CALL(app_mngr_, GetNextHMICorrelationID())
+ .WillOnce(Return(kCorrelationId));
+ // Return `true` prevents call of `SendResponse` method;
+ EXPECT_CALL(app_mngr_, ManageHMICommand(_)).WillOnce(Return(true));
+
+ EXPECT_EQ(kCorrelationId,
+ command->SendHMIRequest(kInvalidFunctionId, NULL, false));
+}
+
+TEST_F(CommandRequestImplTest, SendHMIRequest_UseEvent_SUCCESS) {
+ CommandPtr command = CreateCommand<UCommandRequestImpl>();
+
+ EXPECT_CALL(app_mngr_, GetNextHMICorrelationID())
+ .WillOnce(Return(kCorrelationId));
+ // Return `true` prevents call of `SendResponse` method;
+ EXPECT_CALL(app_mngr_, ManageHMICommand(_)).WillOnce(Return(true));
+
+ EXPECT_CALL(event_dispatcher_, add_observer(_, _, _));
+
+ EXPECT_EQ(kCorrelationId,
+ command->SendHMIRequest(kInvalidFunctionId, NULL, true));
+}
+
+TEST_F(CommandRequestImplTest, RemoveDisallowedParameters_SUCCESS) {
+ am::VehicleData vehicle_data;
+ vehicle_data.insert(
+ am::VehicleData::value_type(kMissedParam, am::VehicleDataType::MYKEY));
+
+ EXPECT_CALL(*mock_message_helper_, vehicle_data())
+ .WillOnce(ReturnRef(vehicle_data));
+
+ MessageSharedPtr msg = CreateMessage();
+ (*msg)[strings::msg_params][kDisallowedParam1] = 0u;
+ (*msg)[strings::msg_params][kDisallowedParam2] = 0u;
+ (*msg)[strings::msg_params][kAllowedParam] = 0u;
+ (*msg)[strings::msg_params][kUndefinedParam] = 0u;
+ (*msg)[strings::msg_params][kMissedParam] = 0u;
+
+ CommandPtr command = CreateCommand<UCommandRequestImpl>(msg);
+
+ CommandParametersPermissions& permission = command->parameters_permissions();
+ permission.disallowed_params.push_back(kDisallowedParam1);
+ permission.disallowed_params.push_back(kDisallowedParam2);
+ permission.allowed_params.push_back(kAllowedParam);
+ permission.undefined_params.push_back(kUndefinedParam);
+
+ command->RemoveDisallowedParameters();
+
+ EXPECT_FALSE((*msg)[strings::msg_params].keyExists(kDisallowedParam1));
+ EXPECT_FALSE((*msg)[strings::msg_params].keyExists(kDisallowedParam2));
+ EXPECT_FALSE((*msg)[strings::msg_params].keyExists(kUndefinedParam));
+ EXPECT_FALSE((*msg)[strings::msg_params].keyExists(kMissedParam));
+ EXPECT_TRUE((*msg)[strings::msg_params].keyExists(kAllowedParam));
+ EXPECT_TRUE(command->HasDisallowedParams());
+}
+
+TEST_F(CommandRequestImplTest,
+ CheckAllowedParameters_RegisterAppInterface_SUCCESS) {
+ MessageSharedPtr msg = CreateMessage();
+ (*msg)[strings::params][strings::function_id] =
+ mobile_apis::FunctionID::RegisterAppInterfaceID;
+
+ CommandPtr command = CreateCommand<UCommandRequestImpl>(msg);
+
+ EXPECT_CALL(app_mngr_, applications()).Times(0);
+ EXPECT_TRUE(command->CheckPermissions());
+}
+
+TEST_F(CommandRequestImplTest,
+ CheckAllowedParameters_NoAppWithSameConnectionKey_SUCCESS) {
+ MessageSharedPtr msg = CreateMessage();
+ (*msg)[strings::params][strings::connection_key] = kConnectionKey;
+
+ CommandPtr command = CreateCommand<UCommandRequestImpl>(msg);
+
+ SharedPtr<ApplicationSet> app_set;
+ MockAppPtr app(InitAppSetDataAccessor(app_set));
+ EXPECT_CALL(*app, app_id()).WillOnce(Return(6u));
+ EXPECT_TRUE(command->CheckPermissions());
+}
+
+TEST_F(CommandRequestImplTest, CheckAllowedParameters_NoMsgParamsMap_SUCCESS) {
+ MessageSharedPtr msg = CreateMessage();
+ (*msg)[strings::params][strings::connection_key] = kConnectionKey;
+ (*msg)[strings::msg_params] = 0u;
+
+ CommandPtr command = CreateCommand<UCommandRequestImpl>(msg);
+
+ SharedPtr<ApplicationSet> app_set;
+ MockAppPtr app(InitAppSetDataAccessor(app_set));
+ EXPECT_CALL(*app, app_id()).WillOnce(Return(kConnectionKey));
+ EXPECT_CALL(*app, policy_app_id()).WillOnce(Return(kPolicyAppId));
+ EXPECT_CALL(*app, hmi_level())
+ .WillOnce(Return(mobile_apis::HMILevel::HMI_NONE));
+
+ EXPECT_CALL(app_mngr_, CheckPolicyPermissions(_, _, _, _, _))
+ .WillOnce(Return(kMobResultSuccess));
+
+ EXPECT_TRUE(command->CheckPermissions());
+}
+
+TEST_F(CommandRequestImplTest,
+ CheckAllowedParameters_WrongPolicyPermissions_UNSUCCESS) {
+ MessageSharedPtr msg = CreateMessage();
+ (*msg)[strings::params][strings::connection_key] = kConnectionKey;
+ (*msg)[strings::msg_params] = 0u;
+
+ CommandPtr command = CreateCommand<UCommandRequestImpl>(msg);
+
+ SharedPtr<ApplicationSet> app_set;
+ MockAppPtr app(InitAppSetDataAccessor(app_set));
+ EXPECT_CALL(*app, app_id()).Times(2).WillRepeatedly(Return(kConnectionKey));
+ EXPECT_CALL(*app, policy_app_id()).WillOnce(Return(kPolicyAppId));
+ EXPECT_CALL(*app, hmi_level())
+ .WillOnce(Return(mobile_apis::HMILevel::HMI_NONE));
+
+ EXPECT_CALL(app_mngr_, CheckPolicyPermissions(_, _, _, _, _))
+ .WillOnce(Return(mobile_apis::Result::INVALID_ENUM));
+
+ MessageSharedPtr dummy_msg;
+ EXPECT_CALL(*mock_message_helper_,
+ CreateBlockedByPoliciesResponse(_, _, _, _))
+ .WillOnce(Return(dummy_msg));
+ EXPECT_CALL(app_mngr_, SendMessageToMobile(_, _));
+ EXPECT_FALSE(command->CheckPermissions());
+}
+
+ACTION_P(GetArg3, output) {
+ *output = arg3;
+}
+
+TEST_F(CommandRequestImplTest, CheckAllowedParameters_MsgParamsMap_SUCCESS) {
+ MessageSharedPtr msg = CreateMessage();
+ (*msg)[strings::params][strings::connection_key] = kConnectionKey;
+ (*msg)[strings::msg_params][kPolicyAppId] = true;
+
+ CommandPtr command = CreateCommand<UCommandRequestImpl>(msg);
+
+ SharedPtr<ApplicationSet> app_set;
+ MockAppPtr app(InitAppSetDataAccessor(app_set));
+ EXPECT_CALL(*app, app_id()).WillOnce(Return(kConnectionKey));
+ EXPECT_CALL(*app, policy_app_id()).WillOnce(Return(kPolicyAppId));
+ EXPECT_CALL(*app, hmi_level())
+ .WillOnce(Return(mobile_apis::HMILevel::HMI_NONE));
+
+ RPCParams params;
+ EXPECT_CALL(app_mngr_, CheckPolicyPermissions(_, _, _, _, _))
+ .WillOnce(DoAll(GetArg3(&params), Return(kMobResultSuccess)));
+
+ EXPECT_TRUE(command->CheckPermissions());
+ EXPECT_TRUE(params.end() !=
+ std::find(params.begin(), params.end(), kPolicyAppId));
+}
+
+TEST_F(CommandRequestImplTest, AddDisallowedParameters_SUCCESS) {
+ am::VehicleData vehicle_data;
+ vehicle_data.insert(am::VehicleData::value_type(kDisallowedParam1,
+ am::VehicleDataType::MYKEY));
+
+ EXPECT_CALL(*mock_message_helper_, vehicle_data())
+ .WillOnce(ReturnRef(vehicle_data));
+
+ MessageSharedPtr msg;
+
+ CommandPtr command = CreateCommand<UCommandRequestImpl>(msg);
+
+ command->removed_parameters_permissions().disallowed_params.push_back(
+ kDisallowedParam1);
+
+ command->AddDisallowedParameters(*msg);
+
+ EXPECT_TRUE((*msg)[strings::msg_params].keyExists(kDisallowedParam1));
+}
+
+TEST_F(CommandRequestImplTest, SendResponse_TimedOut_UNSUCCESS) {
+ CommandPtr command = CreateCommand<UCommandRequestImpl>();
+
+ command->set_current_state(RequestState::kTimedOut);
+
+ EXPECT_CALL(app_mngr_, ManageMobileCommand(_, _)).Times(0);
+
+ // Args do not affect on anything in this case;
+ command->SendResponse(true, kMobResultSuccess, NULL, NULL);
+
+ EXPECT_EQ(RequestState::kTimedOut, command->current_state());
+}
+
+TEST_F(CommandRequestImplTest, SendResponse_SUCCESS) {
+ MessageSharedPtr msg;
+ CommandPtr command = CreateCommand<UCommandRequestImpl>(msg);
+
+ EXPECT_TRUE(smart_objects::SmartType_Null == (*msg).getType());
+
+ MessageSharedPtr result;
+ EXPECT_CALL(app_mngr_, ManageMobileCommand(_, _))
+ .WillOnce(DoAll(SaveArg<0>(&result), Return(true)));
+
+ // Args do not affect on anything in this case;
+ command->SendResponse(true, kMobResultSuccess, NULL, NULL);
+
+ EXPECT_EQ(RequestState::kCompleted, command->current_state());
+
+ EXPECT_TRUE(smart_objects::SmartType_Map == (*msg).getType());
+}
+
+TEST_F(CommandRequestImplTest,
+ SendResponse_AddDisallowedParametersToInfo_SUCCESS) {
+ am::VehicleData vehicle_data;
+ vehicle_data.insert(am::VehicleData::value_type(kDisallowedParam1,
+ am::VehicleDataType::MYKEY));
+
+ EXPECT_CALL(*mock_message_helper_, vehicle_data())
+ .WillOnce(ReturnRef(vehicle_data));
+
+ MessageSharedPtr msg = CreateMessage();
+ (*msg)[strings::params][strings::function_id] =
+ mobile_apis::FunctionID::SubscribeVehicleDataID;
+
+ CommandPtr command = CreateCommand<UCommandRequestImpl>(msg);
+
+ command->removed_parameters_permissions().disallowed_params.push_back(
+ kDisallowedParam1);
+
+ MessageSharedPtr result;
+ EXPECT_CALL(app_mngr_, ManageMobileCommand(_, _))
+ .WillOnce(DoAll(SaveArg<0>(&result), Return(true)));
+
+ command->SendResponse(true, kMobResultSuccess, NULL, NULL);
+
+ EXPECT_EQ(RequestState::kCompleted, command->current_state());
+
+ EXPECT_TRUE((*result)[strings::msg_params].keyExists(strings::info));
+ EXPECT_NE("", (*result)[strings::msg_params][strings::info].asString());
+}
+
+} // namespace commands_test
+} // namespace components
+} // namespace test
diff --git a/src/components/application_manager/test/commands/command_response_impl_test.cc b/src/components/application_manager/test/commands/command_response_impl_test.cc
new file mode 100644
index 0000000000..c7a5edae63
--- /dev/null
+++ b/src/components/application_manager/test/commands/command_response_impl_test.cc
@@ -0,0 +1,184 @@
+/*
+ * Copyright (c) 2016, 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 "utils/shared_ptr.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/command_response_impl.h"
+#include "application_manager/mock_application.h"
+
+namespace test {
+namespace components {
+namespace commands_test {
+
+namespace strings = ::application_manager::strings;
+namespace hmi_response = ::application_manager::hmi_response;
+using ::utils::SharedPtr;
+using ::application_manager::commands::MessageSharedPtr;
+using ::application_manager::commands::CommandResponseImpl;
+
+class CommandResponseImplTest
+ : public CommandsTest<CommandsTestMocks::kIsNice> {};
+
+TEST_F(CommandResponseImplTest, BasicMethodsOverloads_SUCCESS) {
+ SharedPtr<CommandResponseImpl> command = CreateCommand<CommandResponseImpl>();
+ // Current implementation always return `true`
+ EXPECT_TRUE(command->Init());
+ EXPECT_TRUE(command->CleanUp());
+ EXPECT_NO_THROW(command->Run());
+}
+
+TEST_F(CommandResponseImplTest, SendResponse_MessageWithResultCode_SUCCESS) {
+ MessageSharedPtr msg;
+ SharedPtr<CommandResponseImpl> command =
+ CreateCommand<CommandResponseImpl>(msg);
+ // Do not have a weight in this case
+ const bool kSuccess = true;
+ const mobile_apis::Result::eType kResultCode =
+ mobile_apis::Result::eType::INVALID_ENUM;
+ const bool kFinalResponse = true;
+
+ // If `msg_params->result_code` exist in message,
+ // then send message to mobile.
+ (*msg)[strings::msg_params][strings::result_code] = kResultCode;
+
+ EXPECT_CALL(app_mngr_, SendMessageToMobile(msg, kFinalResponse));
+
+ command->SendResponse(kSuccess, kResultCode, kFinalResponse);
+}
+
+TEST_F(CommandResponseImplTest,
+ SendResponse_EmptyMessageValidResultCode_SUCCESS) {
+ MessageSharedPtr msg;
+ SharedPtr<CommandResponseImpl> command =
+ CreateCommand<CommandResponseImpl>(msg);
+
+ const bool kSuccess = true;
+ const mobile_apis::Result::eType kResultCode =
+ mobile_apis::Result::eType::SUCCESS;
+ const bool kFinalResponse = true;
+
+ EXPECT_CALL(app_mngr_, SendMessageToMobile(msg, kFinalResponse));
+
+ // If `msg_params->result_code` does not exist in message
+ // and arg `result_code` not equals `INVALID_ENUM`,
+ // then set it to `msg_params->result_code` and send message to mobile.
+ command->SendResponse(kSuccess, kResultCode, kFinalResponse);
+
+ EXPECT_EQ(kResultCode,
+ (*msg)[strings::msg_params][strings::result_code].asInt());
+}
+
+TEST_F(CommandResponseImplTest,
+ SendResponse_EmptyMessageInvalidResultCode_SUCCESS) {
+ MessageSharedPtr msg;
+ SharedPtr<CommandResponseImpl> command =
+ CreateCommand<CommandResponseImpl>(msg);
+
+ const bool kSuccess = true;
+ const mobile_apis::Result::eType kResultCode =
+ mobile_apis::Result::eType::INVALID_ENUM;
+ const bool kFinalResponse = true;
+
+ // If `msg_params->result_code` does not exist in message
+ // and arg `result_code` equals `INVALID_ENUM`,
+ // then if `params->hmi_response::code` exist in message,
+ // then set it to `msg_params->result_code` and send message to mobile.
+ (*msg)[strings::params][hmi_response::code] = mobile_apis::Result::SUCCESS;
+
+ EXPECT_CALL(app_mngr_, SendMessageToMobile(msg, kFinalResponse));
+
+ command->SendResponse(kSuccess, kResultCode, kFinalResponse);
+
+ EXPECT_EQ((*msg)[strings::params][hmi_response::code].asInt(),
+ (*msg)[strings::msg_params][strings::result_code].asInt());
+}
+
+TEST_F(CommandResponseImplTest,
+ SendResponse_EmptyMessageInvalidResultCodeNoHmiResponse_SUCCESS) {
+ MessageSharedPtr msg;
+ SharedPtr<CommandResponseImpl> command =
+ CreateCommand<CommandResponseImpl>(msg);
+
+ const mobile_apis::Result::eType kResultCode =
+ mobile_apis::Result::eType::INVALID_ENUM;
+ const bool kFinalResponse = true;
+
+ // If `msg_params->result_code` does not exist in message
+ // and arg `result_code` equals `INVALID_ENUM`,
+ // then if `params->hmi_response::code` does not exist in message,
+ // then if `kSuccess` equals `true`,
+ // then `msg_params->result_code` will be `SUCCESS`
+ const bool kSuccess = true;
+
+ EXPECT_CALL(app_mngr_, SendMessageToMobile(msg, kFinalResponse));
+
+ command->SendResponse(kSuccess, kResultCode, kFinalResponse);
+
+ EXPECT_EQ(mobile_apis::Result::SUCCESS,
+ (*msg)[strings::msg_params][strings::result_code].asInt());
+}
+
+TEST_F(CommandResponseImplTest,
+ SendResponse_EmptyMessageInvalidResultCodeNoHmiResponse_INVALID_ENUM) {
+ MessageSharedPtr msg;
+ SharedPtr<CommandResponseImpl> command =
+ CreateCommand<CommandResponseImpl>(msg);
+
+ const mobile_apis::Result::eType kResultCode =
+ mobile_apis::Result::eType::INVALID_ENUM;
+ const bool kFinalResponse = true;
+
+ // If `msg_params->result_code` does not exist in message
+ // and arg `result_code` equals `INVALID_ENUM`,
+ // then if `params->hmi_response::code` does not exist in message,
+ // then if `kSuccess` equals `false`,
+ // then `msg_params->result_code` will be `INVALID_ENUM`
+ const bool kSuccess = false;
+
+ EXPECT_CALL(app_mngr_, SendMessageToMobile(msg, kFinalResponse));
+
+ command->SendResponse(kSuccess, kResultCode, kFinalResponse);
+
+ EXPECT_EQ(mobile_apis::Result::INVALID_ENUM,
+ (*msg)[strings::msg_params][strings::result_code].asInt());
+}
+
+} // namespace commands_test
+} // namespace components
+} // namespace test
diff --git a/src/components/application_manager/test/commands/mobile/CMakeLists.txt b/src/components/application_manager/test/commands/mobile/CMakeLists.txt
new file mode 100644
index 0000000000..4cb07942b2
--- /dev/null
+++ b/src/components/application_manager/test/commands/mobile/CMakeLists.txt
@@ -0,0 +1,61 @@
+# Copyright (c) 2016, 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_directories(
+ ${GMOCK_INCLUDE_DIRECTORY}
+ ${COMPONENTS_DIR}/application_manager/include/application_manager/
+ ${COMPONENTS_DIR}/application_manager/include/application_manager/commands/
+ ${COMPONENTS_DIR}/application_manager/test/include/
+ ${COMPONENTS_DIR}/application_manager/test/include/application_manager/
+)
+
+set (SOURCES
+ ${AM_SOURCE_DIR}/src/smart_object_keys.cc
+ ${AM_SOURCE_DIR}/test/mock_message_helper.cc
+ ${COMMANDS_TEST_SOURCE_DIR}/mobile/simple_response_commands_test.cc
+ ${COMMANDS_TEST_SOURCE_DIR}/mobile/list_files_request_test.cc
+ ${COMMANDS_TEST_SOURCE_DIR}/mobile/read_did_request_test.cc
+ ${COMMANDS_TEST_SOURCE_DIR}/mobile/alert_maneuver_request_test.cc
+ ${COMMANDS_TEST_SOURCE_DIR}/mobile/subscribe_button_request_test.cc
+ ${COMMANDS_TEST_SOURCE_DIR}/mobile/alert_request_test.cc
+)
+
+set(LIBRARIES
+ gmock
+ jsoncpp
+ Utils
+ ApplicationManager
+ connectionHandler
+ HMI_API
+ MOBILE_API
+ SmartObjects
+)
+
+create_test("mobile_commands_test" "${SOURCES}" "${LIBRARIES}" )
diff --git a/src/components/application_manager/test/commands/mobile/add_command_request_test.cc b/src/components/application_manager/test/commands/mobile/add_command_request_test.cc
new file mode 100644
index 0000000000..7e50cfd13a
--- /dev/null
+++ b/src/components/application_manager/test/commands/mobile/add_command_request_test.cc
@@ -0,0 +1,334 @@
+/*
+ * Copyright (c) 2016, 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 <set>
+
+#include "gtest/gtest.h"
+#include "utils/shared_ptr.h"
+#include "utils/helpers.h"
+#include "utils/make_shared.h"
+#include "smart_objects/smart_object.h"
+#include "interfaces/MOBILE_API.h"
+#include "utils/custom_string.h"
+#include "application_manager/commands/command_request_test.h"
+#include "application_manager/commands/mobile/add_command_request.h"
+#include "application_manager/smart_object_keys.h"
+#include "application_manager/commands/commands_test.h"
+#include "application_manager/commands/command_impl.h"
+#include "policy/usage_statistics/mock_statistics_manager.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"
+
+namespace test {
+namespace components {
+namespace commands_test {
+
+namespace am = application_manager;
+using am::commands::CommandImpl;
+using am::ApplicationManager;
+using am::commands::MessageSharedPtr;
+using am::ApplicationSharedPtr;
+using am::MockMessageHelper;
+using ::testing::_;
+using ::utils::SharedPtr;
+using ::testing::Return;
+using am::commands::AddCommandRequest;
+using ::test::components::application_manager_test::MockApplication;
+using usage_statistics_test::MockStatisticsManager;
+using am::event_engine::EventObserver;
+
+namespace custom_str = utils::custom_string;
+namespace strings = ::application_manager::strings;
+namespace hmi_response = ::application_manager::hmi_response;
+
+namespace {
+const hmi_apis::FunctionID::eType kInvalidFunctionId =
+ hmi_apis::FunctionID::INVALID_ENUM;
+const int32_t kCommandId = 1;
+const uint32_t kAppId = 1u;
+const uint32_t kCmdId = 1u;
+const uint32_t kConnectionKey = 2u;
+} // namespace
+
+class AddCommandRequestTest
+ : public CommandRequestTest<CommandsTestMocks::kIsNice> {
+ public:
+ sync_primitives::Lock lock_;
+ MessageSharedPtr CreateFullParamsUISO() {
+ MessageSharedPtr msg = CreateMessage(smart_objects::SmartType_Map);
+ (*msg)[strings::params][strings::connection_key] = kConnectionKey;
+ smart_objects::SmartObject menu_params =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
+ menu_params[strings::position] = 10;
+ menu_params[strings::menu_name] = "LG";
+
+ smart_objects::SmartObject msg_params =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
+ msg_params[strings::cmd_id] = kCmdId;
+ msg_params[strings::menu_params] = menu_params;
+ msg_params[strings::app_id] = kAppId;
+ msg_params[strings::cmd_icon] = 1;
+ msg_params[strings::cmd_icon][strings::value] = "10";
+ (*msg)[strings::msg_params] = msg_params;
+
+ return msg;
+ }
+
+ MessageSharedPtr CreateFullParamsVRSO() {
+ MessageSharedPtr msg = CreateMessage(smart_objects::SmartType_Map);
+ (*msg)[strings::params][strings::connection_key] = kConnectionKey;
+ smart_objects::SmartObject msg_params =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
+ msg_params[strings::cmd_id] = kCmdId;
+ msg_params[strings::vr_commands] =
+ smart_objects::SmartObject(smart_objects::SmartType_Array);
+ msg_params[strings::vr_commands][0] = "lamer";
+ msg_params[strings::type] = 34;
+ msg_params[strings::grammar_id] = 12;
+ msg_params[strings::app_id] = kAppId;
+ (*msg)[strings::msg_params] = msg_params;
+
+ return msg;
+ }
+};
+
+TEST_F(AddCommandRequestTest, GetRunMethods_SUCCESS) {
+ MessageSharedPtr msg = CreateFullParamsUISO();
+ SmartObject image = (*msg)[strings::msg_params][strings::cmd_icon];
+
+ utils::SharedPtr<AddCommandRequest> req =
+ CreateCommand<AddCommandRequest>(msg);
+
+ MockAppPtr mock_app = CreateMockApp();
+ ON_CALL(app_mngr_, application(kConnectionKey))
+ .WillByDefault(Return(mock_app));
+
+ MockMessageHelper* mock_message_helper =
+ MockMessageHelper::message_helper_mock();
+ EXPECT_CALL(*mock_message_helper, VerifyImage(image, _, _))
+ .WillOnce(Return(mobile_apis::Result::SUCCESS));
+
+ smart_objects::SmartObject* ptr = NULL;
+ EXPECT_CALL(*mock_app, FindCommand(kCmdId)).WillOnce(Return(ptr));
+ EXPECT_EQ(NULL, ptr);
+ EXPECT_CALL(*mock_app, AddCommand(kCmdId, (*msg)[strings::msg_params]));
+
+ am::CommandsMap commands_map;
+ ON_CALL(*mock_app, commands_map())
+ .WillByDefault(Return(
+ DataAccessor<application_manager::CommandsMap>(commands_map, lock_)));
+
+ MessageSharedPtr ui_command_result;
+ {
+ EXPECT_CALL(app_mngr_, ManageHMICommand(_))
+ .WillOnce(DoAll(SaveArg<0>(&ui_command_result), Return(true)));
+ }
+
+ req->Run();
+
+ ASSERT_TRUE(ui_command_result);
+}
+
+TEST_F(AddCommandRequestTest, OnEvent_UI_SUCCESS) {
+ MessageSharedPtr msg_ui = CreateFullParamsUISO();
+ SmartObject image = (*msg_ui)[strings::msg_params][strings::cmd_icon];
+
+ utils::SharedPtr<AddCommandRequest> req_ui =
+ CreateCommand<AddCommandRequest>(msg_ui);
+
+ (*msg_ui)[strings::params][hmi_response::code] =
+ hmi_apis::Common_Result::SUCCESS;
+
+ MockAppPtr mock_app = CreateMockApp();
+ ON_CALL(app_mngr_, application(kConnectionKey))
+ .WillByDefault(Return(mock_app));
+ ON_CALL(*mock_app, app_id()).WillByDefault(Return(1));
+
+ MockMessageHelper* mock_message_helper =
+ MockMessageHelper::message_helper_mock();
+ EXPECT_CALL(*mock_message_helper, VerifyImage(image, _, _))
+ .WillOnce(Return(mobile_apis::Result::SUCCESS));
+
+ smart_objects::SmartObject* ptr = NULL;
+ ON_CALL(*mock_app, FindCommand(kCmdId)).WillByDefault(Return(ptr));
+ EXPECT_EQ(NULL, ptr);
+
+ EXPECT_CALL(*mock_app, AddCommand(kCmdId, (*msg_ui)[strings::msg_params]));
+
+ am::CommandsMap commands_map;
+ ON_CALL(*mock_app, commands_map())
+ .WillByDefault(
+ Return(DataAccessor<am::CommandsMap>(commands_map, lock_)));
+
+ am::event_engine::Event event(hmi_apis::FunctionID::UI_AddCommand);
+ event.set_smart_object(*msg_ui);
+
+ MessageSharedPtr ui_command_result;
+ {
+ EXPECT_CALL(app_mngr_, ManageHMICommand(_))
+ .WillOnce(DoAll(SaveArg<0>(&ui_command_result), Return(true)));
+ }
+
+ req_ui->Run();
+
+ ASSERT_TRUE(ui_command_result);
+
+ ON_CALL(app_mngr_, application(kConnectionKey))
+ .WillByDefault(Return(mock_app));
+ ON_CALL(*mock_app, app_id()).WillByDefault(Return(1));
+
+ EXPECT_CALL(*mock_message_helper,
+ HMIToMobileResult(hmi_apis::Common_Result::SUCCESS))
+ .WillOnce(Return(mobile_apis::Result::SUCCESS));
+
+ EXPECT_CALL(*mock_app, UpdateHash());
+
+ req_ui->on_event(event);
+}
+
+TEST_F(AddCommandRequestTest, OnEvent_VR_SUCCESS) {
+ MessageSharedPtr msg_vr = CreateFullParamsVRSO();
+
+ utils::SharedPtr<AddCommandRequest> req_vr =
+ CreateCommand<AddCommandRequest>(msg_vr);
+
+ MockAppPtr mock_app = CreateMockApp();
+ ON_CALL(app_mngr_, application(kConnectionKey))
+ .WillByDefault(Return(mock_app));
+ ON_CALL(*mock_app, app_id()).WillByDefault(Return(1));
+
+ MessageSharedPtr msg = CreateMessage(smart_objects::SmartType_Map);
+ (*msg)[strings::params][hmi_response::code] =
+ hmi_apis::Common_Result::SUCCESS;
+ (*msg)[strings::msg_params][strings::cmd_id] = kCommandId;
+
+ am::event_engine::Event event(hmi_apis::FunctionID::VR_AddCommand);
+ event.set_smart_object(*msg);
+
+ smart_objects::SmartObject* ptr = NULL;
+ ON_CALL(*mock_app, FindCommand(kCmdId)).WillByDefault(Return(ptr));
+ EXPECT_EQ(NULL, ptr);
+
+ MockMessageHelper* mock_message_helper =
+ MockMessageHelper::message_helper_mock();
+ EXPECT_CALL(*mock_message_helper,
+ HMIToMobileResult(hmi_apis::Common_Result::SUCCESS))
+ .WillOnce(Return(mobile_apis::Result::SUCCESS));
+
+ EXPECT_CALL(*mock_app, AddCommand(kCmdId, (*msg_vr)[strings::msg_params]));
+
+ am::CommandsMap commands_map;
+ ON_CALL(*mock_app, commands_map())
+ .WillByDefault(
+ Return(DataAccessor<am::CommandsMap>(commands_map, lock_)));
+
+ EXPECT_CALL(*mock_app, UpdateHash());
+
+ MessageSharedPtr vr_command_result;
+ {
+ EXPECT_CALL(app_mngr_, ManageHMICommand(_))
+ .WillOnce(DoAll(SaveArg<0>(&vr_command_result), Return(true)));
+ }
+
+ req_vr->Run();
+
+ ASSERT_TRUE(vr_command_result);
+
+ req_vr->on_event(event);
+}
+
+TEST_F(AddCommandRequestTest, OnEvent_BothSend_SUCCESS) {
+ MessageSharedPtr msg = CreateMessage(smart_objects::SmartType_Map);
+ smart_objects::SmartObject msg_params =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
+ (*msg)[strings::params][strings::connection_key] = kConnectionKey;
+
+ msg_params[strings::cmd_id] = kCommandId;
+ msg_params[strings::vr_commands] =
+ smart_objects::SmartObject(smart_objects::SmartType_Array);
+ msg_params[strings::vr_commands][0] = "lamer";
+
+ smart_objects::SmartObject menu_params =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
+ menu_params[strings::position] = 10;
+ menu_params[strings::menu_name] = "LG";
+
+ msg_params[strings::menu_params] = menu_params;
+ msg_params[strings::type] = 34;
+ msg_params[strings::grammar_id] = 12;
+ msg_params[strings::app_id] = 20;
+
+ utils::SharedPtr<AddCommandRequest> req_ui =
+ CreateCommand<AddCommandRequest>(msg);
+
+ MessageSharedPtr msg1 = CreateMessage(smart_objects::SmartType_Map);
+ (*msg1)[strings::params][hmi_response::code] =
+ hmi_apis::Common_Result::SUCCESS;
+ (*msg1)[strings::msg_params][strings::cmd_id] = kCommandId;
+ am::event_engine::Event event_ui(hmi_apis::FunctionID::UI_AddCommand);
+ event_ui.set_smart_object(*msg1);
+
+ am::event_engine::Event event_vr(hmi_apis::FunctionID::VR_AddCommand);
+ event_vr.set_smart_object(*msg1);
+
+ MockAppPtr mock_app = CreateMockApp();
+ ON_CALL(app_mngr_, application(kConnectionKey))
+ .WillByDefault(Return(mock_app));
+ ON_CALL(*mock_app, app_id()).WillByDefault(Return(1));
+
+ EXPECT_CALL(*mock_app, RemoveCommand(kCommandId)).Times(0);
+
+ req_ui->Run();
+ req_ui->on_event(event_ui);
+ req_ui->on_event(event_vr);
+}
+
+TEST_F(AddCommandRequestTest, OnEvent_UnknownEvent_UNSUCCESS) {
+ Event event(hmi_apis::FunctionID::INVALID_ENUM);
+ MessageSharedPtr msg = CreateMessage(smart_objects::SmartType_Map);
+ utils::SharedPtr<AddCommandRequest> request =
+ CreateCommand<AddCommandRequest>(msg);
+
+ MockAppPtr mock_app = CreateMockApp();
+ ON_CALL(app_mngr_, application(_)).WillByDefault(Return(mock_app));
+
+ EXPECT_CALL(app_mngr_, ManageMobileCommand(_, _)).Times(0);
+
+ request->on_event(event);
+}
+} // namespace commands_test
+} // namespace components
+} // namespace tests
diff --git a/src/components/application_manager/test/commands/mobile/add_sub_menu_request_test.cc b/src/components/application_manager/test/commands/mobile/add_sub_menu_request_test.cc
new file mode 100644
index 0000000000..51040d0351
--- /dev/null
+++ b/src/components/application_manager/test/commands/mobile/add_sub_menu_request_test.cc
@@ -0,0 +1,219 @@
+/*
+ * Copyright (c) 2016, 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 "utils/shared_ptr.h"
+#include "smart_objects/smart_object.h"
+#include "application_manager/smart_object_keys.h"
+#include "commands/commands_test.h"
+#include "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/event_engine/event.h"
+#include "mobile/add_sub_menu_request.h"
+#include "interfaces/MOBILE_API.h"
+#include "application_manager/policies/policy_handler_interface.h"
+
+namespace test {
+namespace components {
+namespace commands_test {
+namespace mobile_commands_test {
+
+using ::testing::_;
+using ::testing::Return;
+using ::testing::ReturnRef;
+namespace am = ::application_manager;
+using am::commands::AddSubMenuRequest;
+using am::commands::MessageSharedPtr;
+using am::event_engine::Event;
+
+typedef SharedPtr<AddSubMenuRequest> AddSubMenuPtr;
+
+namespace {
+const uint32_t kConnectionKey = 2u;
+const int32_t kMenuId = 5;
+} // namespace
+
+class AddSubMenuRequestTest
+ : public CommandRequestTest<CommandsTestMocks::kIsNice> {};
+
+TEST_F(AddSubMenuRequestTest, OnEvent_UnknownEvent_UNSUCCESS) {
+ Event event(hmi_apis::FunctionID::INVALID_ENUM);
+ AddSubMenuPtr command(CreateCommand<AddSubMenuRequest>());
+
+ EXPECT_CALL(app_mngr_, ManageMobileCommand(_, _)).Times(0);
+
+ command->on_event(event);
+}
+
+TEST_F(AddSubMenuRequestTest, OnEvent_SUCCESS) {
+ Event event(hmi_apis::FunctionID::UI_AddSubMenu);
+ MessageSharedPtr event_msg(CreateMessage(smart_objects::SmartType_Map));
+ (*event_msg)[am::strings::params][am::hmi_response::code] =
+ mobile_apis::Result::SUCCESS;
+ (*event_msg)[am::strings::msg_params] = 0;
+
+ event.set_smart_object(*event_msg);
+
+ MessageSharedPtr command_msg(CreateMessage(smart_objects::SmartType_Map));
+ (*command_msg)[am::strings::params][am::strings::connection_key] =
+ kConnectionKey;
+
+ AddSubMenuPtr command(CreateCommand<AddSubMenuRequest>(command_msg));
+
+ MockAppPtr app(CreateMockApp());
+ EXPECT_CALL(app_mngr_, application(kConnectionKey)).WillOnce(Return(app));
+
+ MessageSharedPtr result_msg(
+ CatchMobileCommandResult(CallOnEvent(*command, event)));
+ const mobile_apis::Result::eType kReceivedResult =
+ static_cast<mobile_apis::Result::eType>(
+ (*result_msg)[am::strings::msg_params][am::strings::result_code]
+ .asInt());
+ EXPECT_EQ(mobile_apis::Result::SUCCESS, kReceivedResult);
+}
+
+TEST_F(AddSubMenuRequestTest, Run_ApplicationIsNotRegistered_UNSUCCESS) {
+ AddSubMenuPtr command(CreateCommand<AddSubMenuRequest>());
+
+ EXPECT_CALL(app_mngr_, application(_))
+ .WillOnce(Return(ApplicationSharedPtr()));
+
+ MessageSharedPtr result_msg(CatchMobileCommandResult(CallRun(*command)));
+ const mobile_apis::Result::eType kReceivedResult =
+ static_cast<mobile_apis::Result::eType>(
+ (*result_msg)[am::strings::msg_params][am::strings::result_code]
+ .asInt());
+ EXPECT_EQ(mobile_apis::Result::APPLICATION_NOT_REGISTERED, kReceivedResult);
+}
+
+TEST_F(AddSubMenuRequestTest, Run_InvalidSubMenuId_UNSUCCESS) {
+ MessageSharedPtr command_msg(CreateMessage(smart_objects::SmartType_Map));
+ (*command_msg)[am::strings::msg_params][am::strings::menu_id] = kMenuId;
+ (*command_msg)[am::strings::params][am::strings::connection_key] =
+ kConnectionKey;
+
+ AddSubMenuPtr command(CreateCommand<AddSubMenuRequest>(command_msg));
+
+ MockAppPtr app(CreateMockApp());
+ MessageSharedPtr dummy_sub_menu(CreateMessage(smart_objects::SmartType_Null));
+ EXPECT_CALL(app_mngr_, application(kConnectionKey)).WillOnce(Return(app));
+ EXPECT_CALL(*app, FindSubMenu(kMenuId))
+ .WillOnce(Return(dummy_sub_menu.get()));
+
+ MessageSharedPtr result_msg(CatchMobileCommandResult(CallRun(*command)));
+ const mobile_apis::Result::eType kReceivedResult =
+ static_cast<mobile_apis::Result::eType>(
+ (*result_msg)[am::strings::msg_params][am::strings::result_code]
+ .asInt());
+ EXPECT_EQ(mobile_apis::Result::INVALID_ID, kReceivedResult);
+}
+
+TEST_F(AddSubMenuRequestTest, Run_DuplicatedSubMenuName_UNSUCCESS) {
+ MessageSharedPtr command_msg(CreateMessage(smart_objects::SmartType_Map));
+ (*command_msg)[am::strings::msg_params][am::strings::menu_id] = kMenuId;
+ (*command_msg)[am::strings::params][am::strings::connection_key] =
+ kConnectionKey;
+
+ AddSubMenuPtr command(CreateCommand<AddSubMenuRequest>(command_msg));
+
+ MockAppPtr app(CreateMockApp());
+
+ EXPECT_CALL(app_mngr_, application(kConnectionKey)).WillOnce(Return(app));
+ EXPECT_CALL(*app, FindSubMenu(kMenuId))
+ .WillOnce(Return(static_cast<SmartObject*>(NULL)));
+ EXPECT_CALL(*app, IsSubMenuNameAlreadyExist(_)).WillOnce(Return(true));
+
+ MessageSharedPtr result_msg(CatchMobileCommandResult(CallRun(*command)));
+ const mobile_apis::Result::eType kReceivedResult =
+ static_cast<mobile_apis::Result::eType>(
+ (*result_msg)[am::strings::msg_params][am::strings::result_code]
+ .asInt());
+ EXPECT_EQ(mobile_apis::Result::DUPLICATE_NAME, kReceivedResult);
+}
+
+TEST_F(AddSubMenuRequestTest, Run_NotValidSubMenuName_UNSUCCESS) {
+ MessageSharedPtr command_msg(CreateMessage(smart_objects::SmartType_Map));
+ (*command_msg)[am::strings::msg_params][am::strings::menu_id] = kMenuId;
+ (*command_msg)[am::strings::params][am::strings::connection_key] =
+ kConnectionKey;
+ // Not valid sub-menu name.
+ (*command_msg)[am::strings::msg_params][am::strings::menu_name] = "\t\n";
+
+ AddSubMenuPtr command(CreateCommand<AddSubMenuRequest>(command_msg));
+
+ MockAppPtr app(CreateMockApp());
+ EXPECT_CALL(app_mngr_, application(kConnectionKey)).WillOnce(Return(app));
+ EXPECT_CALL(*app, FindSubMenu(kMenuId))
+ .WillOnce(Return(static_cast<SmartObject*>(NULL)));
+
+ MessageSharedPtr result_msg(CatchMobileCommandResult(CallRun(*command)));
+ const mobile_apis::Result::eType kReceivedResult =
+ static_cast<mobile_apis::Result::eType>(
+ (*result_msg)[am::strings::msg_params][am::strings::result_code]
+ .asInt());
+ EXPECT_EQ(mobile_apis::Result::INVALID_DATA, kReceivedResult);
+}
+
+TEST_F(AddSubMenuRequestTest, Run_SUCCESS) {
+ MessageSharedPtr command_msg(CreateMessage(smart_objects::SmartType_Map));
+ (*command_msg)[am::strings::msg_params][am::strings::menu_id] = kMenuId;
+ (*command_msg)[am::strings::params][am::strings::connection_key] =
+ kConnectionKey;
+ (*command_msg)[am::strings::msg_params][am::strings::menu_name] =
+ "valid_sub_menu_name";
+ (*command_msg)[am::strings::msg_params][am::strings::position] =
+ "test_position";
+
+ AddSubMenuPtr command(CreateCommand<AddSubMenuRequest>(command_msg));
+
+ MockAppPtr app(CreateMockApp());
+ EXPECT_CALL(app_mngr_, application(kConnectionKey)).WillOnce(Return(app));
+ EXPECT_CALL(*app, FindSubMenu(kMenuId))
+ .WillOnce(Return(static_cast<SmartObject*>(NULL)));
+
+ MessageSharedPtr result_msg(CatchHMICommandResult(CallRun(*command)));
+ const hmi_apis::FunctionID::eType kReceivedResult =
+ static_cast<hmi_apis::FunctionID::eType>(
+ (*result_msg)[am::strings::params][am::strings::function_id].asInt());
+ EXPECT_EQ(hmi_apis::FunctionID::UI_AddSubMenu, kReceivedResult);
+}
+
+} // namespace mobile_commands_test
+} // namespace commands_test
+} // namespace components
+} // namespace test
diff --git a/src/components/application_manager/test/commands/mobile/alert_maneuver_request_test.cc b/src/components/application_manager/test/commands/mobile/alert_maneuver_request_test.cc
new file mode 100644
index 0000000000..dd98b9a01a
--- /dev/null
+++ b/src/components/application_manager/test/commands/mobile/alert_maneuver_request_test.cc
@@ -0,0 +1,189 @@
+/*
+ * Copyright (c) 2016, 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 "utils/shared_ptr.h"
+#include "smart_objects/smart_object.h"
+#include "application_manager/smart_object_keys.h"
+#include "commands/commands_test.h"
+#include "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 "event_engine/event.h"
+#include "mobile/alert_maneuver_request.h"
+#include "interfaces/MOBILE_API.h"
+#include "application_manager/policies/policy_handler_interface.h"
+
+namespace test {
+namespace components {
+namespace commands_test {
+namespace mobile_commands_test {
+
+using ::testing::_;
+using ::testing::Return;
+using ::testing::ReturnRef;
+namespace am = ::application_manager;
+using am::commands::AlertManeuverRequest;
+using am::commands::MessageSharedPtr;
+using am::event_engine::Event;
+
+typedef SharedPtr<AlertManeuverRequest> CommandPtr;
+
+class AlertManeuverRequestTest
+ : public CommandRequestTest<CommandsTestMocks::kIsNice> {};
+
+TEST_F(AlertManeuverRequestTest, Run_RequiredFieldsDoesNotExist_UNSUCCESS) {
+ CommandPtr command(CreateCommand<AlertManeuverRequest>());
+ EXPECT_CALL(app_mngr_, application(_)).Times(0);
+ MessageSharedPtr result_msg(CatchMobileCommandResult(CallRun(*command)));
+ EXPECT_EQ(mobile_apis::Result::INVALID_DATA,
+ static_cast<mobile_apis::Result::eType>(
+ (*result_msg)[am::strings::msg_params][am::strings::result_code]
+ .asInt()));
+}
+
+TEST_F(AlertManeuverRequestTest, Run_ApplicationIsNotRegistered_UNSUCCESS) {
+ MessageSharedPtr msg = CreateMessage(smart_objects::SmartType_Map);
+ (*msg)[am::strings::msg_params][am::strings::soft_buttons] = 0;
+ (*msg)[am::strings::msg_params][am::strings::tts_chunks] = 0;
+
+ CommandPtr command(CreateCommand<AlertManeuverRequest>(msg));
+
+ ON_CALL(app_mngr_, application(_))
+ .WillByDefault(Return(ApplicationSharedPtr()));
+
+ MessageSharedPtr result_msg(CatchMobileCommandResult(CallRun(*command)));
+ EXPECT_EQ(mobile_apis::Result::APPLICATION_NOT_REGISTERED,
+ static_cast<mobile_apis::Result::eType>(
+ (*result_msg)[am::strings::msg_params][am::strings::result_code]
+ .asInt()));
+}
+
+TEST_F(AlertManeuverRequestTest, Run_ProcessingResult_UNSUCCESS) {
+ MessageSharedPtr msg = CreateMessage(smart_objects::SmartType_Map);
+ (*msg)[am::strings::msg_params][am::strings::soft_buttons] = 0;
+
+ CommandPtr command(CreateCommand<AlertManeuverRequest>(msg));
+
+ MockAppPtr app(CreateMockApp());
+ ON_CALL(app_mngr_, application(_)).WillByDefault(Return(app));
+
+ ON_CALL(app_mngr_, GetPolicyHandler())
+ .WillByDefault(
+ ReturnRef(*static_cast<policy::PolicyHandlerInterface*>(NULL)));
+
+ const mobile_apis::Result::eType kProcessingResult =
+ mobile_apis::Result::ABORTED;
+
+ EXPECT_CALL(*(am::MockMessageHelper::message_helper_mock()),
+ ProcessSoftButtons(_, _, _, _))
+ .WillOnce(Return(kProcessingResult));
+
+ MessageSharedPtr result_msg(CatchMobileCommandResult(CallRun(*command)));
+ EXPECT_EQ(kProcessingResult,
+ static_cast<mobile_apis::Result::eType>(
+ (*result_msg)[am::strings::msg_params][am::strings::result_code]
+ .asInt()));
+}
+
+TEST_F(AlertManeuverRequestTest, Run_IsWhiteSpaceExist_UNSUCCESS) {
+ MessageSharedPtr msg = CreateMessage(smart_objects::SmartType_Map);
+ (*msg)[am::strings::msg_params][am::strings::soft_buttons] = 0;
+ (*msg)[am::strings::msg_params][am::strings::tts_chunks] =
+ SmartObject(smart_objects::SmartType_Array);
+
+ SmartObject tts_chunk(smart_objects::SmartType_Map);
+ tts_chunk[am::strings::text] = "wrong chunk syntax\t\n";
+
+ (*msg)[am::strings::msg_params][am::strings::tts_chunks].asArray()->push_back(
+ tts_chunk);
+
+ CommandPtr command(CreateCommand<AlertManeuverRequest>(msg));
+
+ MockAppPtr app(CreateMockApp());
+ ON_CALL(app_mngr_, application(_)).WillByDefault(Return(app));
+
+ MessageSharedPtr result_msg(CatchMobileCommandResult(CallRun(*command)));
+ EXPECT_EQ(mobile_apis::Result::INVALID_DATA,
+ static_cast<mobile_apis::Result::eType>(
+ (*result_msg)[am::strings::msg_params][am::strings::result_code]
+ .asInt()));
+}
+
+TEST_F(AlertManeuverRequestTest, Run_ProcessingResult_SUCCESS) {
+ MessageSharedPtr msg = CreateMessage(smart_objects::SmartType_Map);
+ (*msg)[am::strings::msg_params][am::strings::soft_buttons] = 0;
+
+ CommandPtr command(CreateCommand<AlertManeuverRequest>(msg));
+
+ MockAppPtr app(CreateMockApp());
+ ON_CALL(app_mngr_, application(_)).WillByDefault(Return(app));
+
+ ON_CALL(app_mngr_, GetPolicyHandler())
+ .WillByDefault(
+ ReturnRef(*static_cast<policy::PolicyHandlerInterface*>(NULL)));
+
+ EXPECT_CALL(*(am::MockMessageHelper::message_helper_mock()),
+ ProcessSoftButtons(_, _, _, _))
+ .WillOnce(Return(mobile_apis::Result::SUCCESS));
+
+ EXPECT_CALL(*(am::MockMessageHelper::message_helper_mock()),
+ SubscribeApplicationToSoftButton(_, _, _));
+
+ MessageSharedPtr result_msg(CatchHMICommandResult(CallRun(*command)));
+ EXPECT_EQ(hmi_apis::FunctionID::Navigation_AlertManeuver,
+ static_cast<hmi_apis::FunctionID::eType>(
+ (*result_msg)[am::strings::params][am::strings::function_id]
+ .asInt()));
+}
+
+TEST_F(AlertManeuverRequestTest, OnEvent_ReceivedUnknownEvent_UNSUCCESS) {
+ CommandPtr command(CreateCommand<AlertManeuverRequest>());
+ Event event(hmi_apis::FunctionID::INVALID_ENUM);
+
+ MessageSharedPtr result_msg(
+ CatchMobileCommandResult(CallOnEvent(*command, event)));
+ EXPECT_EQ(mobile_apis::Result::INVALID_ENUM,
+ static_cast<mobile_apis::Result::eType>(
+ (*result_msg)[am::strings::msg_params][am::strings::result_code]
+ .asInt()));
+}
+
+} // namespace mobile_commands_test
+} // namespace commands_test
+} // namespace components
+} // namespace test
diff --git a/src/components/application_manager/test/commands/mobile/alert_request_test.cc b/src/components/application_manager/test/commands/mobile/alert_request_test.cc
new file mode 100644
index 0000000000..9b94a8489e
--- /dev/null
+++ b/src/components/application_manager/test/commands/mobile/alert_request_test.cc
@@ -0,0 +1,237 @@
+/*
+ * Copyright (c) 2016, 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 "utils/shared_ptr.h"
+#include "smart_objects/smart_object.h"
+#include "application_manager/smart_object_keys.h"
+#include "commands/commands_test.h"
+#include "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 "event_engine/event.h"
+#include "mobile/alert_request.h"
+#include "interfaces/MOBILE_API.h"
+#include "application_manager/policies/policy_handler_interface.h"
+
+namespace test {
+namespace components {
+namespace commands_test {
+namespace mobile_commands_test {
+
+using ::testing::_;
+using ::testing::Return;
+using ::testing::ReturnRef;
+using ::testing::AtLeast;
+namespace am = ::application_manager;
+using am::commands::AlertRequest;
+using am::commands::MessageSharedPtr;
+using am::event_engine::Event;
+using am::MockMessageHelper;
+
+typedef SharedPtr<AlertRequest> CommandPtr;
+
+class AlertRequestTest : public CommandRequestTest<CommandsTestMocks::kIsNice> {
+};
+
+class CallOnTimeOut {
+ public:
+ CallOnTimeOut(CommandRequestImpl& command) : command_(command) {}
+
+ void operator()() {
+ command_.onTimeOut();
+ }
+
+ CommandRequestImpl& command_;
+};
+
+TEST_F(AlertRequestTest, OnTimeOut_UNSUCCESS) {
+ MessageSharedPtr msg(CreateMessage(smart_objects::SmartType_Map));
+ (*msg)[am::strings::msg_params][am::strings::soft_buttons] = 0;
+ CommandPtr command(CreateCommand<AlertRequest>(msg));
+
+ command->onTimeOut();
+ EXPECT_CALL(app_mngr_, ManageMobileCommand(_, _)).Times(0);
+}
+
+TEST_F(AlertRequestTest, OnTimeOut_SUCCESS) {
+ CommandPtr command(CreateCommand<AlertRequest>());
+
+ MessageSharedPtr sended_result_msg(
+ CreateMessage(smart_objects::SmartType_Null));
+ EXPECT_CALL(
+ *MockMessageHelper::message_helper_mock(),
+ CreateNegativeResponse(_, _, _, mobile_apis::Result::GENERIC_ERROR))
+ .WillOnce(Return(sended_result_msg));
+
+ MessageSharedPtr received_result_msg(
+ CatchMobileCommandResult(CallOnTimeOut(*command)));
+ EXPECT_EQ(sended_result_msg, received_result_msg);
+}
+
+TEST_F(AlertRequestTest, Run_ApplicationIsNotRegistered_UNSUCCESS) {
+ CommandPtr command(CreateCommand<AlertRequest>());
+
+ ON_CALL(app_mngr_, application(_))
+ .WillByDefault(Return(ApplicationSharedPtr()));
+
+ MessageSharedPtr result_msg(CatchMobileCommandResult(CallRun(*command)));
+ EXPECT_EQ(mobile_apis::Result::APPLICATION_NOT_REGISTERED,
+ static_cast<mobile_apis::Result::eType>(
+ (*result_msg)[am::strings::msg_params][am::strings::result_code]
+ .asInt()));
+}
+
+TEST_F(AlertRequestTest, Run_AlertFrequencyIsTooHigh_UNSUCCESS) {
+ CommandPtr command(CreateCommand<AlertRequest>());
+
+ MockAppPtr app(CreateMockApp());
+ ON_CALL(app_mngr_, application(_)).WillByDefault(Return(app));
+
+ ON_CALL(*app, hmi_level())
+ .WillByDefault(Return(mobile_apis::HMILevel::HMI_BACKGROUND));
+ ON_CALL(*app, AreCommandLimitsExceeded(_, _)).WillByDefault(Return(true));
+
+ 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(AlertRequestTest, Run_FailToProcessSoftButtons_UNSUCCESS) {
+ const mobile_apis::Result::eType kResultCode =
+ mobile_apis::Result::INVALID_ENUM;
+
+ CommandPtr command(CreateCommand<AlertRequest>());
+
+ MockAppPtr app(CreateMockApp());
+ ON_CALL(app_mngr_, application(_)).WillByDefault(Return(app));
+ ON_CALL(*app, hmi_level())
+ .WillByDefault(Return(mobile_apis::HMILevel::HMI_BACKGROUND));
+ ON_CALL(*app, AreCommandLimitsExceeded(_, _)).WillByDefault(Return(false));
+
+ ON_CALL(app_mngr_, GetPolicyHandler())
+ .WillByDefault(
+ ReturnRef(*static_cast<policy::PolicyHandlerInterface*>(NULL)));
+ EXPECT_CALL(*MockMessageHelper::message_helper_mock(),
+ ProcessSoftButtons(_, _, _, _)).WillOnce(Return(kResultCode));
+
+ MessageSharedPtr result_msg(CatchMobileCommandResult(CallRun(*command)));
+ EXPECT_EQ(kResultCode,
+ static_cast<mobile_apis::Result::eType>(
+ (*result_msg)[am::strings::msg_params][am::strings::result_code]
+ .asInt()));
+}
+
+TEST_F(AlertRequestTest, Run_MandatoryParametersAreMissed_UNSUCCESS) {
+ CommandPtr command(CreateCommand<AlertRequest>());
+
+ MockAppPtr app(CreateMockApp());
+ ON_CALL(app_mngr_, application(_)).WillByDefault(Return(app));
+ ON_CALL(*app, hmi_level())
+ .WillByDefault(Return(mobile_apis::HMILevel::HMI_BACKGROUND));
+ ON_CALL(*app, AreCommandLimitsExceeded(_, _)).WillByDefault(Return(false));
+
+ ON_CALL(app_mngr_, GetPolicyHandler())
+ .WillByDefault(
+ ReturnRef(*static_cast<policy::PolicyHandlerInterface*>(NULL)));
+ EXPECT_CALL(*MockMessageHelper::message_helper_mock(),
+ ProcessSoftButtons(_, _, _, _))
+ .WillOnce(Return(mobile_apis::Result::SUCCESS));
+
+ MessageSharedPtr result_msg(CatchMobileCommandResult(CallRun(*command)));
+ EXPECT_EQ(mobile_apis::Result::INVALID_DATA,
+ static_cast<mobile_apis::Result::eType>(
+ (*result_msg)[am::strings::msg_params][am::strings::result_code]
+ .asInt()));
+}
+
+TEST_F(AlertRequestTest, Run_MandatoryParametersAreInvalid_UNSUCCESS) {
+ MessageSharedPtr msg(CreateMessage(smart_objects::SmartType_Map));
+ (*msg)[am::strings::msg_params][am::strings::alert_text1] = 0;
+ (*msg)[am::strings::msg_params][am::strings::alert_text2] =
+ "invalid\t\nParam";
+
+ CommandPtr command(CreateCommand<AlertRequest>(msg));
+
+ MockAppPtr app(CreateMockApp());
+ ON_CALL(app_mngr_, application(_)).WillByDefault(Return(app));
+ ON_CALL(*app, hmi_level())
+ .WillByDefault(Return(mobile_apis::HMILevel::HMI_BACKGROUND));
+ ON_CALL(*app, AreCommandLimitsExceeded(_, _)).WillByDefault(Return(false));
+
+ MessageSharedPtr result_msg(CatchMobileCommandResult(CallRun(*command)));
+ EXPECT_EQ(mobile_apis::Result::INVALID_DATA,
+ static_cast<mobile_apis::Result::eType>(
+ (*result_msg)[am::strings::msg_params][am::strings::result_code]
+ .asInt()));
+}
+
+TEST_F(AlertRequestTest, Run_SUCCESS) {
+ MessageSharedPtr msg(CreateMessage(smart_objects::SmartType_Map));
+ (*msg)[am::strings::msg_params][am::strings::alert_text1] = "alert_text1";
+ (*msg)[am::strings::msg_params][am::strings::alert_text2] = "alert_text2";
+ (*msg)[am::strings::msg_params][am::strings::tts_chunks][0]
+ [am::strings::text] = "alert_text2";
+
+ CommandPtr command(CreateCommand<AlertRequest>(msg));
+
+ MockAppPtr app(CreateMockApp());
+ ON_CALL(app_mngr_, application(_)).WillByDefault(Return(app));
+ ON_CALL(*app, hmi_level())
+ .WillByDefault(Return(mobile_apis::HMILevel::HMI_BACKGROUND));
+ ON_CALL(*app, AreCommandLimitsExceeded(_, _)).WillByDefault(Return(false));
+
+ ON_CALL(app_mngr_, GetPolicyHandler())
+ .WillByDefault(
+ ReturnRef(*static_cast<policy::PolicyHandlerInterface*>(NULL)));
+ EXPECT_CALL(*MockMessageHelper::message_helper_mock(),
+ ProcessSoftButtons(_, _, _, _))
+ .WillOnce(Return(mobile_apis::Result::SUCCESS));
+
+ EXPECT_CALL(this->app_mngr_, ManageHMICommand(_))
+ .Times(AtLeast(1))
+ .WillRepeatedly(Return(true));
+
+ command->Run();
+}
+
+} // namespace mobile_commands_test
+} // namespace commands_test
+} // namespace components
+} // namespace test
diff --git a/src/components/application_manager/test/commands/mobile/delete_command_request_test.cc b/src/components/application_manager/test/commands/mobile/delete_command_request_test.cc
new file mode 100644
index 0000000000..1f100ea279
--- /dev/null
+++ b/src/components/application_manager/test/commands/mobile/delete_command_request_test.cc
@@ -0,0 +1,256 @@
+/*
+ * Copyright (c) 2016, 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 "utils/shared_ptr.h"
+#include "smart_objects/smart_object.h"
+#include "application_manager/smart_object_keys.h"
+#include "commands/commands_test.h"
+#include "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/event_engine/event.h"
+#include "mobile/delete_command_request.h"
+#include "interfaces/MOBILE_API.h"
+
+namespace test {
+namespace components {
+namespace commands_test {
+namespace mobile_commands_test {
+
+using ::testing::_;
+using ::testing::Return;
+using ::testing::ReturnRef;
+namespace am = ::application_manager;
+using am::commands::DeleteCommandRequest;
+using am::commands::MessageSharedPtr;
+using am::event_engine::Event;
+
+typedef SharedPtr<DeleteCommandRequest> DeleteCommandPtr;
+
+namespace {
+const uint32_t kConnectionKey = 2u;
+const int32_t kCommandId = 5;
+} // namespace
+
+class DeleteCommandRequestTest
+ : public CommandRequestTest<CommandsTestMocks::kIsNice> {};
+
+TEST_F(DeleteCommandRequestTest, Run_ApplicationIsNotRegistered_UNSUCCESS) {
+ DeleteCommandPtr command(CreateCommand<DeleteCommandRequest>());
+
+ EXPECT_CALL(app_mngr_, application(_))
+ .WillOnce(Return(ApplicationSharedPtr()));
+
+ MessageSharedPtr result_msg(CatchMobileCommandResult(CallRun(*command)));
+
+ ASSERT_TRUE(result_msg);
+
+ const mobile_apis::Result::eType kReceivedResult =
+ static_cast<mobile_apis::Result::eType>(
+ (*result_msg)[am::strings::msg_params][am::strings::result_code]
+ .asInt());
+ EXPECT_EQ(mobile_apis::Result::APPLICATION_NOT_REGISTERED, kReceivedResult);
+}
+
+TEST_F(DeleteCommandRequestTest, Run_InvalidCommandId_UNSUCCESS) {
+ MessageSharedPtr command_msg(CreateMessage(smart_objects::SmartType_Map));
+ (*command_msg)[am::strings::msg_params][am::strings::cmd_id] = kCommandId;
+ (*command_msg)[am::strings::params][am::strings::connection_key] =
+ kConnectionKey;
+
+ DeleteCommandPtr command(CreateCommand<DeleteCommandRequest>(command_msg));
+
+ MockAppPtr app = CreateMockApp();
+ EXPECT_CALL(app_mngr_, application(kConnectionKey)).WillOnce(Return(app));
+ EXPECT_CALL(*app, FindCommand(kCommandId))
+ .WillOnce(Return(static_cast<SmartObject*>(NULL)));
+
+ MessageSharedPtr result_msg(CatchMobileCommandResult(CallRun(*command)));
+
+ ASSERT_TRUE(result_msg);
+
+ const mobile_apis::Result::eType kReceivedResult =
+ static_cast<mobile_apis::Result::eType>(
+ (*result_msg)[am::strings::msg_params][am::strings::result_code]
+ .asInt());
+ EXPECT_EQ(mobile_apis::Result::INVALID_ID, kReceivedResult);
+}
+
+TEST_F(DeleteCommandRequestTest, Run_SUCCESS) {
+ MessageSharedPtr command_msg(CreateMessage(smart_objects::SmartType_Map));
+ (*command_msg)[am::strings::msg_params][am::strings::cmd_id] = kCommandId;
+ (*command_msg)[am::strings::params][am::strings::connection_key] =
+ kConnectionKey;
+
+ DeleteCommandPtr command(CreateCommand<DeleteCommandRequest>(command_msg));
+
+ MockAppPtr app = CreateMockApp();
+ EXPECT_CALL(app_mngr_, application(kConnectionKey)).WillOnce(Return(app));
+
+ MessageSharedPtr test_msg(CreateMessage(smart_objects::SmartType_Map));
+ (*test_msg)[am::strings::menu_params] = 0;
+ (*test_msg)[am::strings::vr_commands] = 0;
+
+ EXPECT_CALL(*app, FindCommand(kCommandId)).WillOnce(Return(test_msg.get()));
+
+ MessageSharedPtr menu_params_result;
+ MessageSharedPtr vr_command_result;
+ {
+ ::testing::InSequence sequence;
+ EXPECT_CALL(app_mngr_, ManageHMICommand(_))
+ .WillOnce(DoAll(SaveArg<0>(&menu_params_result), Return(true)));
+ EXPECT_CALL(app_mngr_, ManageHMICommand(_))
+ .WillOnce(DoAll(SaveArg<0>(&vr_command_result), Return(true)));
+ }
+
+ command->Run();
+
+ ASSERT_TRUE(menu_params_result);
+ ASSERT_TRUE(vr_command_result);
+
+ const hmi_apis::FunctionID::eType kMenuParamsResult =
+ static_cast<hmi_apis::FunctionID::eType>(
+ (*menu_params_result)[am::strings::params][am::strings::function_id]
+ .asInt());
+ const hmi_apis::FunctionID::eType kVrCommandResult =
+ static_cast<hmi_apis::FunctionID::eType>(
+ (*vr_command_result)[am::strings::params][am::strings::function_id]
+ .asInt());
+
+ EXPECT_EQ(hmi_apis::FunctionID::UI_DeleteCommand, kMenuParamsResult);
+ EXPECT_EQ(hmi_apis::FunctionID::VR_DeleteCommand, kVrCommandResult);
+}
+
+TEST_F(DeleteCommandRequestTest, OnEvent_UnknownEvent_UNSUCCESS) {
+ Event event(hmi_apis::FunctionID::INVALID_ENUM);
+
+ DeleteCommandPtr command(CreateCommand<DeleteCommandRequest>());
+
+ EXPECT_CALL(app_mngr_, ManageMobileCommand(_, _)).Times(0);
+
+ command->on_event(event);
+}
+
+TEST_F(DeleteCommandRequestTest, OnEvent_UiDeleteCommand_SUCCESS) {
+ MessageSharedPtr command_msg(CreateMessage(smart_objects::SmartType_Map));
+ (*command_msg)[am::strings::msg_params][am::strings::cmd_id] = kCommandId;
+ (*command_msg)[am::strings::params][am::strings::connection_key] =
+ kConnectionKey;
+
+ DeleteCommandPtr command(CreateCommand<DeleteCommandRequest>(command_msg));
+
+ MockAppPtr app = CreateMockApp();
+ EXPECT_CALL(app_mngr_, application(kConnectionKey))
+ .WillRepeatedly(Return(app));
+
+ MessageSharedPtr test_msg(CreateMessage(smart_objects::SmartType_Map));
+ (*test_msg)[am::strings::menu_params] = 0;
+
+ EXPECT_CALL(*app, FindCommand(kCommandId))
+ .WillRepeatedly(Return(test_msg.get()));
+
+ command->Run();
+
+ MessageSharedPtr event_msg(CreateMessage(smart_objects::SmartType_Map));
+ (*event_msg)[am::strings::params][am::hmi_response::code] =
+ hmi_apis::Common_Result::WARNINGS;
+ Event event(hmi_apis::FunctionID::UI_DeleteCommand);
+ event.set_smart_object(*event_msg);
+
+ EXPECT_CALL(*app, RemoveCommand(kCommandId));
+
+ EXPECT_CALL(*app, UpdateHash());
+
+ MessageSharedPtr result_msg(
+ CatchMobileCommandResult(CallOnEvent(*command, event)));
+
+ ASSERT_TRUE(result_msg);
+
+ const mobile_apis::Result::eType kReceivedResult =
+ static_cast<mobile_apis::Result::eType>(
+ (*result_msg)[am::strings::msg_params][am::strings::result_code]
+ .asInt());
+
+ EXPECT_EQ(mobile_apis::Result::WARNINGS, kReceivedResult);
+}
+
+TEST_F(DeleteCommandRequestTest, OnEvent_VrDeleteCommand_SUCCESS) {
+ MessageSharedPtr command_msg(CreateMessage(smart_objects::SmartType_Map));
+ (*command_msg)[am::strings::msg_params][am::strings::cmd_id] = kCommandId;
+ (*command_msg)[am::strings::params][am::strings::connection_key] =
+ kConnectionKey;
+
+ DeleteCommandPtr command(CreateCommand<DeleteCommandRequest>(command_msg));
+
+ MockAppPtr app = CreateMockApp();
+ EXPECT_CALL(app_mngr_, application(kConnectionKey))
+ .WillRepeatedly(Return(app));
+
+ MessageSharedPtr test_msg(CreateMessage(smart_objects::SmartType_Map));
+ (*test_msg)[am::strings::vr_commands] = 0;
+
+ EXPECT_CALL(*app, FindCommand(kCommandId))
+ .WillRepeatedly(Return(test_msg.get()));
+
+ command->Run();
+
+ MessageSharedPtr event_msg(CreateMessage(smart_objects::SmartType_Map));
+ (*event_msg)[am::strings::params][am::hmi_response::code] =
+ hmi_apis::Common_Result::WARNINGS;
+ Event event(hmi_apis::FunctionID::VR_DeleteCommand);
+ event.set_smart_object(*event_msg);
+
+ EXPECT_CALL(*app, RemoveCommand(kCommandId));
+
+ EXPECT_CALL(*app, UpdateHash());
+
+ MessageSharedPtr result_msg(
+ CatchMobileCommandResult(CallOnEvent(*command, event)));
+
+ ASSERT_TRUE(result_msg);
+
+ const mobile_apis::Result::eType kReceivedResult =
+ static_cast<mobile_apis::Result::eType>(
+ (*result_msg)[am::strings::msg_params][am::strings::result_code]
+ .asInt());
+ EXPECT_EQ(mobile_apis::Result::WARNINGS, kReceivedResult);
+}
+
+} // namespace mobile_commands_test
+} // namespace commands_test
+} // namespace components
+} // namespace test
diff --git a/src/components/application_manager/test/commands/mobile/diagnostic_message_request_test.cc b/src/components/application_manager/test/commands/mobile/diagnostic_message_request_test.cc
new file mode 100644
index 0000000000..a5ef7383f7
--- /dev/null
+++ b/src/components/application_manager/test/commands/mobile/diagnostic_message_request_test.cc
@@ -0,0 +1,182 @@
+/*
+ * Copyright (c) 2016, 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 <vector>
+
+#include "gtest/gtest.h"
+#include "utils/shared_ptr.h"
+#include "smart_objects/smart_object.h"
+#include "application_manager/smart_object_keys.h"
+#include "commands/commands_test.h"
+#include "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/event_engine/event.h"
+#include "mobile/diagnostic_message_request.h"
+#include "interfaces/MOBILE_API.h"
+
+namespace test {
+namespace components {
+namespace commands_test {
+namespace mobile_commands_test {
+
+using ::testing::_;
+using ::testing::Return;
+using ::testing::ReturnRef;
+namespace am = ::application_manager;
+using am::commands::MessageSharedPtr;
+using am::commands::DiagnosticMessageRequest;
+using am::event_engine::Event;
+namespace mobile_result = mobile_apis::Result;
+
+typedef SharedPtr<DiagnosticMessageRequest> DiagnosticMessageRequestPtr;
+
+namespace {
+const uint32_t kConnectionKey = 2u;
+const uint32_t kDiagnosticMode = 5u;
+} // namespace
+
+class DiagnosticMessageRequestTest
+ : public CommandRequestTest<CommandsTestMocks::kIsNice> {};
+
+TEST_F(DiagnosticMessageRequestTest, Run_ApplicationIsNotRegistered_UNSUCCESS) {
+ MessageSharedPtr command_msg(CreateMessage(smart_objects::SmartType_Map));
+ (*command_msg)[am::strings::params][am::strings::connection_key] =
+ kConnectionKey;
+
+ DiagnosticMessageRequestPtr command(
+ CreateCommand<DiagnosticMessageRequest>(command_msg));
+
+ EXPECT_CALL(app_mngr_, application(kConnectionKey))
+ .WillOnce(Return(ApplicationSharedPtr()));
+
+ EXPECT_CALL(
+ app_mngr_,
+ ManageMobileCommand(
+ MobileResultCodeIs(mobile_result::APPLICATION_NOT_REGISTERED), _));
+
+ command->Run();
+}
+
+TEST_F(DiagnosticMessageRequestTest, Run_NotSupportedDiagnosticMode_UNSUCCESS) {
+ MessageSharedPtr command_msg(CreateMessage(smart_objects::SmartType_Map));
+ (*command_msg)[am::strings::msg_params][am::strings::message_data][0] =
+ kDiagnosticMode;
+ (*command_msg)[am::strings::params][am::strings::connection_key] =
+ kConnectionKey;
+
+ DiagnosticMessageRequestPtr command(
+ CreateCommand<DiagnosticMessageRequest>(command_msg));
+
+ MockAppPtr app(CreateMockApp());
+ EXPECT_CALL(app_mngr_, application(kConnectionKey)).WillOnce(Return(app));
+
+ EXPECT_CALL(app_mngr_, get_settings())
+ .WillOnce(ReturnRef(app_mngr_settings_));
+
+ const std::vector<uint32_t> empty_supported_diag_modes;
+ EXPECT_CALL(app_mngr_settings_, supported_diag_modes())
+ .WillOnce(ReturnRef(empty_supported_diag_modes));
+
+ EXPECT_CALL(
+ app_mngr_,
+ ManageMobileCommand(MobileResultCodeIs(mobile_result::REJECTED), _));
+
+ command->Run();
+}
+
+TEST_F(DiagnosticMessageRequestTest, Run_SUCCESS) {
+ MessageSharedPtr command_msg(CreateMessage(smart_objects::SmartType_Map));
+ (*command_msg)[am::strings::msg_params][am::strings::message_data][0] =
+ kDiagnosticMode;
+ (*command_msg)[am::strings::params][am::strings::connection_key] =
+ kConnectionKey;
+
+ DiagnosticMessageRequestPtr command(
+ CreateCommand<DiagnosticMessageRequest>(command_msg));
+
+ MockAppPtr app(CreateMockApp());
+ EXPECT_CALL(app_mngr_, application(kConnectionKey)).WillOnce(Return(app));
+
+ EXPECT_CALL(app_mngr_, get_settings())
+ .WillOnce(ReturnRef(app_mngr_settings_));
+
+ std::vector<uint32_t> supported_diag_modes;
+ supported_diag_modes.push_back(kDiagnosticMode);
+
+ EXPECT_CALL(app_mngr_settings_, supported_diag_modes())
+ .WillOnce(ReturnRef(supported_diag_modes));
+
+ EXPECT_CALL(app_mngr_,
+ ManageHMICommand(HMIResultCodeIs(
+ hmi_apis::FunctionID::VehicleInfo_DiagnosticMessage)));
+
+ command->Run();
+}
+
+TEST_F(DiagnosticMessageRequestTest, OnEvent_UNSUCCESS) {
+ Event event(hmi_apis::FunctionID::INVALID_ENUM);
+
+ DiagnosticMessageRequestPtr command(
+ CreateCommand<DiagnosticMessageRequest>());
+
+ EXPECT_CALL(app_mngr_, ManageMobileCommand(_, _)).Times(0);
+
+ command->on_event(event);
+}
+
+TEST_F(DiagnosticMessageRequestTest, OnEvent_SUCCESS) {
+ Event event(hmi_apis::FunctionID::VehicleInfo_DiagnosticMessage);
+
+ MessageSharedPtr event_message(CreateMessage(smart_objects::SmartType_Map));
+ (*event_message)[am::strings::msg_params] = 0;
+ (*event_message)[am::strings::params][am::hmi_response::code] =
+ mobile_result::SUCCESS;
+ event.set_smart_object(*event_message);
+
+ DiagnosticMessageRequestPtr command(
+ CreateCommand<DiagnosticMessageRequest>());
+
+ EXPECT_CALL(
+ app_mngr_,
+ ManageMobileCommand(MobileResultCodeIs(mobile_result::SUCCESS), _));
+
+ command->on_event(event);
+}
+
+} // namespace mobile_commands_test
+} // namespace commands_test
+} // namespace components
+} // namespace test
diff --git a/src/components/application_manager/test/commands/mobile/dial_number_request_test.cc b/src/components/application_manager/test/commands/mobile/dial_number_request_test.cc
new file mode 100644
index 0000000000..aa9696ab2b
--- /dev/null
+++ b/src/components/application_manager/test/commands/mobile/dial_number_request_test.cc
@@ -0,0 +1,185 @@
+/*
+ * Copyright (c) 2016, 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 <vector>
+
+#include "gtest/gtest.h"
+#include "utils/shared_ptr.h"
+#include "smart_objects/smart_object.h"
+#include "application_manager/smart_object_keys.h"
+#include "commands/commands_test.h"
+#include "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/event_engine/event.h"
+#include "mobile/dial_number_request.h"
+#include "interfaces/MOBILE_API.h"
+
+namespace test {
+namespace components {
+namespace commands_test {
+namespace mobile_commands_test {
+
+using ::testing::_;
+using ::testing::Return;
+namespace am = ::application_manager;
+using am::commands::MessageSharedPtr;
+using am::commands::DialNumberRequest;
+using am::event_engine::Event;
+namespace mobile_result = mobile_apis::Result;
+
+typedef SharedPtr<DialNumberRequest> DialNumberRequestPtr;
+
+namespace {
+const uint32_t kConnectionKey = 2u;
+} // namespace
+
+class DialNumberRequestTest
+ : public CommandRequestTest<CommandsTestMocks::kIsNice> {};
+
+TEST_F(DialNumberRequestTest, Run_ApplicationIsNotRegistered_UNSUCCESS) {
+ DialNumberRequestPtr command(CreateCommand<DialNumberRequest>());
+
+ EXPECT_CALL(app_mngr_, application(_))
+ .WillOnce(Return(ApplicationSharedPtr()));
+
+ EXPECT_CALL(
+ app_mngr_,
+ ManageMobileCommand(
+ MobileResultCodeIs(mobile_result::APPLICATION_NOT_REGISTERED), _));
+
+ command->Run();
+}
+
+TEST_F(DialNumberRequestTest, Run_InvalidNumber_UNSUCCESS) {
+ MessageSharedPtr command_msg(CreateMessage(smart_objects::SmartType_Map));
+ (*command_msg)[am::strings::msg_params][am::strings::number] = "\t\n";
+ (*command_msg)[am::strings::params][am::strings::connection_key] =
+ kConnectionKey;
+
+ DialNumberRequestPtr command(CreateCommand<DialNumberRequest>(command_msg));
+
+ MockAppPtr app(CreateMockApp());
+ EXPECT_CALL(app_mngr_, application(kConnectionKey)).WillOnce(Return(app));
+
+ EXPECT_CALL(
+ app_mngr_,
+ ManageMobileCommand(MobileResultCodeIs(mobile_result::INVALID_DATA), _));
+
+ command->Run();
+}
+
+TEST_F(DialNumberRequestTest, Run_EmptyNumber_UNSUCCESS) {
+ MessageSharedPtr command_msg(CreateMessage(smart_objects::SmartType_Map));
+ (*command_msg)[am::strings::msg_params][am::strings::number] = "NotANumber";
+ (*command_msg)[am::strings::params][am::strings::connection_key] =
+ kConnectionKey;
+
+ DialNumberRequestPtr command(CreateCommand<DialNumberRequest>(command_msg));
+
+ MockAppPtr app(CreateMockApp());
+ EXPECT_CALL(app_mngr_, application(kConnectionKey)).WillOnce(Return(app));
+
+ EXPECT_CALL(
+ app_mngr_,
+ ManageMobileCommand(MobileResultCodeIs(mobile_result::INVALID_DATA), _));
+
+ command->Run();
+}
+
+TEST_F(DialNumberRequestTest, Run_SUCCESS) {
+ MessageSharedPtr command_msg(CreateMessage(smart_objects::SmartType_Map));
+ (*command_msg)[am::strings::msg_params][am::strings::number] = "123";
+ (*command_msg)[am::strings::params][am::strings::connection_key] =
+ kConnectionKey;
+
+ DialNumberRequestPtr command(CreateCommand<DialNumberRequest>(command_msg));
+
+ MockAppPtr app(CreateMockApp());
+ EXPECT_CALL(app_mngr_, application(kConnectionKey)).WillOnce(Return(app));
+
+ EXPECT_CALL(app_mngr_,
+ ManageHMICommand(HMIResultCodeIs(
+ hmi_apis::FunctionID::BasicCommunication_DialNumber)));
+
+ command->Run();
+}
+
+TEST_F(DialNumberRequestTest, OnEvent_UnknownEvent_UNSUCCESS) {
+ MessageSharedPtr command_msg(CreateMessage(smart_objects::SmartType_Map));
+ (*command_msg)[am::strings::params][am::strings::connection_key] =
+ kConnectionKey;
+
+ DialNumberRequestPtr command(CreateCommand<DialNumberRequest>(command_msg));
+
+ MockAppPtr app(CreateMockApp());
+ EXPECT_CALL(app_mngr_, application(kConnectionKey)).WillOnce(Return(app));
+
+ Event event(hmi_apis::FunctionID::INVALID_ENUM);
+
+ EXPECT_CALL(app_mngr_, ManageMobileCommand(_, _)).Times(0);
+
+ command->on_event(event);
+}
+
+TEST_F(DialNumberRequestTest, OnEvent_SUCCESS) {
+ MessageSharedPtr command_msg(CreateMessage(smart_objects::SmartType_Map));
+ (*command_msg)[am::strings::params][am::strings::connection_key] =
+ kConnectionKey;
+
+ DialNumberRequestPtr command(CreateCommand<DialNumberRequest>(command_msg));
+
+ MockAppPtr app(CreateMockApp());
+ EXPECT_CALL(app_mngr_, application(kConnectionKey)).WillOnce(Return(app));
+
+ MessageSharedPtr event_msg(CreateMessage(smart_objects::SmartType_Map));
+ (*event_msg)[am::strings::params][am::hmi_response::code] =
+ mobile_apis::Result::SUCCESS;
+ (*event_msg)[am::strings::params][am::strings::info] = "test_info";
+
+ Event event(hmi_apis::FunctionID::BasicCommunication_DialNumber);
+ event.set_smart_object(*event_msg);
+
+ EXPECT_CALL(
+ app_mngr_,
+ ManageMobileCommand(MobileResultCodeIs(mobile_apis::Result::SUCCESS), _));
+
+ command->on_event(event);
+}
+
+} // namespace mobile_commands_test
+} // namespace commands_test
+} // namespace components
+} // namespace test
diff --git a/src/components/application_manager/test/commands/mobile/end_audio_pass_thru_request_test.cc b/src/components/application_manager/test/commands/mobile/end_audio_pass_thru_request_test.cc
new file mode 100644
index 0000000000..7d602941a0
--- /dev/null
+++ b/src/components/application_manager/test/commands/mobile/end_audio_pass_thru_request_test.cc
@@ -0,0 +1,118 @@
+/*
+ * Copyright (c) 2016, 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 <vector>
+
+#include "gtest/gtest.h"
+#include "utils/shared_ptr.h"
+#include "smart_objects/smart_object.h"
+#include "application_manager/smart_object_keys.h"
+#include "commands/commands_test.h"
+#include "commands/command_request_test.h"
+#include "application_manager/application.h"
+#include "application_manager/mock_application_manager.h"
+#include "application_manager/event_engine/event.h"
+#include "mobile/end_audio_pass_thru_request.h"
+#include "interfaces/MOBILE_API.h"
+
+namespace test {
+namespace components {
+namespace commands_test {
+namespace mobile_commands_test {
+
+using ::testing::_;
+using ::testing::Return;
+namespace am = ::application_manager;
+using am::commands::MessageSharedPtr;
+using am::commands::EndAudioPassThruRequest;
+using am::event_engine::Event;
+namespace mobile_result = mobile_apis::Result;
+
+typedef SharedPtr<EndAudioPassThruRequest> EndAudioPassThruRequestPtr;
+
+class EndAudioPassThruRequestTest
+ : public CommandRequestTest<CommandsTestMocks::kIsNice> {};
+
+TEST_F(EndAudioPassThruRequestTest, Run_SUCCESS) {
+ EndAudioPassThruRequestPtr command(CreateCommand<EndAudioPassThruRequest>());
+
+ EXPECT_CALL(app_mngr_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::UI_EndAudioPassThru)));
+
+ command->Run();
+}
+
+TEST_F(EndAudioPassThruRequestTest, OnEvent_UnknownEvent_UNSUCCESS) {
+ EndAudioPassThruRequestPtr command(CreateCommand<EndAudioPassThruRequest>());
+
+ Event event(hmi_apis::FunctionID::INVALID_ENUM);
+
+ EXPECT_CALL(app_mngr_, ManageMobileCommand(_, _)).Times(0);
+
+ command->on_event(event);
+}
+
+TEST_F(EndAudioPassThruRequestTest, OnEvent_SUCCESS) {
+ const uint32_t kConnectionKey = 2u;
+
+ MessageSharedPtr command_msg(CreateMessage(smart_objects::SmartType_Map));
+ (*command_msg)[am::strings::params][am::strings::connection_key] =
+ kConnectionKey;
+
+ EndAudioPassThruRequestPtr command(
+ CreateCommand<EndAudioPassThruRequest>(command_msg));
+
+ MessageSharedPtr event_msg(CreateMessage(smart_objects::SmartType_Map));
+ (*event_msg)[am::strings::msg_params] = 0;
+ (*event_msg)[am::strings::params][am::hmi_response::code] =
+ mobile_apis::Result::SUCCESS;
+
+ Event event(hmi_apis::FunctionID::UI_EndAudioPassThru);
+ event.set_smart_object(*event_msg);
+
+ EXPECT_CALL(app_mngr_, EndAudioPassThrough()).WillOnce(Return(true));
+ EXPECT_CALL(app_mngr_, StopAudioPassThru(kConnectionKey));
+
+ EXPECT_CALL(
+ app_mngr_,
+ ManageMobileCommand(MobileResultCodeIs(mobile_apis::Result::SUCCESS), _));
+
+ command->on_event(event);
+}
+
+} // namespace mobile_commands_test
+} // namespace commands_test
+} // namespace components
+} // namespace test
diff --git a/src/components/application_manager/test/commands/mobile/get_dtcs_request_test.cc b/src/components/application_manager/test/commands/mobile/get_dtcs_request_test.cc
new file mode 100644
index 0000000000..5fa476b8ec
--- /dev/null
+++ b/src/components/application_manager/test/commands/mobile/get_dtcs_request_test.cc
@@ -0,0 +1,132 @@
+/*
+ * Copyright (c) 2016, 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 <vector>
+
+#include "gtest/gtest.h"
+#include "utils/shared_ptr.h"
+#include "smart_objects/smart_object.h"
+#include "application_manager/smart_object_keys.h"
+#include "commands/commands_test.h"
+#include "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/event_engine/event.h"
+#include "mobile/get_dtcs_request.h"
+#include "interfaces/MOBILE_API.h"
+
+namespace test {
+namespace components {
+namespace commands_test {
+namespace mobile_commands_test {
+
+using ::testing::_;
+using ::testing::Return;
+namespace am = ::application_manager;
+using am::commands::MessageSharedPtr;
+using am::commands::GetDTCsRequest;
+using am::event_engine::Event;
+namespace mobile_result = mobile_apis::Result;
+
+typedef SharedPtr<GetDTCsRequest> GetDTCsRequestPtr;
+
+class GetDTCsRequestTest
+ : public CommandRequestTest<CommandsTestMocks::kIsNice> {};
+
+TEST_F(GetDTCsRequestTest, Run_ApplicationIsNotRegistered_UNSUCCESS) {
+ GetDTCsRequestPtr command(CreateCommand<GetDTCsRequest>());
+
+ EXPECT_CALL(app_mngr_, application(_))
+ .WillOnce(Return(ApplicationSharedPtr()));
+
+ EXPECT_CALL(
+ app_mngr_,
+ ManageMobileCommand(
+ MobileResultCodeIs(mobile_result::APPLICATION_NOT_REGISTERED), _));
+
+ command->Run();
+}
+
+TEST_F(GetDTCsRequestTest, Run_SUCCESS) {
+ const uint32_t kConnectionKey = 2u;
+ MessageSharedPtr command_msg(CreateMessage(smart_objects::SmartType_Map));
+ (*command_msg)[am::strings::msg_params][am::strings::dtc_mask] = 0;
+ (*command_msg)[am::strings::params][am::strings::connection_key] =
+ kConnectionKey;
+
+ GetDTCsRequestPtr command(CreateCommand<GetDTCsRequest>(command_msg));
+
+ MockAppPtr app(CreateMockApp());
+ EXPECT_CALL(app_mngr_, application(kConnectionKey)).WillOnce(Return(app));
+
+ EXPECT_CALL(app_mngr_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::VehicleInfo_GetDTCs)));
+
+ command->Run();
+}
+
+TEST_F(GetDTCsRequestTest, OnEvent_UnknownEvent_UNSUCCESS) {
+ GetDTCsRequestPtr command(CreateCommand<GetDTCsRequest>());
+
+ Event event(hmi_apis::FunctionID::INVALID_ENUM);
+
+ EXPECT_CALL(app_mngr_, ManageMobileCommand(_, _)).Times(0);
+
+ command->on_event(event);
+}
+
+TEST_F(GetDTCsRequestTest, OnEvent_SUCCESS) {
+ GetDTCsRequestPtr command(CreateCommand<GetDTCsRequest>());
+
+ MessageSharedPtr event_msg(CreateMessage(smart_objects::SmartType_Map));
+ (*event_msg)[am::strings::msg_params] = 0;
+ (*event_msg)[am::strings::params][am::hmi_response::code] =
+ mobile_apis::Result::SUCCESS;
+
+ Event event(hmi_apis::FunctionID::VehicleInfo_GetDTCs);
+ event.set_smart_object(*event_msg);
+
+ EXPECT_CALL(
+ app_mngr_,
+ ManageMobileCommand(MobileResultCodeIs(mobile_apis::Result::SUCCESS), _));
+
+ command->on_event(event);
+}
+
+} // namespace mobile_commands_test
+} // namespace commands_test
+} // namespace components
+} // namespace test
diff --git a/src/components/application_manager/test/commands/mobile/get_vehicle_data_request_test.cc b/src/components/application_manager/test/commands/mobile/get_vehicle_data_request_test.cc
new file mode 100644
index 0000000000..8f99751196
--- /dev/null
+++ b/src/components/application_manager/test/commands/mobile/get_vehicle_data_request_test.cc
@@ -0,0 +1,252 @@
+/*
+ * Copyright (c) 2016, 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 <vector>
+
+#include "gtest/gtest.h"
+#include "utils/shared_ptr.h"
+#include "smart_objects/smart_object.h"
+#include "application_manager/smart_object_keys.h"
+#include "commands/commands_test.h"
+#include "commands/command_request_test.h"
+#include "application_manager/application.h"
+#include "application_manager/message_helper.h"
+#include "application_manager/mock_message_helper.h"
+#include "application_manager/mock_application_manager.h"
+#include "application_manager/event_engine/event.h"
+#include "mobile/get_vehicle_data_request.h"
+#include "interfaces/MOBILE_API.h"
+
+namespace test {
+namespace components {
+namespace commands_test {
+namespace mobile_commands_test {
+
+using ::testing::_;
+using ::testing::Return;
+using ::testing::ReturnRef;
+namespace am = ::application_manager;
+using am::commands::MessageSharedPtr;
+using am::commands::GetVehicleDataRequest;
+using am::event_engine::Event;
+namespace mobile_result = mobile_apis::Result;
+
+typedef SharedPtr<GetVehicleDataRequest> GetVehicleDataRequestPtr;
+
+namespace {
+const uint32_t kConnectionKey = 2u;
+} // namespace
+
+class GetVehicleDataRequestTest
+ : public CommandRequestTest<CommandsTestMocks::kIsNice> {};
+
+class UnwrappedGetVehicleDataRequest : public GetVehicleDataRequest {
+ public:
+ UnwrappedGetVehicleDataRequest(const MessageSharedPtr& message,
+ am::ApplicationManager& application_manager)
+ : GetVehicleDataRequest(message, application_manager) {}
+
+ std::vector<std::string>& get_disallowed_params() {
+ return removed_parameters_permissions_.disallowed_params;
+ }
+
+ using GetVehicleDataRequest::on_event;
+};
+
+#ifdef HMI_DBUS_API
+// HMI_DBUS_API currently not supported
+#else
+
+TEST_F(GetVehicleDataRequestTest, Run_ApplicationIsNotRegistered_UNSUCCESS) {
+ GetVehicleDataRequestPtr command(CreateCommand<GetVehicleDataRequest>());
+
+ EXPECT_CALL(app_mngr_, application(_))
+ .WillOnce(Return(ApplicationSharedPtr()));
+
+ EXPECT_CALL(
+ app_mngr_,
+ ManageMobileCommand(
+ MobileResultCodeIs(mobile_result::APPLICATION_NOT_REGISTERED), _));
+
+ command->Run();
+}
+
+TEST_F(GetVehicleDataRequestTest, Run_TooHighFrequency_UNSUCCESS) {
+ const mobile_apis::FunctionID::eType kFunctionId =
+ mobile_apis::FunctionID::GetVehicleDataID;
+ MessageSharedPtr command_msg(CreateMessage(smart_objects::SmartType_Map));
+ (*command_msg)[am::strings::params][am::strings::function_id] = kFunctionId;
+ (*command_msg)[am::strings::params][am::strings::connection_key] =
+ kConnectionKey;
+
+ GetVehicleDataRequestPtr command(
+ CreateCommand<GetVehicleDataRequest>(command_msg));
+
+ MockAppPtr app(CreateMockApp());
+ EXPECT_CALL(app_mngr_, application(kConnectionKey)).WillOnce(Return(app));
+
+ EXPECT_CALL(
+ *app,
+ AreCommandLimitsExceeded(kFunctionId, am::TLimitSource::CONFIG_FILE))
+ .WillOnce(Return(true));
+
+ EXPECT_CALL(
+ app_mngr_,
+ ManageMobileCommand(MobileResultCodeIs(mobile_result::REJECTED), _));
+
+ command->Run();
+}
+
+TEST_F(GetVehicleDataRequestTest, Run_EmptyMsgParams_UNSUCCESS) {
+ MessageSharedPtr command_msg(CreateMessage(smart_objects::SmartType_Map));
+ (*command_msg)[am::strings::params][am::strings::connection_key] =
+ kConnectionKey;
+
+ GetVehicleDataRequestPtr command(
+ CreateCommand<GetVehicleDataRequest>(command_msg));
+
+ const am::VehicleData kEmptyVehicleData;
+ EXPECT_CALL(*am::MockMessageHelper::message_helper_mock(), vehicle_data())
+ .WillOnce(ReturnRef(kEmptyVehicleData));
+
+ MockAppPtr app(CreateMockApp());
+ EXPECT_CALL(app_mngr_, application(kConnectionKey)).WillOnce(Return(app));
+
+ EXPECT_CALL(
+ app_mngr_,
+ ManageMobileCommand(MobileResultCodeIs(mobile_result::INVALID_DATA), _));
+
+ command->Run();
+}
+
+TEST_F(GetVehicleDataRequestTest,
+ Run_EmptyMsgParamsAndHasDisallowedParams_UNSUCCESS) {
+ MessageSharedPtr command_msg(CreateMessage(smart_objects::SmartType_Map));
+ (*command_msg)[am::strings::params][am::strings::connection_key] =
+ kConnectionKey;
+
+ SharedPtr<UnwrappedGetVehicleDataRequest> command(
+ CreateCommand<UnwrappedGetVehicleDataRequest>(command_msg));
+
+ const am::VehicleData kEmptyVehicleData;
+ EXPECT_CALL(*am::MockMessageHelper::message_helper_mock(), vehicle_data())
+ .WillRepeatedly(ReturnRef(kEmptyVehicleData));
+
+ std::vector<std::string>& disallowed_params =
+ command->get_disallowed_params();
+ disallowed_params.push_back("test_param");
+
+ MockAppPtr app(CreateMockApp());
+ EXPECT_CALL(app_mngr_, application(kConnectionKey)).WillOnce(Return(app));
+
+ EXPECT_CALL(
+ app_mngr_,
+ ManageMobileCommand(MobileResultCodeIs(mobile_result::DISALLOWED), _));
+
+ command->Run();
+}
+
+TEST_F(GetVehicleDataRequestTest, Run_SUCCESS) {
+ const std::string kMsgParamKey("test_key");
+
+ MessageSharedPtr command_msg(CreateMessage(smart_objects::SmartType_Map));
+ (*command_msg)[am::strings::params][am::strings::connection_key] =
+ kConnectionKey;
+ (*command_msg)[am::strings::msg_params][kMsgParamKey] = true;
+
+ GetVehicleDataRequestPtr command(
+ CreateCommand<GetVehicleDataRequest>(command_msg));
+
+ am::VehicleData vehicle_data;
+ vehicle_data.insert(
+ am::VehicleData::value_type(kMsgParamKey, am::VehicleDataType::SPEED));
+ EXPECT_CALL(*am::MockMessageHelper::message_helper_mock(), vehicle_data())
+ .WillOnce(ReturnRef(vehicle_data));
+
+ MockAppPtr app(CreateMockApp());
+ EXPECT_CALL(app_mngr_, application(kConnectionKey)).WillOnce(Return(app));
+
+ EXPECT_CALL(app_mngr_,
+ ManageHMICommand(HMIResultCodeIs(
+ hmi_apis::FunctionID::VehicleInfo_GetVehicleData)));
+
+ command->Run();
+}
+
+TEST_F(GetVehicleDataRequestTest, OnEvent_UnknownEvent_UNSUCCESS) {
+ MessageSharedPtr command_msg(CreateMessage(smart_objects::SmartType_Map));
+ (*command_msg)[am::strings::params][am::strings::connection_key] =
+ kConnectionKey;
+
+ SharedPtr<UnwrappedGetVehicleDataRequest> command(
+ CreateCommand<UnwrappedGetVehicleDataRequest>(command_msg));
+
+ Event event(hmi_apis::FunctionID::INVALID_ENUM);
+
+ EXPECT_CALL(app_mngr_, ManageMobileCommand(_, _)).Times(0);
+
+ command->on_event(event);
+}
+
+TEST_F(GetVehicleDataRequestTest, OnEvent_DataNotAvailable_SUCCESS) {
+ MessageSharedPtr command_msg(CreateMessage(smart_objects::SmartType_Map));
+ (*command_msg)[am::strings::params][am::strings::connection_key] =
+ kConnectionKey;
+
+ SharedPtr<UnwrappedGetVehicleDataRequest> command(
+ CreateCommand<UnwrappedGetVehicleDataRequest>(command_msg));
+
+ MessageSharedPtr event_msg(CreateMessage(smart_objects::SmartType_Map));
+ (*event_msg)[am::strings::params][am::hmi_response::code] =
+ mobile_result::VEHICLE_DATA_NOT_AVAILABLE;
+ (*event_msg)[am::strings::params][am::strings::error_msg] = "test_error";
+ (*event_msg)[am::strings::msg_params][am::hmi_response::method] = 0;
+
+ Event event(hmi_apis::FunctionID::VehicleInfo_GetVehicleData);
+ event.set_smart_object(*event_msg);
+
+ EXPECT_CALL(
+ app_mngr_,
+ ManageMobileCommand(
+ MobileResultCodeIs(mobile_result::VEHICLE_DATA_NOT_AVAILABLE), _));
+
+ command->on_event(event);
+}
+
+#endif // HMI_DBUS_API
+
+} // namespace mobile_commands_test
+} // namespace commands_test
+} // namespace components
+} // namespace test
diff --git a/src/components/application_manager/test/commands/mobile/list_files_request_test.cc b/src/components/application_manager/test/commands/mobile/list_files_request_test.cc
new file mode 100644
index 0000000000..f137921597
--- /dev/null
+++ b/src/components/application_manager/test/commands/mobile/list_files_request_test.cc
@@ -0,0 +1,128 @@
+/*
+ * Copyright (c) 2016, 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 "utils/shared_ptr.h"
+#include "smart_objects/smart_object.h"
+#include "commands/commands_test.h"
+#include "commands/command_request_test.h"
+#include "application_manager/application.h"
+#include "application_manager/mock_application_manager.h"
+#include "application_manager/mock_application.h"
+#include "mobile/list_files_request.h"
+#include "interfaces/MOBILE_API.h"
+#include "application_manager/smart_object_keys.h"
+
+namespace test {
+namespace components {
+namespace commands_test {
+namespace mobile_commands_test {
+
+using ::testing::_;
+using ::testing::Return;
+using ::testing::ReturnRef;
+using ::testing::DoAll;
+using ::testing::SaveArg;
+namespace am = ::application_manager;
+using am::commands::ListFilesRequest;
+using am::commands::MessageSharedPtr;
+
+class ListFilesRequestTest
+ : public CommandRequestTest<CommandsTestMocks::kIsNice> {};
+
+TEST_F(ListFilesRequestTest, Run_AppNotRegistered_UNSUCCESS) {
+ SharedPtr<ListFilesRequest> command(CreateCommand<ListFilesRequest>());
+
+ ON_CALL(app_mngr_, application(_))
+ .WillByDefault(Return(SharedPtr<am::Application>()));
+
+ MessageSharedPtr result_msg(CatchMobileCommandResult(CallRun(*command)));
+ EXPECT_EQ(mobile_apis::Result::APPLICATION_NOT_REGISTERED,
+ static_cast<mobile_apis::Result::eType>(
+ (*result_msg)[am::strings::msg_params][am::strings::result_code]
+ .asInt()));
+}
+
+TEST_F(ListFilesRequestTest, Run_TooManyHmiNone_UNSUCCESS) {
+ MockAppPtr app(CreateMockApp());
+ SharedPtr<ListFilesRequest> command(CreateCommand<ListFilesRequest>());
+
+ ON_CALL(app_mngr_, application(_)).WillByDefault(Return(app));
+ ON_CALL(*app, hmi_level())
+ .WillByDefault(Return(mobile_apis::HMILevel::HMI_NONE));
+
+ const uint32_t kListFilesInNoneAllowed = 1u;
+ const uint32_t kListFilesInNoneCount = 2u;
+
+ EXPECT_CALL(app_mngr_, get_settings())
+ .WillOnce(ReturnRef(app_mngr_settings_));
+ ON_CALL(app_mngr_settings_, list_files_in_none())
+ .WillByDefault(ReturnRef(kListFilesInNoneAllowed));
+ ON_CALL(*app, list_files_in_none_count())
+ .WillByDefault(Return(kListFilesInNoneCount));
+
+ 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(ListFilesRequestTest, Run_SUCCESS) {
+ MockAppPtr app(CreateMockApp());
+ SharedPtr<ListFilesRequest> command(CreateCommand<ListFilesRequest>());
+
+ ON_CALL(app_mngr_, application(_)).WillByDefault(Return(app));
+ ON_CALL(*app, hmi_level())
+ .WillByDefault(Return(mobile_apis::HMILevel::HMI_FULL));
+
+ ON_CALL(*app, increment_list_files_in_none_count()).WillByDefault(Return());
+
+ ON_CALL(*app, GetAvailableDiskSpace()).WillByDefault(Return(0));
+
+ am::AppFilesMap files_map;
+ ON_CALL(*app, getAppFiles()).WillByDefault(ReturnRef(files_map));
+
+ MessageSharedPtr result_msg(CatchMobileCommandResult(CallRun(*command)));
+ EXPECT_EQ(mobile_apis::Result::SUCCESS,
+ static_cast<mobile_apis::Result::eType>(
+ (*result_msg)[am::strings::msg_params][am::strings::result_code]
+ .asInt()));
+}
+
+} // namespace mobile_commands_test
+} // namespace commands_test
+} // namespace components
+} // namespace test
diff --git a/src/components/application_manager/test/commands/mobile/on_button_notification_commands_test.cc b/src/components/application_manager/test/commands/mobile/on_button_notification_commands_test.cc
new file mode 100644
index 0000000000..18e7a6545c
--- /dev/null
+++ b/src/components/application_manager/test/commands/mobile/on_button_notification_commands_test.cc
@@ -0,0 +1,345 @@
+/*
+ * Copyright (c) 2016, 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 "utils/shared_ptr.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 "command_impl.h"
+#include "commands/commands_test.h"
+#include "mobile/on_button_event_notification.h"
+#include "mobile/on_button_press_notification.h"
+
+namespace test {
+namespace components {
+namespace commands_test {
+namespace mobile_commands_test {
+
+namespace am = ::application_manager;
+namespace commands = am::commands;
+
+using ::testing::_;
+using ::testing::Types;
+using ::testing::Return;
+
+using ::utils::SharedPtr;
+using am::commands::MessageSharedPtr;
+
+namespace {
+const uint32_t kAppId = 5u;
+const uint32_t kCustomButtonId = 3u;
+const mobile_apis::ButtonName::eType kButtonName = mobile_apis::ButtonName::OK;
+} // namespace
+
+template <class NotificationT,
+ mobile_apis::FunctionID::eType kExpectedFunctionId>
+struct NotificationData {
+ typedef NotificationT Notification;
+ enum { kFunctionId = kExpectedFunctionId };
+};
+
+template <class NotificationDataT>
+class OnButtonNotificationCommandsTest
+ : public CommandsTest<CommandsTestMocks::kIsNice>,
+ public NotificationDataT {};
+
+typedef Types<NotificationData<commands::mobile::OnButtonEventNotification,
+ mobile_apis::FunctionID::OnButtonEventID>,
+ NotificationData<commands::mobile::OnButtonPressNotification,
+ mobile_apis::FunctionID::OnButtonPressID>>
+ OnButtonNotificationCommandsList;
+
+MATCHER_P(CheckNotificationMessage, function_id, "") {
+ const bool kIsMobileProtocolTypeCorrect =
+ (*arg)[am::strings::params][am::strings::protocol_type].asInt() ==
+ commands::CommandImpl::mobile_protocol_type_;
+
+ const bool kIsProtocolVersionCorrect =
+ (*arg)[am::strings::params][am::strings::protocol_version].asInt() ==
+ commands::CommandImpl::protocol_version_;
+
+ const bool kIsNotificationCorrect =
+ (*arg)[am::strings::params][am::strings::message_type].asInt() ==
+ am::MessageType::kNotification;
+
+ const bool kIsFunctionIdCorrect =
+ (*arg)[am::strings::params][am::strings::function_id].asInt() ==
+ function_id;
+
+ bool is_custom_button_id_correct = true;
+ if ((*arg)[am::strings::msg_params].keyExists(
+ am::hmi_response::custom_button_id)) {
+ is_custom_button_id_correct =
+ (*arg)[am::strings::msg_params][am::strings::custom_button_id] ==
+ kCustomButtonId;
+ }
+
+ return kIsMobileProtocolTypeCorrect && kIsProtocolVersionCorrect &&
+ kIsNotificationCorrect && kIsFunctionIdCorrect &&
+ is_custom_button_id_correct;
+}
+
+TYPED_TEST_CASE(OnButtonNotificationCommandsTest,
+ OnButtonNotificationCommandsList);
+
+TYPED_TEST(OnButtonNotificationCommandsTest,
+ Run_CustomButton_NoAppId_UNSUCCESS) {
+ typedef typename TestFixture::Notification Notification;
+
+ MessageSharedPtr notification_msg(
+ this->CreateMessage(smart_objects::SmartType_Map));
+
+ (*notification_msg)[am::strings::msg_params][am::hmi_response::button_name] =
+ mobile_apis::ButtonName::CUSTOM_BUTTON;
+
+ SharedPtr<Notification> command(
+ this->template CreateCommand<Notification>(notification_msg));
+
+ EXPECT_CALL(this->app_mngr_, SendMessageToMobile(_, _)).Times(0);
+
+ command->Run();
+}
+
+TYPED_TEST(OnButtonNotificationCommandsTest,
+ Run_CustomButton_NoCustomButtonId_UNSUCCESS) {
+ typedef typename TestFixture::Notification Notification;
+
+ MessageSharedPtr notification_msg(
+ this->CreateMessage(smart_objects::SmartType_Map));
+
+ (*notification_msg)[am::strings::msg_params][am::hmi_response::button_name] =
+ mobile_apis::ButtonName::CUSTOM_BUTTON;
+ (*notification_msg)[am::strings::msg_params][am::strings::app_id] = kAppId;
+
+ SharedPtr<Notification> command(
+ this->template CreateCommand<Notification>(notification_msg));
+
+ EXPECT_CALL(this->app_mngr_, SendMessageToMobile(_, _)).Times(0);
+
+ command->Run();
+}
+
+TYPED_TEST(OnButtonNotificationCommandsTest,
+ Run_CustomButton_AppNotRegistered_UNSUCCESS) {
+ typedef typename TestFixture::Notification Notification;
+
+ MessageSharedPtr notification_msg(
+ this->CreateMessage(smart_objects::SmartType_Map));
+
+ (*notification_msg)[am::strings::msg_params][am::hmi_response::button_name] =
+ mobile_apis::ButtonName::CUSTOM_BUTTON;
+ (*notification_msg)[am::strings::msg_params][am::strings::app_id] = kAppId;
+ (*notification_msg)[am::strings::msg_params]
+ [am::hmi_response::custom_button_id] = kCustomButtonId;
+
+ SharedPtr<Notification> command(
+ this->template CreateCommand<Notification>(notification_msg));
+
+ EXPECT_CALL(this->app_mngr_, application(kAppId))
+ .WillOnce(Return(ApplicationSharedPtr()));
+
+ EXPECT_CALL(this->app_mngr_, SendMessageToMobile(_, _)).Times(0);
+
+ command->Run();
+}
+
+TYPED_TEST(OnButtonNotificationCommandsTest,
+ Run_CustomButton_AppNotSubscribedToCustomButtonId_UNSUCCESS) {
+ typedef typename TestFixture::Notification Notification;
+
+ MessageSharedPtr notification_msg(
+ this->CreateMessage(smart_objects::SmartType_Map));
+
+ (*notification_msg)[am::strings::msg_params][am::hmi_response::button_name] =
+ mobile_apis::ButtonName::CUSTOM_BUTTON;
+ (*notification_msg)[am::strings::msg_params][am::strings::app_id] = kAppId;
+ (*notification_msg)[am::strings::msg_params]
+ [am::hmi_response::custom_button_id] = kCustomButtonId;
+
+ SharedPtr<Notification> command(
+ this->template CreateCommand<Notification>(notification_msg));
+
+ typename TestFixture::MockAppPtr mock_app = this->CreateMockApp();
+ EXPECT_CALL(this->app_mngr_, application(kAppId)).WillOnce(Return(mock_app));
+
+ EXPECT_CALL(*mock_app, IsSubscribedToSoftButton(kCustomButtonId))
+ .WillOnce(Return(false));
+
+ EXPECT_CALL(this->app_mngr_, SendMessageToMobile(_, _)).Times(0);
+
+ command->Run();
+}
+
+TYPED_TEST(OnButtonNotificationCommandsTest, Run_CustomButton_SUCCESS) {
+ typedef typename TestFixture::Notification Notification;
+
+ MessageSharedPtr notification_msg(
+ this->CreateMessage(smart_objects::SmartType_Map));
+
+ (*notification_msg)[am::strings::msg_params][am::hmi_response::button_name] =
+ mobile_apis::ButtonName::CUSTOM_BUTTON;
+ (*notification_msg)[am::strings::msg_params][am::strings::app_id] = kAppId;
+ (*notification_msg)[am::strings::msg_params]
+ [am::hmi_response::custom_button_id] = kCustomButtonId;
+
+ SharedPtr<Notification> command(
+ this->template CreateCommand<Notification>(notification_msg));
+
+ typename TestFixture::MockAppPtr mock_app = this->CreateMockApp();
+ EXPECT_CALL(this->app_mngr_, application(kAppId)).WillOnce(Return(mock_app));
+
+ EXPECT_CALL(*mock_app, IsSubscribedToSoftButton(kCustomButtonId))
+ .WillOnce(Return(true));
+
+ EXPECT_CALL(this->app_mngr_,
+ SendMessageToMobile(
+ CheckNotificationMessage(TestFixture::kFunctionId), _));
+
+ command->Run();
+}
+
+TYPED_TEST(OnButtonNotificationCommandsTest, Run_NoSubscribedApps_UNSUCCESS) {
+ typedef typename TestFixture::Notification Notification;
+
+ MessageSharedPtr notification_msg(
+ this->CreateMessage(smart_objects::SmartType_Map));
+
+ (*notification_msg)[am::strings::msg_params][am::hmi_response::button_name] =
+ kButtonName;
+
+ SharedPtr<Notification> command(
+ this->template CreateCommand<Notification>(notification_msg));
+
+ const std::vector<ApplicationSharedPtr> empty_subscribed_apps_list;
+ EXPECT_CALL(this->app_mngr_, applications_by_button(kButtonName))
+ .WillOnce(Return(empty_subscribed_apps_list));
+
+ EXPECT_CALL(this->app_mngr_, SendMessageToMobile(_, _)).Times(0);
+
+ command->Run();
+}
+
+TYPED_TEST(OnButtonNotificationCommandsTest, Run_InvalidHmiLevel_UNSUCCESS) {
+ typedef typename TestFixture::Notification Notification;
+
+ MessageSharedPtr notification_msg(
+ this->CreateMessage(smart_objects::SmartType_Map));
+
+ (*notification_msg)[am::strings::msg_params][am::hmi_response::button_name] =
+ kButtonName;
+
+ SharedPtr<Notification> command(
+ this->template CreateCommand<Notification>(notification_msg));
+
+ typename TestFixture::MockAppPtr mock_app = this->CreateMockApp();
+ std::vector<ApplicationSharedPtr> subscribed_apps_list;
+ subscribed_apps_list.push_back(mock_app);
+
+ EXPECT_CALL(*mock_app, hmi_level())
+ .WillRepeatedly(Return(mobile_apis::HMILevel::HMI_NONE));
+
+ EXPECT_CALL(this->app_mngr_, applications_by_button(kButtonName))
+ .WillOnce(Return(subscribed_apps_list));
+
+ EXPECT_CALL(this->app_mngr_, SendMessageToMobile(_, _)).Times(0);
+
+ command->Run();
+}
+
+TYPED_TEST(OnButtonNotificationCommandsTest,
+ Run_ButtonOkOnlyForHmiLevelFull_UNSUCCESS) {
+ typedef typename TestFixture::Notification Notification;
+
+ MessageSharedPtr notification_msg(
+ this->CreateMessage(smart_objects::SmartType_Map));
+
+ (*notification_msg)[am::strings::msg_params][am::hmi_response::button_name] =
+ kButtonName;
+
+ SharedPtr<Notification> command(
+ this->template CreateCommand<Notification>(notification_msg));
+
+ typename TestFixture::MockAppPtr mock_app = this->CreateMockApp();
+ std::vector<ApplicationSharedPtr> subscribed_apps_list;
+ subscribed_apps_list.push_back(mock_app);
+
+ EXPECT_CALL(*mock_app, hmi_level())
+ .WillRepeatedly(Return(mobile_apis::HMILevel::HMI_LIMITED));
+
+ EXPECT_CALL(this->app_mngr_, applications_by_button(kButtonName))
+ .WillOnce(Return(subscribed_apps_list));
+
+ EXPECT_CALL(this->app_mngr_, SendMessageToMobile(_, _)).Times(0);
+
+ command->Run();
+}
+
+TYPED_TEST(OnButtonNotificationCommandsTest, Run_SUCCESS) {
+ typedef typename TestFixture::Notification Notification;
+
+ MessageSharedPtr notification_msg(
+ this->CreateMessage(smart_objects::SmartType_Map));
+
+ (*notification_msg)[am::strings::msg_params][am::hmi_response::button_name] =
+ kButtonName;
+
+ SharedPtr<Notification> command(
+ this->template CreateCommand<Notification>(notification_msg));
+
+ typename TestFixture::MockAppPtr mock_app = this->CreateMockApp();
+ std::vector<ApplicationSharedPtr> subscribed_apps_list;
+ subscribed_apps_list.push_back(mock_app);
+
+ EXPECT_CALL(*mock_app, hmi_level())
+ .WillRepeatedly(Return(mobile_apis::HMILevel::HMI_FULL));
+
+ EXPECT_CALL(this->app_mngr_, applications_by_button(kButtonName))
+ .WillOnce(Return(subscribed_apps_list));
+
+ EXPECT_CALL(this->app_mngr_,
+ SendMessageToMobile(
+ CheckNotificationMessage(TestFixture::kFunctionId), _));
+
+ command->Run();
+}
+
+} // namespace mobile_commands_test
+} // namespace commands_test
+} // namespace components
+} // namespace test
diff --git a/src/components/application_manager/test/commands/mobile/on_command_notification_test.cc b/src/components/application_manager/test/commands/mobile/on_command_notification_test.cc
new file mode 100644
index 0000000000..9506ce84ae
--- /dev/null
+++ b/src/components/application_manager/test/commands/mobile/on_command_notification_test.cc
@@ -0,0 +1,135 @@
+/*
+ * Copyright (c) 2016, 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 "utils/shared_ptr.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 "mobile/on_command_notification.h"
+
+namespace test {
+namespace components {
+namespace commands_test {
+namespace mobile_commands_test {
+
+namespace am = ::application_manager;
+
+using ::testing::_;
+using ::testing::Return;
+
+using am::commands::MessageSharedPtr;
+using am::commands::OnCommandNotification;
+
+typedef ::utils::SharedPtr<OnCommandNotification> CommandPtr;
+
+namespace {
+const uint32_t kAppId = 1u;
+const uint32_t kCommandId = 5u;
+} // namespace
+
+class OnCommandNotificationTest
+ : public CommandsTest<CommandsTestMocks::kNotNice> {};
+
+TEST_F(OnCommandNotificationTest, Run_AppNotRegistered_UNSUCCESS) {
+ CommandPtr command(CreateCommand<OnCommandNotification>());
+
+ EXPECT_CALL(app_mngr_, application(_))
+ .WillOnce(Return(ApplicationSharedPtr()));
+
+ EXPECT_CALL(app_mngr_, ManageMobileCommand(_, _)).Times(0);
+
+ command->Run();
+}
+
+TEST_F(OnCommandNotificationTest, Run_NoAppsForTheCommand_UNSUCCESS) {
+ MessageSharedPtr command_msg(CreateMessage(smart_objects::SmartType_Map));
+ (*command_msg)[am::strings::msg_params][am::strings::app_id] = kAppId;
+ (*command_msg)[am::strings::msg_params][am::strings::cmd_id] = kCommandId;
+
+ CommandPtr command(CreateCommand<OnCommandNotification>(command_msg));
+
+ MockAppPtr mock_app(CreateMockApp());
+ EXPECT_CALL(app_mngr_, application(kAppId)).WillOnce(Return(mock_app));
+
+ EXPECT_CALL(*mock_app, FindCommand(kCommandId))
+ .WillOnce(Return(static_cast<SmartObject*>(NULL)));
+
+ EXPECT_CALL(app_mngr_, ManageMobileCommand(_, _)).Times(0);
+
+ command->Run();
+}
+
+MATCHER(CheckNotificationMessage, "") {
+ const bool kIsMobileProtocolTypeCorrect =
+ (*arg)[am::strings::params][am::strings::protocol_type].asInt() ==
+ am::commands::CommandImpl::mobile_protocol_type_;
+
+ const bool kIsProtocolVersionCorrect =
+ (*arg)[am::strings::params][am::strings::protocol_version].asInt() ==
+ am::commands::CommandImpl::protocol_version_;
+
+ const bool kIsNotificationCorrect =
+ (*arg)[am::strings::params][am::strings::message_type].asInt() ==
+ am::MessageType::kNotification;
+
+ return kIsMobileProtocolTypeCorrect && kIsProtocolVersionCorrect &&
+ kIsNotificationCorrect;
+}
+
+TEST_F(OnCommandNotificationTest, Run_SUCCESS) {
+ MessageSharedPtr command_msg(CreateMessage(smart_objects::SmartType_Map));
+ (*command_msg)[am::strings::msg_params][am::strings::app_id] = kAppId;
+ (*command_msg)[am::strings::msg_params][am::strings::cmd_id] = kCommandId;
+
+ CommandPtr command(CreateCommand<OnCommandNotification>(command_msg));
+
+ MockAppPtr mock_app(CreateMockApp());
+ EXPECT_CALL(app_mngr_, application(kAppId)).WillOnce(Return(mock_app));
+
+ MessageSharedPtr dummy_msg(CreateMessage());
+ EXPECT_CALL(*mock_app, FindCommand(kCommandId))
+ .WillOnce(Return(dummy_msg.get()));
+
+ EXPECT_CALL(app_mngr_, SendMessageToMobile(CheckNotificationMessage(), _));
+
+ command->Run();
+}
+
+} // namespace mobile_commands_test
+} // namespace commands_test
+} // namespace components
+} // namespace test
diff --git a/src/components/application_manager/test/commands/mobile/on_hash_change_notification_test.cc b/src/components/application_manager/test/commands/mobile/on_hash_change_notification_test.cc
new file mode 100644
index 0000000000..e5297b0cd7
--- /dev/null
+++ b/src/components/application_manager/test/commands/mobile/on_hash_change_notification_test.cc
@@ -0,0 +1,126 @@
+/*
+ * Copyright (c) 2016, 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 <string>
+
+#include "gtest/gtest.h"
+#include "application_manager/commands/mobile/on_hash_change_notification.h"
+#include "application_manager/mock_message_helper.h"
+#include "application_manager/smart_object_keys.h"
+#include "command_impl.h"
+#include "commands/commands_test.h"
+
+namespace test {
+namespace components {
+namespace commands_test {
+namespace mobile_commands_test {
+
+namespace strings = application_manager::strings;
+
+using application_manager::commands::mobile::OnHashChangeNotification;
+using application_manager::MockMessageHelper;
+using application_manager::commands::CommandImpl;
+using testing::Mock;
+using testing::Return;
+using testing::ReturnRef;
+using testing::_;
+
+class OnHashChangeNotificationTest
+ : public CommandsTest<CommandsTestMocks::kIsNice> {
+ public:
+ OnHashChangeNotificationTest()
+ : message_helper_(*MockMessageHelper::message_helper_mock()) {}
+ void SetUp() OVERRIDE {
+ Mock::VerifyAndClearExpectations(&message_helper_);
+ }
+
+ void TearDown() OVERRIDE {
+ Mock::VerifyAndClearExpectations(&message_helper_);
+ }
+ MockMessageHelper& message_helper_;
+};
+
+TEST_F(OnHashChangeNotificationTest, Run_ValidApp_SUCCESS) {
+ const uint32_t kConnectionKey = 1u;
+ MessageSharedPtr msg = CreateMessage();
+ (*msg)[strings::params][strings::connection_key] = kConnectionKey;
+
+ SharedPtr<OnHashChangeNotification> command =
+ CreateCommand<OnHashChangeNotification>(msg);
+
+ std::string return_string = "1234";
+ MockAppPtr mock_app = CreateMockApp();
+ EXPECT_CALL(app_mngr_, application(kConnectionKey))
+ .WillOnce(Return(mock_app));
+ EXPECT_CALL(*mock_app, curHash()).WillOnce(ReturnRef(return_string));
+ EXPECT_CALL(message_helper_, PrintSmartObject(_)).WillOnce(Return(false));
+ EXPECT_CALL(app_mngr_, SendMessageToMobile(msg, _));
+
+ command->Run();
+
+ ASSERT_EQ(application_manager::MessageType::kNotification,
+ (*msg)[strings::params][strings::message_type].asInt());
+ ASSERT_EQ(CommandImpl::mobile_protocol_type_,
+ (*msg)[strings::params][strings::protocol_type].asInt());
+ ASSERT_EQ(CommandImpl::protocol_version_,
+ (*msg)[strings::params][strings::protocol_version].asInt());
+ ASSERT_EQ(return_string,
+ (*msg)[strings::msg_params][strings::hash_id].asString());
+}
+
+TEST_F(OnHashChangeNotificationTest, Run_InvalidApp_NoNotification) {
+ const uint32_t kConnectionKey = 1u;
+ MessageSharedPtr msg = CreateMessage();
+ (*msg)[strings::params][strings::connection_key] = kConnectionKey;
+
+ SharedPtr<OnHashChangeNotification> command =
+ CreateCommand<OnHashChangeNotification>(msg);
+
+ std::string return_string;
+ MockAppPtr mock_app = CreateMockApp();
+
+ EXPECT_CALL(app_mngr_, application(kConnectionKey))
+ .WillOnce(Return(MockAppPtr()));
+ EXPECT_CALL(*mock_app, curHash()).Times(0);
+ EXPECT_CALL(message_helper_, PrintSmartObject(_)).Times(0);
+ EXPECT_CALL(app_mngr_, SendMessageToMobile(msg, _)).Times(0);
+
+ command->Run();
+
+ ASSERT_EQ(application_manager::MessageType::kNotification,
+ (*msg)[strings::params][strings::message_type].asInt());
+}
+
+} // namespace mobile_commands_test
+} // namespace commands_test
+} // namespace components
+} // namespace test
diff --git a/src/components/application_manager/test/commands/mobile/on_hmi_status_notification_from_mobile_test.cc b/src/components/application_manager/test/commands/mobile/on_hmi_status_notification_from_mobile_test.cc
new file mode 100644
index 0000000000..c7871812e3
--- /dev/null
+++ b/src/components/application_manager/test/commands/mobile/on_hmi_status_notification_from_mobile_test.cc
@@ -0,0 +1,278 @@
+/*
+ * Copyright (c) 2016, 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 "gtest/gtest.h"
+#include "application_manager/commands/mobile/on_hmi_status_notification_from_mobile.h"
+#include "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/mock_message_helper.h"
+
+namespace test {
+namespace components {
+namespace commands_test {
+namespace mobile_commands_test {
+
+namespace {
+const uint32_t kConnectionKey = 1u;
+const connection_handler::DeviceHandle kHandle = 2u;
+} // namespace
+
+namespace strings = application_manager::strings;
+
+using application_manager::commands::OnHMIStatusNotificationFromMobile;
+using application_manager::ProtocolVersion;
+using application_manager::ApplicationSet;
+using testing::Mock;
+using testing::Return;
+using testing::_;
+
+class OnHMIStatusNotificationFromMobileTest
+ : public CommandsTest<CommandsTestMocks::kIsNice> {
+ public:
+ MessageSharedPtr CreateMsgParams(
+ const mobile_apis::HMILevel::eType kHMIState) {
+ MessageSharedPtr msg = CreateMessage();
+ (*msg)[strings::params][strings::connection_key] = kConnectionKey;
+ (*msg)[strings::msg_params][strings::hmi_level] = kHMIState;
+ return msg;
+ }
+ ApplicationSet app_set_;
+ sync_primitives::Lock lock_;
+};
+
+TEST_F(OnHMIStatusNotificationFromMobileTest,
+ Run_CurrentStateForeground_SUCCESS) {
+ MessageSharedPtr msg = CreateMsgParams(mobile_apis::HMILevel::HMI_FULL);
+
+ SharedPtr<OnHMIStatusNotificationFromMobile> command =
+ CreateCommand<OnHMIStatusNotificationFromMobile>(msg);
+
+ MockAppPtr mock_app = CreateMockApp();
+ EXPECT_CALL(app_mngr_, application(kConnectionKey))
+ .WillOnce(Return(mock_app));
+ EXPECT_CALL(*mock_app, set_foreground(true));
+
+ EXPECT_CALL(*mock_app, device()).WillOnce(Return(kHandle));
+ EXPECT_CALL(app_mngr_, IsAppsQueriedFrom(kHandle)).WillOnce(Return(true));
+
+ DataAccessor<ApplicationSet> accessor(app_set_, lock_);
+ EXPECT_CALL(app_mngr_, applications()).WillOnce(Return(accessor));
+
+ EXPECT_CALL(*mock_app, protocol_version())
+ .WillRepeatedly(Return(ProtocolVersion::kV4));
+ EXPECT_CALL(*mock_app, is_foreground()).WillRepeatedly(Return(true));
+
+ command->Run();
+
+ ASSERT_EQ(application_manager::MessageType::kNotification,
+ (*msg)[strings::params][strings::message_type].asInt());
+}
+
+TEST_F(OnHMIStatusNotificationFromMobileTest, Run_InvalidApp_NoNotification) {
+ MessageSharedPtr msg = CreateMsgParams(mobile_apis::HMILevel::HMI_FULL);
+
+ SharedPtr<OnHMIStatusNotificationFromMobile> command =
+ CreateCommand<OnHMIStatusNotificationFromMobile>(msg);
+
+ MockAppPtr mock_app = CreateMockApp();
+ EXPECT_CALL(app_mngr_, application(kConnectionKey))
+ .WillOnce(Return(MockAppPtr()));
+ EXPECT_CALL(*mock_app, set_foreground(true)).Times(0);
+
+ EXPECT_CALL(*mock_app, device()).Times(0);
+ EXPECT_CALL(app_mngr_, IsAppsQueriedFrom(kHandle)).Times(0);
+
+ EXPECT_CALL(app_mngr_, applications()).Times(0);
+
+ EXPECT_CALL(*mock_app, protocol_version()).Times(0);
+ EXPECT_CALL(*mock_app, is_foreground()).Times(0);
+
+ command->Run();
+
+ ASSERT_EQ(application_manager::MessageType::kNotification,
+ (*msg)[strings::params][strings::message_type].asInt());
+}
+
+TEST_F(OnHMIStatusNotificationFromMobileTest,
+ Run_CurrentStateNotForeground_SUCCESS) {
+ MessageSharedPtr msg = CreateMsgParams(mobile_apis::HMILevel::HMI_BACKGROUND);
+
+ SharedPtr<OnHMIStatusNotificationFromMobile> command =
+ CreateCommand<OnHMIStatusNotificationFromMobile>(msg);
+
+ MockAppPtr mock_app = CreateMockApp();
+ EXPECT_CALL(app_mngr_, application(kConnectionKey))
+ .WillOnce(Return(mock_app));
+ EXPECT_CALL(*mock_app, set_foreground(false));
+
+ EXPECT_CALL(*mock_app, device()).WillOnce(Return(kHandle));
+ EXPECT_CALL(app_mngr_, IsAppsQueriedFrom(kHandle)).WillOnce(Return(true));
+
+ DataAccessor<ApplicationSet> accessor(app_set_, lock_);
+ EXPECT_CALL(app_mngr_, applications()).WillOnce(Return(accessor));
+
+ EXPECT_CALL(*mock_app, protocol_version())
+ .WillRepeatedly(Return(ProtocolVersion::kV4));
+ EXPECT_CALL(*mock_app, is_foreground()).WillRepeatedly(Return(true));
+
+ command->Run();
+
+ ASSERT_EQ(application_manager::MessageType::kNotification,
+ (*msg)[strings::params][strings::message_type].asInt());
+}
+
+TEST_F(OnHMIStatusNotificationFromMobileTest,
+ Run_ProtocolVersionKV3_NoNotification) {
+ MessageSharedPtr msg = CreateMsgParams(mobile_apis::HMILevel::HMI_BACKGROUND);
+
+ SharedPtr<OnHMIStatusNotificationFromMobile> command =
+ CreateCommand<OnHMIStatusNotificationFromMobile>(msg);
+
+ MockAppPtr mock_app = CreateMockApp();
+ EXPECT_CALL(app_mngr_, application(kConnectionKey))
+ .WillOnce(Return(mock_app));
+ EXPECT_CALL(*mock_app, set_foreground(false));
+
+ EXPECT_CALL(*mock_app, device()).WillOnce(Return(kHandle));
+ EXPECT_CALL(app_mngr_, IsAppsQueriedFrom(kHandle)).WillOnce(Return(true));
+
+ DataAccessor<ApplicationSet> accessor(app_set_, lock_);
+ EXPECT_CALL(app_mngr_, applications()).Times(0);
+
+ EXPECT_CALL(*mock_app, protocol_version())
+ .WillOnce(Return(ProtocolVersion::kV3));
+ EXPECT_CALL(*mock_app, is_foreground()).Times(0);
+
+ command->Run();
+
+ ASSERT_EQ(application_manager::MessageType::kNotification,
+ (*msg)[strings::params][strings::message_type].asInt());
+}
+
+TEST_F(OnHMIStatusNotificationFromMobileTest,
+ Run_AppNotRequestedBeforeAndKV3_NoNotification) {
+ MessageSharedPtr msg = CreateMsgParams(mobile_apis::HMILevel::HMI_FULL);
+
+ SharedPtr<OnHMIStatusNotificationFromMobile> command =
+ CreateCommand<OnHMIStatusNotificationFromMobile>(msg);
+
+ MockAppPtr mock_app = CreateMockApp();
+ EXPECT_CALL(app_mngr_, application(kConnectionKey))
+ .WillOnce(Return(mock_app));
+ EXPECT_CALL(*mock_app, set_foreground(true));
+
+ EXPECT_CALL(*mock_app, device()).WillOnce(Return(kHandle));
+ EXPECT_CALL(app_mngr_, IsAppsQueriedFrom(kHandle)).WillOnce(Return(false));
+
+ EXPECT_CALL(app_mngr_, applications()).Times(0);
+
+ EXPECT_CALL(*mock_app, protocol_version())
+ .WillOnce(Return(ProtocolVersion::kV3));
+ EXPECT_CALL(*mock_app, is_foreground()).Times(0);
+
+ command->Run();
+
+ ASSERT_EQ(application_manager::MessageType::kNotification,
+ (*msg)[strings::params][strings::message_type].asInt());
+}
+
+TEST_F(OnHMIStatusNotificationFromMobileTest,
+ Run_AppNotRequestedBefore_SUCCESS) {
+ MessageSharedPtr msg = CreateMsgParams(mobile_apis::HMILevel::HMI_FULL);
+
+ SharedPtr<OnHMIStatusNotificationFromMobile> command =
+ CreateCommand<OnHMIStatusNotificationFromMobile>(msg);
+
+ MockAppPtr mock_app = CreateMockApp();
+ EXPECT_CALL(app_mngr_, application(kConnectionKey))
+ .WillOnce(Return(mock_app));
+ EXPECT_CALL(*mock_app, set_foreground(true));
+
+ EXPECT_CALL(*mock_app, device()).WillOnce(Return(kHandle));
+ EXPECT_CALL(app_mngr_, IsAppsQueriedFrom(kHandle)).WillOnce(Return(false));
+
+ EXPECT_CALL(*mock_app, protocol_version())
+ .WillOnce(Return(ProtocolVersion::kV4));
+
+ EXPECT_CALL(app_mngr_, applications()).Times(0);
+
+ EXPECT_CALL(*mock_app, is_foreground()).WillOnce(Return(true));
+
+ application_manager::MockMessageHelper& mock_message_helper =
+ *application_manager::MockMessageHelper::message_helper_mock();
+ Mock::VerifyAndClearExpectations(&mock_message_helper);
+ EXPECT_CALL(mock_message_helper, SendQueryApps(kConnectionKey, _));
+
+ command->Run();
+
+ ASSERT_EQ(application_manager::MessageType::kNotification,
+ (*msg)[strings::params][strings::message_type].asInt());
+ Mock::VerifyAndClearExpectations(&mock_message_helper);
+}
+
+TEST_F(OnHMIStatusNotificationFromMobileTest,
+ Run_AnotherForegroundSDLApp_SUCCESS) {
+ MessageSharedPtr msg = CreateMsgParams(mobile_apis::HMILevel::HMI_FULL);
+
+ SharedPtr<OnHMIStatusNotificationFromMobile> command =
+ CreateCommand<OnHMIStatusNotificationFromMobile>(msg);
+
+ MockAppPtr mock_app = CreateMockApp();
+ EXPECT_CALL(app_mngr_, application(kConnectionKey))
+ .WillOnce(Return(mock_app));
+ EXPECT_CALL(*mock_app, set_foreground(true));
+
+ EXPECT_CALL(*mock_app, device()).WillOnce(Return(kHandle));
+ EXPECT_CALL(app_mngr_, IsAppsQueriedFrom(kHandle)).WillOnce(Return(true));
+
+ DataAccessor<ApplicationSet> accessor(app_set_, lock_);
+ EXPECT_CALL(app_mngr_, applications()).WillOnce(Return(accessor));
+
+ EXPECT_CALL(*mock_app, protocol_version())
+ .WillRepeatedly(Return(ProtocolVersion::kV4));
+ EXPECT_CALL(*mock_app, is_foreground()).WillRepeatedly(Return(false));
+
+ EXPECT_CALL(app_mngr_, MarkAppsGreyOut(kHandle, false));
+ EXPECT_CALL(app_mngr_, SendUpdateAppList());
+
+ command->Run();
+
+ ASSERT_EQ(application_manager::MessageType::kNotification,
+ (*msg)[strings::params][strings::message_type].asInt());
+}
+
+} // namespace mobile_commands_test
+} // namespace commands_test
+} // namespace components
+} // namespace test
diff --git a/src/components/application_manager/test/commands/mobile/on_hmi_status_notification_test.cc b/src/components/application_manager/test/commands/mobile/on_hmi_status_notification_test.cc
new file mode 100644
index 0000000000..da23d565a8
--- /dev/null
+++ b/src/components/application_manager/test/commands/mobile/on_hmi_status_notification_test.cc
@@ -0,0 +1,213 @@
+/*
+ * Copyright (c) 2016, 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 "gtest/gtest.h"
+#include "application_manager/commands/mobile/on_hmi_status_notification.h"
+#include "commands/commands_test.h"
+#include "application_manager/mock_message_helper.h"
+#include "command_impl.h"
+
+namespace test {
+namespace components {
+namespace commands_test {
+namespace mobile_commands_test {
+
+namespace {
+const uint32_t kConnectionKey = 1u;
+} // namespace
+
+namespace strings = application_manager::strings;
+
+using application_manager::commands::OnHMIStatusNotification;
+using application_manager::ProtocolVersion;
+using application_manager::MockMessageHelper;
+using application_manager::commands::CommandImpl;
+using testing::Mock;
+using testing::Return;
+using testing::_;
+
+class OnHMIStatusNotificationTest
+ : public CommandsTest<CommandsTestMocks::kIsNice> {
+ public:
+ OnHMIStatusNotificationTest()
+ : message_helper_(*MockMessageHelper::message_helper_mock()) {}
+
+ MessageSharedPtr CreateMsgParams(
+ const mobile_apis::HMILevel::eType kHMIState) {
+ MessageSharedPtr msg = CreateMessage();
+ (*msg)[strings::params][strings::connection_key] = kConnectionKey;
+ (*msg)[strings::msg_params][strings::hmi_level] = kHMIState;
+ return msg;
+ }
+
+ void TearDown() OVERRIDE {
+ Mock::VerifyAndClearExpectations(&message_helper_);
+ }
+
+ void SetSendNotificationExpectations(MessageSharedPtr& msg) {
+ Mock::VerifyAndClearExpectations(&message_helper_);
+ EXPECT_CALL(message_helper_, PrintSmartObject(_)).WillOnce(Return(false));
+ EXPECT_CALL(app_mngr_, SendMessageToMobile(msg, _));
+ }
+
+ void VerifySendNotificationData(MessageSharedPtr& msg) {
+ ASSERT_EQ(application_manager::MessageType::kNotification,
+ (*msg)[strings::params][strings::message_type].asInt());
+ ASSERT_EQ(CommandImpl::mobile_protocol_type_,
+ (*msg)[strings::params][strings::protocol_type].asInt());
+ ASSERT_EQ(CommandImpl::protocol_version_,
+ (*msg)[strings::params][strings::protocol_version].asInt());
+ }
+
+ MockMessageHelper& message_helper_;
+};
+
+TEST_F(OnHMIStatusNotificationTest, Run_InvalidApp_NoNotification) {
+ MessageSharedPtr msg = CreateMsgParams(mobile_apis::HMILevel::HMI_FULL);
+
+ SharedPtr<OnHMIStatusNotification> command =
+ CreateCommand<OnHMIStatusNotification>(msg);
+
+ MockAppPtr mock_app = CreateMockApp();
+ EXPECT_CALL(app_mngr_, application(kConnectionKey))
+ .WillOnce(Return(MockAppPtr()));
+
+ EXPECT_CALL(*mock_app, tts_properties_in_full()).Times(0);
+ EXPECT_CALL(*mock_app, set_tts_properties_in_full(_)).Times(0);
+ EXPECT_CALL(*mock_app, app_id()).Times(0);
+ EXPECT_CALL(app_mngr_, AddAppToTTSGlobalPropertiesList(kConnectionKey))
+ .Times(0);
+
+ command->Run();
+}
+
+TEST_F(OnHMIStatusNotificationTest, Run_InvalidEnum_SUCCESS) {
+ MessageSharedPtr msg = CreateMsgParams(mobile_apis::HMILevel::INVALID_ENUM);
+
+ SharedPtr<OnHMIStatusNotification> command =
+ CreateCommand<OnHMIStatusNotification>(msg);
+
+ MockAppPtr mock_app = CreateMockApp();
+ EXPECT_CALL(app_mngr_, application(kConnectionKey))
+ .WillOnce(Return(mock_app));
+
+ SetSendNotificationExpectations(msg);
+
+ command->Run();
+
+ VerifySendNotificationData(msg);
+}
+
+TEST_F(OnHMIStatusNotificationTest, Run_BackgroundAndFalseProperties_SUCCESS) {
+ MessageSharedPtr msg = CreateMsgParams(mobile_apis::HMILevel::HMI_BACKGROUND);
+ SetSendNotificationExpectations(msg);
+
+ SharedPtr<OnHMIStatusNotification> command =
+ CreateCommand<OnHMIStatusNotification>(msg);
+
+ MockAppPtr mock_app = CreateMockApp();
+ EXPECT_CALL(app_mngr_, application(kConnectionKey))
+ .WillOnce(Return(mock_app));
+
+ EXPECT_CALL(*mock_app, tts_properties_in_none()).WillOnce(Return(false));
+ EXPECT_CALL(*mock_app, set_tts_properties_in_none(true));
+ EXPECT_CALL(message_helper_, SendTTSGlobalProperties(_, false, _));
+
+ command->Run();
+
+ VerifySendNotificationData(msg);
+}
+
+TEST_F(OnHMIStatusNotificationTest, Run_BackgroundAndTrueProperties_SUCCESS) {
+ MessageSharedPtr msg = CreateMsgParams(mobile_apis::HMILevel::HMI_BACKGROUND);
+
+ SharedPtr<OnHMIStatusNotification> command =
+ CreateCommand<OnHMIStatusNotification>(msg);
+
+ MockAppPtr mock_app = CreateMockApp();
+ EXPECT_CALL(app_mngr_, application(kConnectionKey))
+ .WillOnce(Return(mock_app));
+
+ EXPECT_CALL(*mock_app, tts_properties_in_none()).WillOnce(Return(true));
+
+ SetSendNotificationExpectations(msg);
+
+ command->Run();
+
+ VerifySendNotificationData(msg);
+}
+
+TEST_F(OnHMIStatusNotificationTest, Run_FullAndFalseProperties_SUCCESS) {
+ MessageSharedPtr msg = CreateMsgParams(mobile_apis::HMILevel::HMI_FULL);
+
+ SharedPtr<OnHMIStatusNotification> command =
+ CreateCommand<OnHMIStatusNotification>(msg);
+
+ MockAppPtr mock_app = CreateMockApp();
+ EXPECT_CALL(app_mngr_, application(kConnectionKey))
+ .WillOnce(Return(mock_app));
+
+ EXPECT_CALL(*mock_app, tts_properties_in_full()).WillOnce(Return(false));
+ EXPECT_CALL(*mock_app, set_tts_properties_in_full(true));
+ EXPECT_CALL(*mock_app, app_id()).WillOnce(Return(kConnectionKey));
+ EXPECT_CALL(app_mngr_, AddAppToTTSGlobalPropertiesList(kConnectionKey));
+
+ SetSendNotificationExpectations(msg);
+
+ command->Run();
+
+ VerifySendNotificationData(msg);
+}
+
+TEST_F(OnHMIStatusNotificationTest, Run_FullAndTrueProperties_SUCCESS) {
+ MessageSharedPtr msg = CreateMsgParams(mobile_apis::HMILevel::HMI_FULL);
+
+ SharedPtr<OnHMIStatusNotification> command =
+ CreateCommand<OnHMIStatusNotification>(msg);
+
+ MockAppPtr mock_app = CreateMockApp();
+ EXPECT_CALL(app_mngr_, application(kConnectionKey))
+ .WillOnce(Return(mock_app));
+
+ EXPECT_CALL(*mock_app, tts_properties_in_full()).WillOnce(Return(true));
+
+ SetSendNotificationExpectations(msg);
+
+ command->Run();
+
+ VerifySendNotificationData(msg);
+}
+
+} // namespace mobile_commands_test
+} // namespace commands_test
+} // namespace components
+} // namespace test
diff --git a/src/components/application_manager/test/commands/mobile/on_keyboard_input_notification_test.cc b/src/components/application_manager/test/commands/mobile/on_keyboard_input_notification_test.cc
new file mode 100644
index 0000000000..9a700c119a
--- /dev/null
+++ b/src/components/application_manager/test/commands/mobile/on_keyboard_input_notification_test.cc
@@ -0,0 +1,171 @@
+/*
+ * Copyright (c) 2016, 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 "gtest/gtest.h"
+#include "application_manager/commands/mobile/on_keyboard_input_notification.h"
+#include "commands/commands_test.h"
+#include <application_manager/smart_object_keys.h>
+#include "application_manager/message.h"
+#include "application_manager/mock_message_helper.h"
+#include "command_impl.h"
+
+namespace test {
+namespace components {
+namespace commands_test {
+namespace mobile_commands_test {
+
+namespace strings = application_manager::strings;
+
+namespace {
+const uint32_t kConnectionKey = 1u;
+} // namespace
+
+using application_manager::commands::mobile::OnKeyBoardInputNotification;
+using application_manager::MockMessageHelper;
+using application_manager::commands::CommandImpl;
+using application_manager::ApplicationSet;
+using testing::Mock;
+using testing::Return;
+using testing::_;
+
+class OnKeyBoardInputNotificationTest
+ : public CommandsTest<CommandsTestMocks::kIsNice> {
+ public:
+ OnKeyBoardInputNotificationTest()
+ : message_helper_(*MockMessageHelper::message_helper_mock()) {}
+
+ void SetSendNotificationExpectations(MessageSharedPtr msg) {
+ EXPECT_CALL(message_helper_, PrintSmartObject(_)).WillOnce(Return(false));
+ EXPECT_CALL(app_mngr_, SendMessageToMobile(msg, _));
+ }
+
+ void SetSendNotificationVariables(MessageSharedPtr msg) {
+ ASSERT_EQ(application_manager::MessageType::kNotification,
+ (*msg)[strings::params][strings::message_type].asInt());
+ ASSERT_EQ(CommandImpl::mobile_protocol_type_,
+ (*msg)[strings::params][strings::protocol_type].asInt());
+ ASSERT_EQ(CommandImpl::protocol_version_,
+ (*msg)[strings::params][strings::protocol_version].asInt());
+ }
+
+ void SetUp() OVERRIDE {
+ Mock::VerifyAndClearExpectations(&message_helper_);
+ }
+
+ void TearDown() OVERRIDE {
+ Mock::VerifyAndClearExpectations(&message_helper_);
+ }
+
+ MockAppPtr InitAppSetDataAccessor(SharedPtr<ApplicationSet>& app_set) {
+ app_set = (!app_set ? ::utils::MakeShared<ApplicationSet>() : app_set);
+ MockAppPtr app(CreateMockApp());
+ app_set->insert(app);
+ EXPECT_CALL(app_mngr_, applications())
+ .WillOnce(Return(DataAccessor<ApplicationSet>(*app_set, lock_)));
+ return app;
+ }
+
+ MockMessageHelper& message_helper_;
+ SharedPtr<ApplicationSet> app_set_;
+ sync_primitives::Lock lock_;
+};
+
+TEST_F(OnKeyBoardInputNotificationTest, Run_ActionActive_SUCCESS) {
+ MessageSharedPtr msg = CreateMessage();
+
+ SharedPtr<OnKeyBoardInputNotification> command =
+ CreateCommand<OnKeyBoardInputNotification>(msg);
+
+ MockAppPtr mock_app(InitAppSetDataAccessor(app_set_));
+ EXPECT_CALL(*mock_app, is_perform_interaction_active()).WillOnce(Return(1));
+ EXPECT_CALL(*mock_app, hmi_level()).Times(0);
+
+ EXPECT_CALL(*mock_app, app_id()).WillOnce(Return(kConnectionKey));
+
+ SetSendNotificationExpectations(msg);
+
+ command->Run();
+
+ SetSendNotificationVariables(msg);
+
+ ASSERT_EQ(kConnectionKey,
+ (*msg)[strings::params][strings::connection_key].asInt());
+}
+
+TEST_F(OnKeyBoardInputNotificationTest, Run_ActionNotActive_SUCCESS) {
+ MessageSharedPtr msg = CreateMessage();
+
+ SharedPtr<OnKeyBoardInputNotification> command =
+ CreateCommand<OnKeyBoardInputNotification>(msg);
+
+ MockAppPtr mock_app(InitAppSetDataAccessor(app_set_));
+ EXPECT_CALL(*mock_app, is_perform_interaction_active())
+ .WillRepeatedly(Return(0));
+
+ EXPECT_CALL(*mock_app, hmi_level())
+ .WillOnce(Return(mobile_apis::HMILevel::eType::HMI_FULL));
+
+ EXPECT_CALL(*mock_app, app_id()).WillOnce(Return(kConnectionKey));
+
+ SetSendNotificationExpectations(msg);
+
+ command->Run();
+
+ SetSendNotificationVariables(msg);
+
+ ASSERT_EQ(kConnectionKey,
+ (*msg)[strings::params][strings::connection_key].asInt());
+}
+
+TEST_F(OnKeyBoardInputNotificationTest, Run_InvalidApp_NoNotification) {
+ MessageSharedPtr msg = CreateMessage();
+
+ SharedPtr<OnKeyBoardInputNotification> command =
+ CreateCommand<OnKeyBoardInputNotification>(msg);
+
+ MockAppPtr mock_app(InitAppSetDataAccessor(app_set_));
+ EXPECT_CALL(*mock_app, is_perform_interaction_active())
+ .WillRepeatedly(Return(0));
+
+ EXPECT_CALL(*mock_app, hmi_level())
+ .WillOnce(Return(mobile_apis::HMILevel::eType::HMI_BACKGROUND));
+
+ EXPECT_CALL(message_helper_, PrintSmartObject(_)).Times(0);
+ EXPECT_CALL(app_mngr_, SendMessageToMobile(msg, _)).Times(0);
+
+ command->Run();
+}
+
+} // namespace mobile_commands_test
+} // namespace commands_test
+} // namespace components
+} // namespace test
diff --git a/src/components/application_manager/test/commands/mobile/on_system_request_notification_test.cc b/src/components/application_manager/test/commands/mobile/on_system_request_notification_test.cc
new file mode 100644
index 0000000000..42b87c6032
--- /dev/null
+++ b/src/components/application_manager/test/commands/mobile/on_system_request_notification_test.cc
@@ -0,0 +1,215 @@
+/*
+ * Copyright (c) 2016, 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 <string>
+
+#include "gtest/gtest.h"
+#include "application_manager/commands/mobile/on_system_request_notification.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 "commands/commands_test.h"
+#include "command_impl.h"
+#include "interfaces/MOBILE_API.h"
+
+namespace test {
+namespace components {
+namespace commands_test {
+namespace mobile_commands_test {
+
+namespace strings = application_manager::strings;
+
+using application_manager::commands::mobile::OnSystemRequestNotification;
+using application_manager::commands::CommandImpl;
+using application_manager::MockMessageHelper;
+using test::components::policy_test::MockPolicyHandlerInterface;
+using namespace mobile_apis;
+using testing::Mock;
+using testing::Return;
+using testing::ReturnRef;
+using testing::_;
+
+namespace {
+const uint32_t kConnectionKey = 1u;
+} // namespace
+
+class OnSystemRequestNotificationTest
+ : public CommandsTest<CommandsTestMocks::kIsNice> {
+ public:
+ OnSystemRequestNotificationTest()
+ : message_helper_(*MockMessageHelper::message_helper_mock()) {}
+
+ void SetUp() OVERRIDE {
+ Mock::VerifyAndClearExpectations(&message_helper_);
+ }
+
+ void TearDown() OVERRIDE {
+ Mock::VerifyAndClearExpectations(&message_helper_);
+ }
+ MockMessageHelper& message_helper_;
+};
+
+TEST_F(OnSystemRequestNotificationTest, Run_ProprietaryType_SUCCESS) {
+ const RequestType::eType kRequestType = RequestType::PROPRIETARY;
+
+ MessageSharedPtr msg = CreateMessage();
+ (*msg)[strings::params][strings::connection_key] = kConnectionKey;
+ (*msg)[strings::msg_params][strings::request_type] = kRequestType;
+
+ SharedPtr<OnSystemRequestNotification> command =
+ CreateCommand<OnSystemRequestNotification>(msg);
+
+ MockAppPtr mock_app = CreateMockApp();
+ EXPECT_CALL(app_mngr_, application(kConnectionKey))
+ .WillOnce(Return(mock_app));
+ MockPolicyHandlerInterface mock_policy_handler;
+ EXPECT_CALL(app_mngr_, GetPolicyHandler())
+ .WillRepeatedly(ReturnRef(mock_policy_handler));
+ std::string policy_app_id;
+ EXPECT_CALL(*mock_app, policy_app_id()).WillOnce(Return(policy_app_id));
+ EXPECT_CALL(mock_policy_handler, IsRequestTypeAllowed(_, _))
+ .WillOnce(Return(true));
+
+#ifdef EXTENDED_POLICY
+ EXPECT_CALL(app_mngr_, GetPolicyHandler())
+ .Times(2)
+ .WillRepeatedly(ReturnRef(mock_policy_handler));
+ EXPECT_CALL(mock_policy_handler, TimeoutExchange()).WillOnce(Return(5u));
+#endif
+
+ EXPECT_CALL(message_helper_, PrintSmartObject(_)).WillOnce(Return(false));
+ EXPECT_CALL(app_mngr_, SendMessageToMobile(msg, _));
+
+ command->Run();
+
+ ASSERT_EQ(FileType::JSON,
+ (*msg)[strings::msg_params][strings::file_type].asInt());
+ ASSERT_EQ(application_manager::MessageType::kNotification,
+ (*msg)[strings::params][strings::message_type].asInt());
+ ASSERT_EQ(CommandImpl::mobile_protocol_type_,
+ (*msg)[strings::params][strings::protocol_type].asInt());
+ ASSERT_EQ(CommandImpl::protocol_version_,
+ (*msg)[strings::params][strings::protocol_version].asInt());
+}
+
+TEST_F(OnSystemRequestNotificationTest, Run_HTTPType_SUCCESS) {
+ const RequestType::eType kRequestType = RequestType::HTTP;
+
+ MessageSharedPtr msg = CreateMessage();
+ (*msg)[strings::params][strings::connection_key] = kConnectionKey;
+ (*msg)[strings::msg_params][strings::request_type] = kRequestType;
+
+ SharedPtr<OnSystemRequestNotification> command =
+ CreateCommand<OnSystemRequestNotification>(msg);
+
+ MockAppPtr mock_app = CreateMockApp();
+ EXPECT_CALL(app_mngr_, application(kConnectionKey))
+ .WillOnce(Return(mock_app));
+ MockPolicyHandlerInterface mock_policy_handler;
+ EXPECT_CALL(app_mngr_, GetPolicyHandler())
+ .WillOnce(ReturnRef(mock_policy_handler));
+ std::string policy_app_id;
+ EXPECT_CALL(*mock_app, policy_app_id()).WillOnce(Return(policy_app_id));
+ EXPECT_CALL(mock_policy_handler, IsRequestTypeAllowed(_, _))
+ .WillOnce(Return(true));
+
+ EXPECT_CALL(message_helper_, PrintSmartObject(_)).WillOnce(Return(false));
+ EXPECT_CALL(app_mngr_, SendMessageToMobile(msg, _));
+
+ command->Run();
+
+ ASSERT_EQ(FileType::BINARY,
+ (*msg)[strings::msg_params][strings::file_type].asInt());
+ ASSERT_EQ(application_manager::MessageType::kNotification,
+ (*msg)[strings::params][strings::message_type].asInt());
+ ASSERT_EQ(CommandImpl::mobile_protocol_type_,
+ (*msg)[strings::params][strings::protocol_type].asInt());
+ ASSERT_EQ(CommandImpl::protocol_version_,
+ (*msg)[strings::params][strings::protocol_version].asInt());
+}
+
+TEST_F(OnSystemRequestNotificationTest, Run_InvalidApp_NoNotification) {
+ const RequestType::eType kRequestType = RequestType::HTTP;
+
+ MessageSharedPtr msg = CreateMessage();
+ (*msg)[strings::params][strings::connection_key] = kConnectionKey;
+ (*msg)[strings::msg_params][strings::request_type] = kRequestType;
+
+ SharedPtr<OnSystemRequestNotification> command =
+ CreateCommand<OnSystemRequestNotification>(msg);
+
+ MockAppPtr mock_app = CreateMockApp();
+ EXPECT_CALL(app_mngr_, application(kConnectionKey))
+ .WillOnce(Return(MockAppPtr()));
+ EXPECT_CALL(app_mngr_, GetPolicyHandler()).Times(0);
+ EXPECT_CALL(*mock_app, policy_app_id()).Times(0);
+ MockPolicyHandlerInterface mock_policy_handler;
+ EXPECT_CALL(mock_policy_handler, IsRequestTypeAllowed(_, _)).Times(0);
+
+ EXPECT_CALL(message_helper_, PrintSmartObject(_)).Times(0);
+ EXPECT_CALL(app_mngr_, SendMessageToMobile(msg, _)).Times(0);
+
+ command->Run();
+}
+
+TEST_F(OnSystemRequestNotificationTest, Run_RequestNotAllowed_NoNotification) {
+ const RequestType::eType kRequestType = RequestType::HTTP;
+
+ MessageSharedPtr msg = CreateMessage();
+ (*msg)[strings::params][strings::connection_key] = kConnectionKey;
+ (*msg)[strings::msg_params][strings::request_type] = kRequestType;
+
+ SharedPtr<OnSystemRequestNotification> command =
+ CreateCommand<OnSystemRequestNotification>(msg);
+
+ MockAppPtr mock_app = CreateMockApp();
+ EXPECT_CALL(app_mngr_, application(kConnectionKey))
+ .WillOnce(Return(mock_app));
+ MockPolicyHandlerInterface mock_policy_handler;
+ EXPECT_CALL(app_mngr_, GetPolicyHandler())
+ .WillOnce(ReturnRef(mock_policy_handler));
+ std::string policy_app_id;
+ EXPECT_CALL(*mock_app, policy_app_id()).WillOnce(Return(policy_app_id));
+ EXPECT_CALL(mock_policy_handler, IsRequestTypeAllowed(_, _))
+ .WillOnce(Return(false));
+
+ EXPECT_CALL(message_helper_, PrintSmartObject(_)).Times(0);
+ EXPECT_CALL(app_mngr_, SendMessageToMobile(msg, _)).Times(0);
+ ;
+
+ command->Run();
+}
+
+} // namespace mobile_commands_test
+} // namespace commands_test
+} // namespace components
+} // namespace test
diff --git a/src/components/application_manager/test/commands/mobile/on_tbt_client_state_notification_test.cc b/src/components/application_manager/test/commands/mobile/on_tbt_client_state_notification_test.cc
new file mode 100644
index 0000000000..cb7c83f34e
--- /dev/null
+++ b/src/components/application_manager/test/commands/mobile/on_tbt_client_state_notification_test.cc
@@ -0,0 +1,138 @@
+/*
+ * Copyright (c) 2016, 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 <vector>
+
+#include "gtest/gtest.h"
+#include "mobile/on_tbt_client_state_notification.h"
+#include "utils/shared_ptr.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 "utils/helpers.h"
+
+namespace test {
+namespace components {
+namespace commands_test {
+namespace mobile_commands_test {
+
+namespace am = ::application_manager;
+
+using ::testing::_;
+using ::testing::Return;
+
+using am::commands::MessageSharedPtr;
+using am::commands::OnTBTClientStateNotification;
+
+typedef ::utils::SharedPtr<OnTBTClientStateNotification> NotificationPtr;
+
+namespace {
+const uint32_t kAppId = 1u;
+} // namespace
+
+class OnTBTClientStateNotificationTest
+ : public CommandsTest<CommandsTestMocks::kIsNice> {
+ public:
+ OnTBTClientStateNotificationTest()
+ : command_(CreateCommand<OnTBTClientStateNotification>()) {}
+
+ NotificationPtr command_;
+};
+
+TEST_F(OnTBTClientStateNotificationTest, Run_HmiLevelNone_UNSUCCESS) {
+ MockAppPtr mock_app(CreateMockApp());
+ std::vector<ApplicationSharedPtr> applications_with_navi;
+ applications_with_navi.push_back(mock_app);
+
+ EXPECT_CALL(app_mngr_, applications_with_navi())
+ .WillOnce(Return(applications_with_navi));
+
+ EXPECT_CALL(*mock_app, hmi_level())
+ .WillOnce(Return(mobile_apis::HMILevel::HMI_NONE));
+
+ EXPECT_CALL(*mock_app, app_id()).Times(0);
+
+ EXPECT_CALL(app_mngr_, SendMessageToMobile(_, _)).Times(0);
+
+ command_->Run();
+}
+
+MATCHER(CheckMessageData, "") {
+ const bool kIsMobileProtocolTypeCorrect =
+ (*arg)[am::strings::params][am::strings::protocol_type].asInt() ==
+ am::commands::CommandImpl::mobile_protocol_type_;
+
+ const bool kIsProtocolVersionCorrect =
+ (*arg)[am::strings::params][am::strings::protocol_version].asInt() ==
+ am::commands::CommandImpl::protocol_version_;
+
+ const bool kIsNotificationCorrect =
+ (*arg)[am::strings::params][am::strings::message_type].asInt() ==
+ am::MessageType::kNotification;
+
+ const bool kIsConnectionKeyCorrect =
+ (*arg)[am::strings::params][am::strings::connection_key].asUInt() ==
+ kAppId;
+
+ using namespace helpers;
+ return Compare<bool, EQ, ALL>(true,
+ kIsMobileProtocolTypeCorrect,
+ kIsProtocolVersionCorrect,
+ kIsNotificationCorrect,
+ kIsConnectionKeyCorrect);
+}
+
+TEST_F(OnTBTClientStateNotificationTest,
+ Run_NotEmptyListOfAppsWithNavi_SUCCESS) {
+ MockAppPtr mock_app(CreateMockApp());
+ std::vector<ApplicationSharedPtr> applications_with_navi;
+ applications_with_navi.push_back(mock_app);
+
+ EXPECT_CALL(app_mngr_, applications_with_navi())
+ .WillOnce(Return(applications_with_navi));
+
+ EXPECT_CALL(*mock_app, hmi_level())
+ .WillOnce(Return(mobile_apis::HMILevel::HMI_FULL));
+
+ EXPECT_CALL(*mock_app, app_id()).WillOnce(Return(kAppId));
+
+ EXPECT_CALL(app_mngr_, SendMessageToMobile(CheckMessageData(), _));
+
+ command_->Run();
+}
+
+} // namespace mobile_commands_test
+} // namespace commands_test
+} // namespace components
+} // namespace test
diff --git a/src/components/application_manager/test/commands/mobile/on_touch_event_notification_test.cc b/src/components/application_manager/test/commands/mobile/on_touch_event_notification_test.cc
new file mode 100644
index 0000000000..e40b5e91ea
--- /dev/null
+++ b/src/components/application_manager/test/commands/mobile/on_touch_event_notification_test.cc
@@ -0,0 +1,135 @@
+/*
+ * Copyright (c) 2016, 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 <vector>
+
+#include "gtest/gtest.h"
+#include "mobile/on_touch_event_notification.h"
+#include "utils/shared_ptr.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 "utils/helpers.h"
+
+namespace test {
+namespace components {
+namespace commands_test {
+namespace mobile_commands_test {
+
+namespace am = ::application_manager;
+
+using ::testing::_;
+using ::testing::Return;
+
+using am::commands::MessageSharedPtr;
+using am::commands::mobile::OnTouchEventNotification;
+
+typedef ::utils::SharedPtr<OnTouchEventNotification> NotificationPtr;
+
+namespace {
+const uint32_t kAppId = 1u;
+} // namespace
+
+class OnTouchEventNotificationTest
+ : public CommandsTest<CommandsTestMocks::kIsNice> {
+ public:
+ OnTouchEventNotificationTest()
+ : command_(CreateCommand<OnTouchEventNotification>()) {}
+
+ NotificationPtr command_;
+};
+
+TEST_F(OnTouchEventNotificationTest, Run_AppIsNotFullscreen_UNSUCCESS) {
+ MockAppPtr mock_app(CreateMockApp());
+ std::vector<ApplicationSharedPtr> applications_with_navi;
+ applications_with_navi.push_back(mock_app);
+
+ EXPECT_CALL(app_mngr_, applications_with_navi())
+ .WillOnce(Return(applications_with_navi));
+
+ EXPECT_CALL(*mock_app, IsFullscreen()).WillOnce(Return(false));
+
+ EXPECT_CALL(*mock_app, app_id()).Times(0);
+
+ EXPECT_CALL(app_mngr_, SendMessageToMobile(_, _)).Times(0);
+
+ command_->Run();
+}
+
+MATCHER(CheckMessageData, "") {
+ const bool kIsMobileProtocolTypeCorrect =
+ (*arg)[am::strings::params][am::strings::protocol_type].asInt() ==
+ am::commands::CommandImpl::mobile_protocol_type_;
+
+ const bool kIsProtocolVersionCorrect =
+ (*arg)[am::strings::params][am::strings::protocol_version].asInt() ==
+ am::commands::CommandImpl::protocol_version_;
+
+ const bool kIsNotificationCorrect =
+ (*arg)[am::strings::params][am::strings::message_type].asInt() ==
+ am::MessageType::kNotification;
+
+ const bool kIsConnectionKeyCorrect =
+ (*arg)[am::strings::params][am::strings::connection_key].asUInt() ==
+ kAppId;
+
+ using namespace helpers;
+ return Compare<bool, EQ, ALL>(true,
+ kIsMobileProtocolTypeCorrect,
+ kIsProtocolVersionCorrect,
+ kIsNotificationCorrect,
+ kIsConnectionKeyCorrect);
+}
+
+TEST_F(OnTouchEventNotificationTest, Run_NotEmptyListOfAppsWithNavi_SUCCESS) {
+ MockAppPtr mock_app(CreateMockApp());
+ std::vector<ApplicationSharedPtr> applications_with_navi;
+ applications_with_navi.push_back(mock_app);
+
+ EXPECT_CALL(app_mngr_, applications_with_navi())
+ .WillOnce(Return(applications_with_navi));
+
+ EXPECT_CALL(*mock_app, IsFullscreen()).WillOnce(Return(true));
+
+ EXPECT_CALL(*mock_app, app_id()).WillOnce(Return(kAppId));
+
+ EXPECT_CALL(app_mngr_, SendMessageToMobile(CheckMessageData(), _));
+
+ command_->Run();
+}
+
+} // namespace mobile_commands_test
+} // namespace commands_test
+} // namespace components
+} // namespace test
diff --git a/src/components/application_manager/test/commands/mobile/on_vehicle_data_notification_test.cc b/src/components/application_manager/test/commands/mobile/on_vehicle_data_notification_test.cc
new file mode 100644
index 0000000000..76ac60840d
--- /dev/null
+++ b/src/components/application_manager/test/commands/mobile/on_vehicle_data_notification_test.cc
@@ -0,0 +1,146 @@
+/*
+ * Copyright (c) 2016, 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 <vector>
+#include <map>
+
+#include "gtest/gtest.h"
+#include "mobile/on_vehicle_data_notification.h"
+#include "utils/shared_ptr.h"
+#include "utils/custom_string.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/message_helper.h"
+#include "application_manager/mock_message_helper.h"
+#include "utils/helpers.h"
+
+namespace test {
+namespace components {
+namespace commands_test {
+namespace mobile_commands_test {
+
+namespace am = ::application_manager;
+
+using ::testing::_;
+using ::testing::Return;
+using ::testing::ReturnRef;
+
+using am::commands::MessageSharedPtr;
+using am::commands::OnVehicleDataNotification;
+
+typedef ::utils::SharedPtr<OnVehicleDataNotification> NotificationPtr;
+
+namespace {
+const uint32_t kAppId = 1u;
+} // namespace
+
+class OnVehicleDataNotificationTest
+ : public CommandsTest<CommandsTestMocks::kIsNice> {
+ public:
+ OnVehicleDataNotificationTest()
+ : mock_message_helper_(*am::MockMessageHelper::message_helper_mock())
+ , command_msg_(CreateMessage(smart_objects::SmartType_Map))
+ , command_(CreateCommand<OnVehicleDataNotification>(command_msg_)) {}
+
+ am::MockMessageHelper& mock_message_helper_;
+ MessageSharedPtr command_msg_;
+ NotificationPtr command_;
+};
+
+MATCHER_P2(CheckMessageData, key, value, "") {
+ const bool kIsMobileProtocolTypeCorrect =
+ (*arg)[am::strings::params][am::strings::protocol_type].asInt() ==
+ am::commands::CommandImpl::mobile_protocol_type_;
+
+ const bool kIsProtocolVersionCorrect =
+ (*arg)[am::strings::params][am::strings::protocol_version].asInt() ==
+ am::commands::CommandImpl::protocol_version_;
+
+ const bool kIsNotificationCorrect =
+ (*arg)[am::strings::params][am::strings::message_type].asInt() ==
+ am::MessageType::kNotification;
+
+ const bool kIsConnectionKeyCorrect =
+ (*arg)[am::strings::params][am::strings::connection_key].asUInt() ==
+ kAppId;
+
+ const bool kAreMsgParamsCorrect =
+ (*arg)[am::strings::msg_params][key].asInt() == value;
+
+ using namespace helpers;
+ return Compare<bool, EQ, ALL>(true,
+ kIsMobileProtocolTypeCorrect,
+ kIsProtocolVersionCorrect,
+ kIsNotificationCorrect,
+ kIsConnectionKeyCorrect,
+ kAreMsgParamsCorrect);
+}
+
+TEST_F(OnVehicleDataNotificationTest,
+ Run_NotEmptyListOfAppsSubscribedForEvent_SUCCESS) {
+ am::VehicleData test_vehicle_data;
+ test_vehicle_data.insert(am::VehicleData::value_type(
+ am::strings::fuel_level, am::VehicleDataType::FUELLEVEL));
+
+ EXPECT_CALL(mock_message_helper_, vehicle_data())
+ .WillOnce(ReturnRef(test_vehicle_data));
+
+ const int kFuelLevel = 100;
+ (*command_msg_)[am::strings::msg_params][am::strings::fuel_level] =
+ kFuelLevel;
+
+ MockAppPtr mock_app(CreateMockApp());
+ std::vector<ApplicationSharedPtr> applications;
+ applications.push_back(mock_app);
+
+ EXPECT_CALL(app_mngr_,
+ IviInfoUpdated(am::VehicleDataType::FUELLEVEL, kFuelLevel))
+ .WillOnce(Return(applications));
+
+ EXPECT_CALL(*mock_app, app_id()).WillRepeatedly(Return(kAppId));
+ ::utils::custom_string::CustomString dummy_name("test_app");
+ ON_CALL(*mock_app, name()).WillByDefault(ReturnRef(dummy_name));
+
+ EXPECT_CALL(app_mngr_,
+ SendMessageToMobile(
+ CheckMessageData(am::strings::fuel_level, kFuelLevel), _));
+
+ command_->Run();
+}
+
+} // namespace mobile_commands_test
+} // namespace commands_test
+} // namespace components
+} // namespace test
diff --git a/src/components/application_manager/test/commands/mobile/on_way_point_change_notification_test.cc b/src/components/application_manager/test/commands/mobile/on_way_point_change_notification_test.cc
new file mode 100644
index 0000000000..58a467a7cf
--- /dev/null
+++ b/src/components/application_manager/test/commands/mobile/on_way_point_change_notification_test.cc
@@ -0,0 +1,114 @@
+/*
+ * Copyright (c) 2016, 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 <set>
+
+#include "gtest/gtest.h"
+#include "mobile/on_way_point_change_notification.h"
+#include "utils/shared_ptr.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 "utils/helpers.h"
+
+namespace test {
+namespace components {
+namespace commands_test {
+namespace mobile_commands_test {
+
+namespace am = ::application_manager;
+
+using ::testing::_;
+using ::testing::Return;
+
+using am::commands::MessageSharedPtr;
+using am::commands::OnWayPointChangeNotification;
+
+typedef ::utils::SharedPtr<OnWayPointChangeNotification> NotificationPtr;
+
+namespace {
+const uint32_t kAppId = 1u;
+} // namespace
+
+class OnWayPointChangeNotificationTest
+ : public CommandsTest<CommandsTestMocks::kIsNice> {
+ public:
+ OnWayPointChangeNotificationTest()
+ : command_(CreateCommand<OnWayPointChangeNotification>()) {}
+
+ NotificationPtr command_;
+};
+
+MATCHER(CheckMessageData, "") {
+ const bool kIsMobileProtocolTypeCorrect =
+ (*arg)[am::strings::params][am::strings::protocol_type].asInt() ==
+ am::commands::CommandImpl::mobile_protocol_type_;
+
+ const bool kIsProtocolVersionCorrect =
+ (*arg)[am::strings::params][am::strings::protocol_version].asInt() ==
+ am::commands::CommandImpl::protocol_version_;
+
+ const bool kIsNotificationCorrect =
+ (*arg)[am::strings::params][am::strings::message_type].asInt() ==
+ am::MessageType::kNotification;
+
+ const bool kIsConnectionKeyCorrect =
+ (*arg)[am::strings::params][am::strings::connection_key].asUInt() ==
+ kAppId;
+
+ using namespace helpers;
+ return Compare<bool, EQ, ALL>(true,
+ kIsMobileProtocolTypeCorrect,
+ kIsProtocolVersionCorrect,
+ kIsNotificationCorrect,
+ kIsConnectionKeyCorrect);
+}
+
+TEST_F(OnWayPointChangeNotificationTest,
+ Run_NotEmptyListOfAppsSubscribedForWayPoints_SUCCESS) {
+ std::set<int32_t> apps_subscribed_for_way_points;
+ apps_subscribed_for_way_points.insert(kAppId);
+
+ EXPECT_CALL(app_mngr_, GetAppsSubscribedForWayPoints())
+ .WillOnce(Return(apps_subscribed_for_way_points));
+
+ EXPECT_CALL(app_mngr_, SendMessageToMobile(CheckMessageData(), _));
+
+ command_->Run();
+}
+
+} // namespace mobile_commands_test
+} // namespace commands_test
+} // namespace components
+} // namespace test
diff --git a/src/components/application_manager/test/commands/mobile/read_did_request_test.cc b/src/components/application_manager/test/commands/mobile/read_did_request_test.cc
new file mode 100644
index 0000000000..0009b6bb0c
--- /dev/null
+++ b/src/components/application_manager/test/commands/mobile/read_did_request_test.cc
@@ -0,0 +1,159 @@
+/*
+ * Copyright (c) 2016, 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 "utils/shared_ptr.h"
+#include "smart_objects/smart_object.h"
+#include "commands/commands_test.h"
+#include "commands/command_request_test.h"
+#include "application_manager/application.h"
+#include "application_manager/mock_application_manager.h"
+#include "application_manager/mock_application.h"
+#include "mobile/read_did_request.h"
+#include "interfaces/MOBILE_API.h"
+#include "interfaces/HMI_API.h"
+#include "application_manager/smart_object_keys.h"
+#include "event_engine/event.h"
+
+namespace test {
+namespace components {
+namespace commands_test {
+namespace mobile_commands_test {
+
+using ::testing::_;
+using ::testing::DoAll;
+using ::testing::Return;
+using ::testing::SaveArg;
+namespace am = ::application_manager;
+using am::commands::ReadDIDRequest;
+using am::commands::MessageSharedPtr;
+using am::event_engine::Event;
+using ::utils::SharedPtr;
+
+class ReadDIDRequestTest
+ : public CommandRequestTest<CommandsTestMocks::kIsNice> {};
+
+TEST_F(ReadDIDRequestTest, OnEvent_WrongEventId_UNSUCCESS) {
+ Event event(Event::EventID::INVALID_ENUM);
+ SharedPtr<ReadDIDRequest> command(CreateCommand<ReadDIDRequest>());
+
+ EXPECT_CALL(app_mngr_, ManageMobileCommand(_, _)).Times(0);
+ command->on_event(event);
+}
+
+TEST_F(ReadDIDRequestTest, OnEvent_SUCCESS) {
+ Event event(Event::EventID::VehicleInfo_ReadDID);
+
+ SharedPtr<ReadDIDRequest> command(CreateCommand<ReadDIDRequest>());
+
+ const mobile_apis::Result::eType kResultCode = mobile_apis::Result::SUCCESS;
+ MessageSharedPtr event_msg(CreateMessage(smart_objects::SmartType_Map));
+ (*event_msg)[am::strings::params][am::hmi_response::code] = kResultCode;
+ (*event_msg)[am::strings::msg_params] = 0;
+
+ event.set_smart_object(*event_msg);
+
+ MessageSharedPtr result_msg(
+ CatchMobileCommandResult(CallOnEvent(*command, event)));
+ EXPECT_EQ(kResultCode,
+ static_cast<mobile_apis::Result::eType>(
+ (*result_msg)[am::strings::msg_params][am::strings::result_code]
+ .asInt()));
+}
+
+TEST_F(ReadDIDRequestTest, Run_AppNotRegistered_UNSUCCESS) {
+ SharedPtr<ReadDIDRequest> command(CreateCommand<ReadDIDRequest>());
+
+ ON_CALL(app_mngr_, application(_))
+ .WillByDefault(Return(SharedPtr<am::Application>()));
+
+ MessageSharedPtr result_msg(CatchMobileCommandResult(CallRun(*command)));
+ EXPECT_EQ(mobile_apis::Result::APPLICATION_NOT_REGISTERED,
+ static_cast<mobile_apis::Result::eType>(
+ (*result_msg)[am::strings::msg_params][am::strings::result_code]
+ .asInt()));
+}
+
+TEST_F(ReadDIDRequestTest, Run_CommandLimitsExceeded_UNSUCCESS) {
+ SharedPtr<ReadDIDRequest> command(CreateCommand<ReadDIDRequest>());
+
+ MockAppPtr app(CreateMockApp());
+ ON_CALL(app_mngr_, application(_)).WillByDefault(Return(app));
+
+ ON_CALL(*app, AreCommandLimitsExceeded(_, _)).WillByDefault(Return(true));
+
+ 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(ReadDIDRequestTest, Run_EmptyDidLocation_UNSUCCESS) {
+ MockAppPtr app(CreateMockApp());
+ SharedPtr<ReadDIDRequest> command(CreateCommand<ReadDIDRequest>());
+
+ ON_CALL(app_mngr_, application(_)).WillByDefault(Return(app));
+
+ ON_CALL(*app, AreCommandLimitsExceeded(_, _)).WillByDefault(Return(false));
+
+ MessageSharedPtr result_msg(CatchMobileCommandResult(CallRun(*command)));
+ EXPECT_EQ(mobile_apis::Result::INVALID_DATA,
+ static_cast<mobile_apis::Result::eType>(
+ (*result_msg)[am::strings::msg_params][am::strings::result_code]
+ .asInt()));
+}
+
+TEST_F(ReadDIDRequestTest, Run_SUCCESS) {
+ MockAppPtr app(CreateMockApp());
+ MessageSharedPtr msg(CreateMessage(smart_objects::SmartType_Map));
+ (*msg)[am::strings::msg_params][am::strings::did_location]["SomeData"] = 0;
+ SharedPtr<ReadDIDRequest> command(CreateCommand<ReadDIDRequest>(msg));
+
+ ON_CALL(app_mngr_, application(_)).WillByDefault(Return(app));
+
+ ON_CALL(*app, AreCommandLimitsExceeded(_, _)).WillByDefault(Return(false));
+
+ MessageSharedPtr result_msg(CatchHMICommandResult(CallRun(*command)));
+ EXPECT_EQ(hmi_apis::FunctionID::VehicleInfo_ReadDID,
+ static_cast<hmi_apis::FunctionID::eType>(
+ (*result_msg)[am::strings::params][am::strings::function_id]
+ .asInt()));
+}
+
+} // namespace mobile_commands_test
+} // namespace commands_test
+} // namespace components
+} // namespace test
diff --git a/src/components/application_manager/test/commands/mobile/simple_notification_commands_test.cc b/src/components/application_manager/test/commands/mobile/simple_notification_commands_test.cc
new file mode 100644
index 0000000000..8135bf3b24
--- /dev/null
+++ b/src/components/application_manager/test/commands/mobile/simple_notification_commands_test.cc
@@ -0,0 +1,95 @@
+/*
+ * Copyright (c) 2016, 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 "utils/shared_ptr.h"
+#include "smart_objects/smart_object.h"
+#include "application_manager/smart_object_keys.h"
+#include "command_impl.h"
+#include "commands/commands_test.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"
+
+namespace test {
+namespace components {
+namespace commands_test {
+namespace mobile_commands_test {
+
+namespace am = ::application_manager;
+namespace commands = am::commands;
+
+using ::testing::_;
+using ::testing::Types;
+
+template <class Command>
+class MobileNotificationCommandsTest
+ : public CommandsTest<CommandsTestMocks::kIsNice> {
+ public:
+ typedef Command CommandType;
+};
+
+typedef Types<commands::OnAppInterfaceUnregisteredNotification,
+ commands::OnAudioPassThruNotification,
+ commands::OnLanguageChangeNotification,
+ commands::OnPermissionsChangeNotification,
+ commands::mobile::OnDriverDistractionNotification>
+ NotificationCommandsList;
+
+MATCHER(CheckNotificationMessage, "") {
+ return (*arg)[am::strings::params][am::strings::protocol_type].asInt() ==
+ commands::CommandImpl::mobile_protocol_type_ &&
+ (*arg)[am::strings::params][am::strings::protocol_version].asInt() ==
+ commands::CommandImpl::protocol_version_ &&
+ (*arg)[am::strings::params][am::strings::message_type].asInt() ==
+ application_manager::MessageType::kNotification;
+}
+
+TYPED_TEST_CASE(MobileNotificationCommandsTest, NotificationCommandsList);
+
+TYPED_TEST(MobileNotificationCommandsTest, Run_SendMessageToMobile_SUCCESS) {
+ ::utils::SharedPtr<typename TestFixture::CommandType> command =
+ this->template CreateCommand<typename TestFixture::CommandType>();
+ EXPECT_CALL(this->app_mngr_,
+ SendMessageToMobile(CheckNotificationMessage(), _));
+ command->Run();
+}
+
+} // namespace mobile_commands_test
+} // namespace commands_test
+} // namespace components
+} // namespace test
diff --git a/src/components/application_manager/test/commands/mobile/simple_response_commands_test.cc b/src/components/application_manager/test/commands/mobile/simple_response_commands_test.cc
new file mode 100644
index 0000000000..9b4dd95d75
--- /dev/null
+++ b/src/components/application_manager/test/commands/mobile/simple_response_commands_test.cc
@@ -0,0 +1,105 @@
+/*
+ * Copyright (c) 2016, 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 "utils/shared_ptr.h"
+#include "commands/commands_test.h"
+#include "application_manager/mock_application_manager.h"
+#include "mobile/read_did_response.h"
+#include "mobile/delete_command_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/diagnostic_message_response.h"
+#include "mobile/dial_number_response.h"
+#include "mobile/end_audio_pass_thru_response.h"
+#include "mobile/get_dtcs_response.h"
+#include "mobile/get_vehicle_data_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 {
+namespace commands_test {
+namespace mobile_commands_test {
+
+namespace commands = ::application_manager::commands;
+
+using ::testing::_;
+using ::testing::NotNull;
+using ::testing::Types;
+
+using commands::MessageSharedPtr;
+
+template <class Command>
+class MobileResponseCommandsTest
+ : public CommandsTest<CommandsTestMocks::kIsNice> {
+ public:
+ typedef Command CommandType;
+};
+
+typedef Types<commands::ListFilesResponse,
+ commands::ReadDIDResponse,
+ commands::DeleteCommandResponse,
+ commands::AlertManeuverResponse,
+ commands::AlertResponse,
+ commands::SubscribeButtonResponse,
+ commands::AddSubMenuResponse,
+ commands::DiagnosticMessageResponse,
+ commands::DialNumberResponse,
+ commands::EndAudioPassThruResponse,
+ commands::GetDTCsResponse,
+ commands::GetVehicleDataResponse,
+ commands::UnregisterAppInterfaceResponse,
+ commands::UnsubscribeWayPointsResponse,
+ commands::UpdateTurnListResponse,
+ commands::UnsubscribeButtonResponse> ResponseCommandsList;
+TYPED_TEST_CASE(MobileResponseCommandsTest, ResponseCommandsList);
+
+TYPED_TEST(MobileResponseCommandsTest, Run_SendResponseToMobile_SUCCESS) {
+ ::utils::SharedPtr<typename TestFixture::CommandType> command =
+ this->template CreateCommand<typename TestFixture::CommandType>();
+ EXPECT_CALL(this->app_mngr_, SendMessageToMobile(NotNull(), _));
+ command->Run();
+}
+
+} // namespace mobile_commands_test
+} // namespace commands_test
+} // namespace components
+} // namespace test
diff --git a/src/components/application_manager/test/commands/mobile/subscribe_button_request_test.cc b/src/components/application_manager/test/commands/mobile/subscribe_button_request_test.cc
new file mode 100644
index 0000000000..de132e1794
--- /dev/null
+++ b/src/components/application_manager/test/commands/mobile/subscribe_button_request_test.cc
@@ -0,0 +1,202 @@
+/*
+ * Copyright (c) 2016, 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 "utils/shared_ptr.h"
+#include "smart_objects/smart_object.h"
+#include "commands/commands_test.h"
+#include "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_hmi_capabilities.h"
+#include "mobile/subscribe_button_request.h"
+#include "interfaces/MOBILE_API.h"
+#include "application_manager/smart_object_keys.h"
+
+namespace test {
+namespace components {
+namespace commands_test {
+namespace mobile_commands_test {
+
+using ::testing::_;
+using ::testing::Return;
+using ::testing::ReturnRef;
+using ::testing::DoAll;
+using ::testing::SaveArg;
+namespace am = ::application_manager;
+using am::commands::SubscribeButtonRequest;
+using am::commands::MessageSharedPtr;
+
+typedef SharedPtr<SubscribeButtonRequest> CommandPtr;
+
+class SubscribeButtonRequestTest
+ : public CommandRequestTest<CommandsTestMocks::kIsNice> {
+ public:
+ typedef TypeIf<kMocksAreNice,
+ NiceMock<application_manager_test::MockHMICapabilities>,
+ application_manager_test::MockHMICapabilities>::Result
+ MockHMICapabilities;
+};
+
+typedef SubscribeButtonRequestTest::MockHMICapabilities MockHMICapabilities;
+
+TEST_F(SubscribeButtonRequestTest, Run_AppNotRegistered_UNSUCCESS) {
+ CommandPtr command(CreateCommand<SubscribeButtonRequest>());
+
+ ON_CALL(app_mngr_, application(_))
+ .WillByDefault(Return(SharedPtr<am::Application>()));
+
+ MessageSharedPtr result_msg(CatchMobileCommandResult(CallRun(*command)));
+ EXPECT_EQ(mobile_apis::Result::APPLICATION_NOT_REGISTERED,
+ static_cast<mobile_apis::Result::eType>(
+ (*result_msg)[am::strings::msg_params][am::strings::result_code]
+ .asInt()));
+}
+
+TEST_F(SubscribeButtonRequestTest, Run_SubscriptionNotAllowed_UNSUCCESS) {
+ MessageSharedPtr msg(CreateMessage());
+ (*msg)[am::strings::msg_params][am::strings::button_name] =
+ mobile_apis::ButtonName::SEEKLEFT;
+ CommandPtr command(CreateCommand<SubscribeButtonRequest>(msg));
+
+ MockAppPtr app(CreateMockApp());
+ ON_CALL(app_mngr_, application(_)).WillByDefault(Return(app));
+ ON_CALL(*app, is_media_application()).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>());
+
+ MockAppPtr app(CreateMockApp());
+ ON_CALL(app_mngr_, application(_)).WillByDefault(Return(app));
+
+ MockHMICapabilities hmi_capabilities;
+ ON_CALL(app_mngr_, hmi_capabilities())
+ .WillByDefault(ReturnRef(hmi_capabilities));
+ ON_CALL(hmi_capabilities, is_ui_cooperating()).WillByDefault(Return(false));
+
+ MessageSharedPtr result_msg(CatchMobileCommandResult(CallRun(*command)));
+ EXPECT_EQ(mobile_apis::Result::UNSUPPORTED_RESOURCE,
+ static_cast<mobile_apis::Result::eType>(
+ (*result_msg)[am::strings::msg_params][am::strings::result_code]
+ .asInt()));
+}
+
+TEST_F(SubscribeButtonRequestTest, Run_IsSubscribedToButton_UNSUCCESS) {
+ const mobile_apis::ButtonName::eType kButtonName =
+ mobile_apis::ButtonName::SEEKLEFT;
+
+ 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, is_media_application()).WillByDefault(Return(true));
+
+ MockHMICapabilities hmi_capabilities;
+ ON_CALL(app_mngr_, hmi_capabilities())
+ .WillByDefault(ReturnRef(hmi_capabilities));
+ ON_CALL(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(hmi_capabilities, button_capabilities())
+ .WillByDefault(Return(button_caps_ptr.get()));
+
+ ON_CALL(*app, IsSubscribedToButton(_)).WillByDefault(Return(true));
+
+ MessageSharedPtr result_msg(CatchMobileCommandResult(CallRun(*command)));
+ EXPECT_EQ(mobile_apis::Result::IGNORED,
+ static_cast<mobile_apis::Result::eType>(
+ (*result_msg)[am::strings::msg_params][am::strings::result_code]
+ .asInt()));
+}
+
+TEST_F(SubscribeButtonRequestTest, Run_SUCCESS) {
+ const mobile_apis::ButtonName::eType kButtonName =
+ mobile_apis::ButtonName::SEEKLEFT;
+
+ 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, is_media_application()).WillByDefault(Return(true));
+
+ MockHMICapabilities hmi_capabilities;
+ ON_CALL(app_mngr_, hmi_capabilities())
+ .WillByDefault(ReturnRef(hmi_capabilities));
+ ON_CALL(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(hmi_capabilities, button_capabilities())
+ .WillByDefault(Return(button_caps_ptr.get()));
+
+ ON_CALL(*app, IsSubscribedToButton(_)).WillByDefault(Return(false));
+
+ MessageSharedPtr hmi_result_msg;
+ EXPECT_CALL(app_mngr_, ManageHMICommand(_))
+ .WillOnce(DoAll(SaveArg<0>(&hmi_result_msg), Return(true)));
+
+ MessageSharedPtr mobile_result_msg(
+ CatchMobileCommandResult(CallRun(*command)));
+
+ 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()));
+}
+
+} // namespace mobile_commands_test
+} // namespace commands_test
+} // namespace components
+} // namespace test
diff --git a/src/components/application_manager/test/commands/mobile/unregister_app_interface_request_test.cc b/src/components/application_manager/test/commands/mobile/unregister_app_interface_request_test.cc
new file mode 100644
index 0000000000..c5d2e4497e
--- /dev/null
+++ b/src/components/application_manager/test/commands/mobile/unregister_app_interface_request_test.cc
@@ -0,0 +1,116 @@
+/*
+ * Copyright (c) 2016, 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 "utils/shared_ptr.h"
+#include "commands/command_request_test.h"
+#include "application_manager/mock_application_manager.h"
+#include "application_manager/mock_message_helper.h"
+#include "mobile/unregister_app_interface_request.h"
+
+namespace test {
+namespace components {
+namespace commands_test {
+namespace mobile_commands_test {
+
+namespace am = ::application_manager;
+namespace mobile_result = mobile_apis::Result;
+
+using ::testing::_;
+
+using am::commands::UnregisterAppInterfaceRequest;
+using am::commands::MessageSharedPtr;
+
+typedef ::utils::SharedPtr<UnregisterAppInterfaceRequest> CommandPtr;
+
+class UnregisterAppInterfaceRequestTest
+ : public CommandRequestTest<CommandsTestMocks::kIsNice> {};
+
+TEST_F(UnregisterAppInterfaceRequestTest, Run_AppNotRegistered_UNSUCCESS) {
+ CommandPtr command(CreateCommand<UnregisterAppInterfaceRequest>());
+
+ EXPECT_CALL(app_mngr_, application(_))
+ .WillOnce(Return(ApplicationSharedPtr()));
+
+ EXPECT_CALL(
+ app_mngr_,
+ ManageMobileCommand(
+ MobileResultCodeIs(mobile_result::APPLICATION_NOT_REGISTERED), _));
+
+ command->Run();
+}
+
+TEST_F(UnregisterAppInterfaceRequestTest, Run_SUCCESS) {
+ const uint32_t kConnectionKey = 1u;
+
+ MessageSharedPtr command_msg(CreateMessage(smart_objects::SmartType_Map));
+ (*command_msg)[am::strings::params][am::strings::connection_key] =
+ kConnectionKey;
+
+ CommandPtr command(CreateCommand<UnregisterAppInterfaceRequest>(command_msg));
+
+ MockAppPtr mock_app(CreateMockApp());
+ EXPECT_CALL(app_mngr_, application(kConnectionKey))
+ .WillOnce(Return(mock_app));
+
+ const mobile_apis::AppInterfaceUnregisteredReason::eType kUnregisterReason =
+ mobile_apis::AppInterfaceUnregisteredReason::INVALID_ENUM;
+
+ MessageSharedPtr dummy_msg(CreateMessage());
+ EXPECT_CALL(*am::MockMessageHelper::message_helper_mock(),
+ GetOnAppInterfaceUnregisteredNotificationToMobile(
+ kConnectionKey, kUnregisterReason))
+ .WillOnce(Return(dummy_msg));
+ {
+ ::testing::InSequence sequence;
+
+ EXPECT_CALL(app_mngr_, ManageMobileCommand(dummy_msg, _));
+
+ EXPECT_CALL(app_mngr_,
+ UnregisterApplication(
+ kConnectionKey, mobile_apis::Result::SUCCESS, _, _));
+
+ EXPECT_CALL(app_mngr_,
+ ManageMobileCommand(
+ MobileResultCodeIs(mobile_apis::Result::SUCCESS), _));
+ }
+
+ command->Run();
+}
+
+} // namespace mobile_commands_test
+} // namespace commands_test
+} // namespace components
+} // namespace test
diff --git a/src/components/application_manager/test/commands/mobile/unsubscribe_button_request_test.cc b/src/components/application_manager/test/commands/mobile/unsubscribe_button_request_test.cc
new file mode 100644
index 0000000000..d9df08c9bc
--- /dev/null
+++ b/src/components/application_manager/test/commands/mobile/unsubscribe_button_request_test.cc
@@ -0,0 +1,103 @@
+#include <stdint.h>
+#include <string>
+
+#include "gtest/gtest.h"
+#include "utils/shared_ptr.h"
+#include "commands/command_request_test.h"
+#include "application_manager/mock_application_manager.h"
+#include "application_manager/mock_message_helper.h"
+#include "mobile/unsubscribe_button_request.h"
+
+namespace test {
+namespace components {
+namespace commands_test {
+namespace mobile_commands_test {
+
+namespace am = ::application_manager;
+namespace mobile_result = mobile_apis::Result;
+
+using ::testing::_;
+
+using am::commands::UnsubscribeButtonRequest;
+using am::commands::MessageSharedPtr;
+
+typedef ::utils::SharedPtr<UnsubscribeButtonRequest> CommandPtr;
+
+namespace {
+const uint32_t kConnectionKey = 1u;
+const mobile_apis::ButtonName::eType kButtonId = mobile_apis::ButtonName::OK;
+} // namespace
+
+class UnsubscribeButtonRequestTest
+ : public CommandRequestTest<CommandsTestMocks::kIsNice> {};
+
+TEST_F(UnsubscribeButtonRequestTest, Run_AppNotRegistered_UNSUCCESS) {
+ CommandPtr command(CreateCommand<UnsubscribeButtonRequest>());
+
+ EXPECT_CALL(app_mngr_, application(_))
+ .WillOnce(Return(ApplicationSharedPtr()));
+
+ EXPECT_CALL(
+ app_mngr_,
+ ManageMobileCommand(
+ MobileResultCodeIs(mobile_result::APPLICATION_NOT_REGISTERED), _));
+
+ command->Run();
+}
+
+TEST_F(UnsubscribeButtonRequestTest,
+ Run_UnsubscribeNotSubscribedButton_UNSUCCESS) {
+ MessageSharedPtr command_msg(CreateMessage(smart_objects::SmartType_Map));
+ (*command_msg)[am::strings::params][am::strings::connection_key] =
+ kConnectionKey;
+ (*command_msg)[am::strings::msg_params][am::strings::button_name] = kButtonId;
+
+ CommandPtr command(CreateCommand<UnsubscribeButtonRequest>(command_msg));
+
+ MockAppPtr mock_app(CreateMockApp());
+ EXPECT_CALL(app_mngr_, application(kConnectionKey))
+ .WillOnce(Return(mock_app));
+
+ EXPECT_CALL(*mock_app, UnsubscribeFromButton(kButtonId))
+ .WillOnce(Return(false));
+
+ EXPECT_CALL(
+ app_mngr_,
+ ManageMobileCommand(MobileResultCodeIs(mobile_result::IGNORED), _));
+
+ command->Run();
+}
+
+TEST_F(UnsubscribeButtonRequestTest, Run_SUCCESS) {
+ const mobile_apis::ButtonName::eType kButtonId = mobile_apis::ButtonName::OK;
+
+ MessageSharedPtr command_msg(CreateMessage(smart_objects::SmartType_Map));
+ (*command_msg)[am::strings::params][am::strings::connection_key] =
+ kConnectionKey;
+ (*command_msg)[am::strings::msg_params][am::strings::button_name] = kButtonId;
+
+ CommandPtr command(CreateCommand<UnsubscribeButtonRequest>(command_msg));
+
+ MockAppPtr mock_app(CreateMockApp());
+ EXPECT_CALL(app_mngr_, application(kConnectionKey))
+ .WillOnce(Return(mock_app));
+
+ EXPECT_CALL(*mock_app, UnsubscribeFromButton(kButtonId))
+ .WillOnce(Return(true));
+
+ EXPECT_CALL(app_mngr_,
+ ManageHMICommand(HMIResultCodeIs(
+ hmi_apis::FunctionID::Buttons_OnButtonSubscription)));
+ EXPECT_CALL(
+ app_mngr_,
+ ManageMobileCommand(MobileResultCodeIs(mobile_result::SUCCESS), _));
+
+ EXPECT_CALL(*mock_app, UpdateHash());
+
+ command->Run();
+}
+
+} // namespace mobile_commands_test
+} // namespace commands_test
+} // namespace components
+} // namespace test
diff --git a/src/components/application_manager/test/commands/mobile/unsubscribe_vehicle_request_test.cc b/src/components/application_manager/test/commands/mobile/unsubscribe_vehicle_request_test.cc
new file mode 100644
index 0000000000..83e30b8315
--- /dev/null
+++ b/src/components/application_manager/test/commands/mobile/unsubscribe_vehicle_request_test.cc
@@ -0,0 +1,291 @@
+/*
+ Copyright (c) 2016, 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 "utils/shared_ptr.h"
+#include "commands/command_request_test.h"
+#include "application_manager/mock_application_manager.h"
+#include "application_manager/mock_message_helper.h"
+#include "mobile/unsubscribe_vehicle_data_request.h"
+
+namespace test {
+namespace components {
+namespace commands_test {
+namespace mobile_commands_test {
+
+namespace am = ::application_manager;
+namespace mobile_result = mobile_apis::Result;
+
+using ::testing::_;
+
+using am::commands::UnsubscribeVehicleDataRequest;
+using am::commands::MessageSharedPtr;
+
+typedef ::utils::SharedPtr<UnsubscribeVehicleDataRequest> CommandPtr;
+
+namespace {
+const uint32_t kConnectionKey = 1u;
+const std::string kMsgParamKey = "test_key";
+const am::VehicleDataType kVehicleType = am::VehicleDataType::SPEED;
+} // namespace
+
+class UnsubscribeVehicleRequestTest
+ : public CommandRequestTest<CommandsTestMocks::kIsNice> {
+ protected:
+ void UnsubscribeSuccessfully();
+ sync_primitives::Lock app_set_lock_;
+};
+
+TEST_F(UnsubscribeVehicleRequestTest, Run_AppNotRegistered_UNSUCCESS) {
+ CommandPtr command(CreateCommand<UnsubscribeVehicleDataRequest>());
+ EXPECT_CALL(app_mngr_, application(_))
+ .WillOnce(Return(ApplicationSharedPtr()));
+
+ EXPECT_CALL(
+ app_mngr_,
+ ManageMobileCommand(
+ MobileResultCodeIs(mobile_result::APPLICATION_NOT_REGISTERED), _));
+
+ command->Run();
+}
+
+TEST_F(UnsubscribeVehicleRequestTest,
+ Run_DataToUnsubscribeIsNotExisted_UNSUCCESS) {
+ MessageSharedPtr command_msg(CreateMessage(smart_objects::SmartType_Map));
+ (*command_msg)[am::strings::params][am::strings::connection_key] =
+ kConnectionKey;
+ (*command_msg)[am::strings::msg_params][am::strings::button_name] =
+ kVehicleType;
+
+ am::VehicleData data;
+ EXPECT_CALL(*(am::MockMessageHelper::message_helper_mock()), vehicle_data())
+ .WillOnce(ReturnRef(data));
+ CommandPtr command(CreateCommand<UnsubscribeVehicleDataRequest>(command_msg));
+
+ MockAppPtr mock_app(CreateMockApp());
+ EXPECT_CALL(app_mngr_, application(kConnectionKey))
+ .WillOnce(Return(mock_app));
+
+ EXPECT_CALL(
+ app_mngr_,
+ ManageMobileCommand(MobileResultCodeIs(mobile_result::INVALID_DATA), _));
+
+ command->Run();
+}
+
+TEST_F(UnsubscribeVehicleRequestTest,
+ Run_UnsubscribeNotSubscribedBeforeData_IGNORED) {
+ MessageSharedPtr command_msg(CreateMessage(smart_objects::SmartType_Map));
+ (*command_msg)[am::strings::params][am::strings::connection_key] =
+ kConnectionKey;
+ (*command_msg)[am::strings::msg_params][kMsgParamKey] = kVehicleType;
+
+ am::VehicleData vehicle_data;
+ vehicle_data.insert(am::VehicleData::value_type(kMsgParamKey, kVehicleType));
+ EXPECT_CALL(*(am::MockMessageHelper::message_helper_mock()), vehicle_data())
+ .WillOnce(ReturnRef(vehicle_data));
+ CommandPtr command(CreateCommand<UnsubscribeVehicleDataRequest>(command_msg));
+
+ MockAppPtr mock_app(CreateMockApp());
+ EXPECT_CALL(app_mngr_, application(kConnectionKey))
+ .WillOnce(Return(mock_app));
+
+ EXPECT_CALL(
+ app_mngr_,
+ ManageMobileCommand(MobileResultCodeIs(mobile_result::IGNORED), _));
+
+ command->Run();
+}
+
+TEST_F(UnsubscribeVehicleRequestTest,
+ Run_UnsubscribeNotSubscribedBeforeData_UNSUCCESS) {
+ MessageSharedPtr command_msg(CreateMessage(smart_objects::SmartType_Map));
+ (*command_msg)[am::strings::params][am::strings::connection_key] =
+ kConnectionKey;
+ (*command_msg)[am::strings::msg_params][kMsgParamKey] = true;
+
+ am::VehicleData vehicle_data;
+ vehicle_data.insert(am::VehicleData::value_type(kMsgParamKey, kVehicleType));
+ EXPECT_CALL(*(am::MockMessageHelper::message_helper_mock()), vehicle_data())
+ .WillOnce(ReturnRef(vehicle_data));
+ CommandPtr command(CreateCommand<UnsubscribeVehicleDataRequest>(command_msg));
+
+ MockAppPtr mock_app(CreateMockApp());
+ EXPECT_CALL(app_mngr_, application(kConnectionKey))
+ .WillOnce(Return(mock_app));
+
+ EXPECT_CALL(
+ app_mngr_,
+ ManageMobileCommand(MobileResultCodeIs(mobile_result::IGNORED), _));
+
+ command->Run();
+}
+
+TEST_F(UnsubscribeVehicleRequestTest, Run_UnsubscribeDataDisabled_UNSUCCESS) {
+ MessageSharedPtr command_msg(CreateMessage(smart_objects::SmartType_Map));
+ (*command_msg)[am::strings::params][am::strings::connection_key] =
+ kConnectionKey;
+
+ am::VehicleData vehicle_data;
+ vehicle_data.insert(am::VehicleData::value_type(kMsgParamKey, kVehicleType));
+ EXPECT_CALL(*(am::MockMessageHelper::message_helper_mock()), vehicle_data())
+ .WillOnce(ReturnRef(vehicle_data));
+ CommandPtr command(CreateCommand<UnsubscribeVehicleDataRequest>(command_msg));
+
+ MockAppPtr mock_app(CreateMockApp());
+ EXPECT_CALL(app_mngr_, application(kConnectionKey))
+ .WillOnce(Return(mock_app));
+
+ EXPECT_CALL(
+ app_mngr_,
+ ManageMobileCommand(MobileResultCodeIs(mobile_result::INVALID_DATA), _));
+
+ command->Run();
+}
+
+void UnsubscribeVehicleRequestTest::UnsubscribeSuccessfully() {
+ MessageSharedPtr command_msg(CreateMessage(smart_objects::SmartType_Map));
+ (*command_msg)[am::strings::params][am::strings::connection_key] =
+ kConnectionKey;
+ (*command_msg)[am::strings::msg_params][kMsgParamKey] = true;
+ am::VehicleData vehicle_data;
+ vehicle_data.insert(am::VehicleData::value_type(kMsgParamKey, kVehicleType));
+ EXPECT_CALL(*(am::MockMessageHelper::message_helper_mock()), vehicle_data())
+ .WillOnce(ReturnRef(vehicle_data));
+ CommandPtr command(CreateCommand<UnsubscribeVehicleDataRequest>(command_msg));
+
+ am::ApplicationSet application_set_;
+ MockAppPtr mock_app(CreateMockApp());
+ application_set_.insert(mock_app);
+ DataAccessor<am::ApplicationSet> accessor(application_set_, app_set_lock_);
+ EXPECT_CALL(app_mngr_, application(kConnectionKey))
+ .WillOnce(Return(mock_app));
+ EXPECT_CALL(app_mngr_, applications()).WillOnce(Return(accessor));
+
+ EXPECT_CALL(*mock_app, IsSubscribedToIVI(kVehicleType))
+ .WillRepeatedly(Return(true));
+ EXPECT_CALL(*mock_app, UnsubscribeFromIVI(kVehicleType))
+ .WillRepeatedly(Return(true));
+
+ EXPECT_CALL(
+ app_mngr_,
+ ManageMobileCommand(MobileResultCodeIs(mobile_result::SUCCESS), _));
+
+ command->Run();
+}
+
+TEST_F(UnsubscribeVehicleRequestTest, Run_UnsubscribeData_SUCCESS) {
+ UnsubscribeSuccessfully();
+}
+
+TEST_F(UnsubscribeVehicleRequestTest, OnEvent_DataNotSubscribed_IGNORED) {
+ MessageSharedPtr command_msg(CreateMessage(smart_objects::SmartType_Map));
+ (*command_msg)[am::strings::params][am::strings::connection_key] =
+ kConnectionKey;
+ (*command_msg)[am::strings::msg_params][kMsgParamKey] = true;
+ CommandPtr command(CreateCommand<UnsubscribeVehicleDataRequest>(command_msg));
+
+ am::VehicleData vehicle_data;
+ MockAppPtr mock_app(CreateMockApp());
+ EXPECT_CALL(app_mngr_, application(kConnectionKey))
+ .WillRepeatedly(Return(mock_app));
+ vehicle_data.insert(am::VehicleData::value_type(kMsgParamKey, kVehicleType));
+ EXPECT_CALL(*(am::MockMessageHelper::message_helper_mock()), vehicle_data())
+ .WillOnce(ReturnRef(vehicle_data));
+ EXPECT_CALL(*mock_app, IsSubscribedToIVI(kVehicleType))
+ .WillRepeatedly(Return(false));
+ EXPECT_CALL(
+ app_mngr_,
+ ManageMobileCommand(MobileResultCodeIs(mobile_result::IGNORED), _));
+ command->Run();
+
+ am::event_engine::Event test_event(
+ hmi_apis::FunctionID::VehicleInfo_UnsubscribeVehicleData);
+ SmartObject message(smart_objects::SmartType_Map);
+ const hmi_apis::Common_Result::eType hmi_result =
+ hmi_apis::Common_Result::SUCCESS;
+ const mobile_apis::Result::eType mob_result = mobile_apis::Result::SUCCESS;
+ message[am::strings::params][am::hmi_response::code] = hmi_result;
+ message[am::strings::msg_params][kMsgParamKey] = true;
+ test_event.set_smart_object(message);
+ EXPECT_CALL(*(am::MockMessageHelper::message_helper_mock()),
+ HMIToMobileResult(hmi_result)).WillOnce(Return(mob_result));
+
+ EXPECT_CALL(
+ app_mngr_,
+ ManageMobileCommand(MobileResultCodeIs(mobile_result::IGNORED), _));
+ EXPECT_CALL(*mock_app, UpdateHash());
+
+ command->on_event(test_event);
+}
+
+TEST_F(UnsubscribeVehicleRequestTest, OnEvent_DataUnsubscribed_SUCCESS) {
+ UnsubscribeSuccessfully();
+ MessageSharedPtr command_msg(CreateMessage(smart_objects::SmartType_Map));
+ (*command_msg)[am::strings::params][am::strings::connection_key] =
+ kConnectionKey;
+ (*command_msg)[am::strings::msg_params][kMsgParamKey] = true;
+ CommandPtr command(CreateCommand<UnsubscribeVehicleDataRequest>(command_msg));
+ MockAppPtr mock_app(CreateMockApp());
+
+ am::event_engine::Event test_event(
+ hmi_apis::FunctionID::VehicleInfo_UnsubscribeVehicleData);
+ SmartObject message(smart_objects::SmartType_Map);
+ const hmi_apis::Common_Result::eType hmi_result =
+ hmi_apis::Common_Result::SUCCESS;
+ const mobile_apis::Result::eType mob_result = mobile_apis::Result::SUCCESS;
+ message[am::strings::params][am::hmi_response::code] = hmi_result;
+ message[am::strings::msg_params][kMsgParamKey] = true;
+ test_event.set_smart_object(message);
+
+ EXPECT_CALL(*(am::MockMessageHelper::message_helper_mock()),
+ HMIToMobileResult(hmi_result)).WillOnce(Return(mob_result));
+
+ EXPECT_CALL(app_mngr_, application(kConnectionKey))
+ .WillOnce(Return(mock_app));
+
+ EXPECT_CALL(
+ app_mngr_,
+ ManageMobileCommand(MobileResultCodeIs(mobile_result::SUCCESS), _));
+
+ EXPECT_CALL(*mock_app, UpdateHash());
+
+ command->on_event(test_event);
+}
+
+} // namespace mobile_commands_test
+} // namespace commands_test
+} // namespace components
+} // namespace test
diff --git a/src/components/application_manager/test/commands/mobile/unsubscribe_vehicle_response_test.cc b/src/components/application_manager/test/commands/mobile/unsubscribe_vehicle_response_test.cc
new file mode 100644
index 0000000000..470818e750
--- /dev/null
+++ b/src/components/application_manager/test/commands/mobile/unsubscribe_vehicle_response_test.cc
@@ -0,0 +1,109 @@
+/*
+ * Copyright (c) 2016, 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/unsubscribe_vehicle_data_response.h"
+#include <stdint.h>
+#include <string>
+#include "gtest/gtest.h"
+#include "utils/shared_ptr.h"
+#include "commands/commands_test.h"
+#include "application_manager/mock_application_manager.h"
+
+namespace test {
+namespace components {
+namespace commands_test {
+namespace mobile_commands_test {
+
+namespace commands = ::application_manager::commands;
+
+using ::testing::_;
+using ::testing::NotNull;
+using ::testing::Types;
+
+using commands::MessageSharedPtr;
+namespace am = ::application_manager;
+
+class UnsubscribeVehicleResponseTest
+ : public CommandsTest<CommandsTestMocks::kIsNice> {};
+
+MATCHER_P(ResultCodeIs, result_code, "") {
+ return result_code ==
+ static_cast<mobile_apis::Result::eType>(
+ (*arg)[am::strings::msg_params][am::strings::result_code].asInt());
+}
+
+TEST_F(UnsubscribeVehicleResponseTest,
+ Run_SendFalseResponseToMobile_SendInvalidEnum) {
+ MessageSharedPtr command_msg =
+ ::utils::MakeShared<SmartObject>(smart_objects::SmartType_Map);
+ (*command_msg)[am::strings::msg_params][am::strings::success] = false;
+
+ ::utils::SharedPtr<commands::UnsubscribeVehicleDataResponse> command =
+ CreateCommand<commands::UnsubscribeVehicleDataResponse>(command_msg);
+ EXPECT_CALL(
+ app_mngr_,
+ SendMessageToMobile(ResultCodeIs(mobile_apis::Result::INVALID_ENUM), _));
+ command->Run();
+}
+
+TEST_F(UnsubscribeVehicleResponseTest,
+ Run_SendSuccessfulResponseToMobile_SUCCESS) {
+ MessageSharedPtr command_msg =
+ ::utils::MakeShared<SmartObject>(smart_objects::SmartType_Map);
+ (*command_msg)[am::strings::msg_params][am::strings::success] = true;
+ ::utils::SharedPtr<commands::UnsubscribeVehicleDataResponse> command =
+ CreateCommand<commands::UnsubscribeVehicleDataResponse>(command_msg);
+ EXPECT_CALL(
+ app_mngr_,
+ SendMessageToMobile(ResultCodeIs(mobile_apis::Result::SUCCESS), _));
+ command->Run();
+}
+
+TEST_F(UnsubscribeVehicleResponseTest,
+ Run_SendResponseToMobile_SendCodeToMobile) {
+ MessageSharedPtr command_msg =
+ ::utils::MakeShared<SmartObject>(smart_objects::SmartType_Map);
+ (*command_msg)[am::strings::msg_params][am::strings::success] = true;
+
+ mobile_apis::Result::eType result_type = mobile_apis::Result::WARNINGS;
+ (*command_msg)[am::strings::msg_params][am::strings::result_code] =
+ result_type;
+ ::utils::SharedPtr<commands::UnsubscribeVehicleDataResponse> command =
+ CreateCommand<commands::UnsubscribeVehicleDataResponse>(command_msg);
+ EXPECT_CALL(app_mngr_, SendMessageToMobile(ResultCodeIs(result_type), _));
+ command->Run();
+}
+
+} // namespace mobile_commands_test
+} // namespace commands_test
+} // namespace components
+} // namespace test
diff --git a/src/components/application_manager/test/commands/mobile/unsubscribe_way_points_request_test.cc~ff89c63... Cover UnsubscribeWayPoints and UpdateTurnList by Unit Tests. b/src/components/application_manager/test/commands/mobile/unsubscribe_way_points_request_test.cc~ff89c63... Cover UnsubscribeWayPoints and UpdateTurnList by Unit Tests.
new file mode 100644
index 0000000000..e4a0d0fb6d
--- /dev/null
+++ b/src/components/application_manager/test/commands/mobile/unsubscribe_way_points_request_test.cc~ff89c63... Cover UnsubscribeWayPoints and UpdateTurnList by Unit Tests.
@@ -0,0 +1,169 @@
+/*
+ * Copyright (c) 2016, 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 "mobile/unsubscribe_way_points_request.h"
+#include "interfaces/MOBILE_API.h"
+#include "utils/shared_ptr.h"
+#include "smart_objects/smart_object.h"
+#include "commands/commands_test.h"
+#include "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/smart_object_keys.h"
+#include "application_manager/event_engine/event.h"
+
+namespace test {
+namespace components {
+namespace commands_test {
+namespace mobile_commands_test {
+
+namespace am = ::application_manager;
+namespace mobile_result = mobile_apis::Result;
+
+using ::testing::_;
+using ::testing::Return;
+
+using am::commands::UnSubscribeWayPointsRequest;
+using am::commands::MessageSharedPtr;
+
+namespace {
+const uint32_t kConnectionKey = 3u;
+const uint32_t kAppId = 5u;
+} // namespace
+
+class UnSubscribeWayPointsRequestTest
+ : public CommandRequestTest<CommandsTestMocks::kIsNice> {
+ public:
+ UnSubscribeWayPointsRequestTest()
+ : command_msg_(CreateMessage(smart_objects::SmartType_Map))
+ , command_(CreateCommand<UnSubscribeWayPointsRequest>(command_msg_)) {
+ (*command_msg_)[am::strings::params][am::strings::connection_key] =
+ kConnectionKey;
+ }
+
+ MessageSharedPtr command_msg_;
+ ::utils::SharedPtr<UnSubscribeWayPointsRequest> command_;
+};
+
+TEST_F(UnSubscribeWayPointsRequestTest,
+ Run_ApplicationIsNotRegistered_UNSUCCESS) {
+ EXPECT_CALL(app_mngr_, application(_))
+ .WillOnce(Return(ApplicationSharedPtr()));
+
+ EXPECT_CALL(
+ app_mngr_,
+ ManageMobileCommand(
+ MobileResultCodeIs(mobile_result::APPLICATION_NOT_REGISTERED), _));
+
+ command_->Run();
+}
+
+TEST_F(UnSubscribeWayPointsRequestTest,
+ Run_AppIsNotSubscribedForWayPoints_UNSUCCESS) {
+ MockAppPtr mock_app(CreateMockApp());
+ EXPECT_CALL(app_mngr_, application(kConnectionKey))
+ .WillOnce(Return(mock_app));
+
+ EXPECT_CALL(*mock_app, app_id()).WillOnce(Return(kAppId));
+
+ EXPECT_CALL(app_mngr_, IsAppSubscribedForWayPoints(kAppId))
+ .WillOnce(Return(false));
+
+ EXPECT_CALL(
+ app_mngr_,
+ ManageMobileCommand(MobileResultCodeIs(mobile_result::IGNORED), _));
+
+ command_->Run();
+}
+
+TEST_F(UnSubscribeWayPointsRequestTest, Run_AppSubscribedForWayPoints_SUCCESS) {
+ MockAppPtr mock_app(CreateMockApp());
+ EXPECT_CALL(app_mngr_, application(kConnectionKey))
+ .WillOnce(Return(mock_app));
+
+ EXPECT_CALL(*mock_app, app_id()).WillOnce(Return(kAppId));
+
+ EXPECT_CALL(app_mngr_, IsAppSubscribedForWayPoints(kAppId))
+ .WillOnce(Return(true));
+
+ EXPECT_CALL(app_mngr_,
+ ManageHMICommand(HMIResultCodeIs(
+ hmi_apis::FunctionID::Navigation_UnsubscribeWayPoints)));
+
+ command_->Run();
+}
+
+TEST_F(UnSubscribeWayPointsRequestTest, OnEvent_UnknownEvent_UNSUCCESS) {
+ MockAppPtr mock_app(CreateMockApp());
+ EXPECT_CALL(app_mngr_, application(kConnectionKey))
+ .WillOnce(Return(mock_app));
+
+ EXPECT_CALL(app_mngr_, ManageMobileCommand(_, _)).Times(0);
+
+ Event event(hmi_apis::FunctionID::INVALID_ENUM);
+
+ command_->on_event(event);
+}
+
+TEST_F(UnSubscribeWayPointsRequestTest,
+ OnEvent_ReceivedNavigationUnSubscribeWayPointsEvent_SUCCESS) {
+ MockAppPtr mock_app(CreateMockApp());
+ EXPECT_CALL(app_mngr_, application(kConnectionKey))
+ .WillOnce(Return(mock_app));
+
+ MessageSharedPtr event_msg(CreateMessage(smart_objects::SmartType_Map));
+ (*event_msg)[am::strings::msg_params] = 0;
+ (*event_msg)[am::strings::params][am::hmi_response::code] =
+ mobile_result::SUCCESS;
+ Event event(hmi_apis::FunctionID::Navigation_UnsubscribeWayPoints);
+ event.set_smart_object(*event_msg);
+
+ EXPECT_CALL(*mock_app, app_id()).WillOnce(Return(kAppId));
+
+ EXPECT_CALL(app_mngr_, UnsubscribeAppFromWayPoints(kAppId));
+
+ EXPECT_CALL(
+ app_mngr_,
+ ManageMobileCommand(MobileResultCodeIs(mobile_result::SUCCESS), _));
+
+ command_->on_event(event);
+}
+
+} // namespace mobile_commands_test
+} // namespace commands_test
+} // namespace components
+} // namespace test
diff --git a/src/components/application_manager/test/commands/mobile/update_turn_list_request_test.cc b/src/components/application_manager/test/commands/mobile/update_turn_list_request_test.cc
new file mode 100644
index 0000000000..21bce689a5
--- /dev/null
+++ b/src/components/application_manager/test/commands/mobile/update_turn_list_request_test.cc
@@ -0,0 +1,314 @@
+/*
+ * Copyright (c) 2016, 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 "mobile/update_turn_list_request.h"
+#include "interfaces/MOBILE_API.h"
+#include "utils/shared_ptr.h"
+#include "smart_objects/smart_object.h"
+#include "commands/commands_test.h"
+#include "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/mock_hmi_capabilities.h"
+#include "application_manager/policies/mock_policy_handler_interface.h"
+#include "application_manager/smart_object_keys.h"
+#include "application_manager/event_engine/event.h"
+
+namespace test {
+namespace components {
+namespace commands_test {
+namespace mobile_commands_test {
+
+namespace am = ::application_manager;
+namespace mobile_result = mobile_apis::Result;
+
+using ::testing::_;
+using ::testing::Return;
+using ::testing::ReturnRef;
+using ::testing::Ref;
+using ::testing::Eq;
+
+using am::commands::UpdateTurnListRequest;
+using am::commands::MessageSharedPtr;
+using application_manager_test::MockHMICapabilities;
+
+namespace {
+const uint32_t kConnectionKey = 3u;
+const hmi_apis::FunctionID::eType kFunctionId =
+ hmi_apis::FunctionID::Buttons_OnButtonEvent;
+const uint32_t kAppId = 5u;
+} // namespace
+
+class UpdateTurnListRequestTest
+ : public CommandRequestTest<CommandsTestMocks::kIsNice> {
+ public:
+ UpdateTurnListRequestTest()
+ : mock_message_helper_(*am::MockMessageHelper::message_helper_mock())
+ , command_msg_(CreateMessage(smart_objects::SmartType_Map))
+ , command_(CreateCommand<UpdateTurnListRequest>(command_msg_)) {
+ (*command_msg_)[am::strings::params][am::strings::connection_key] =
+ kConnectionKey;
+ (*command_msg_)[am::strings::params][am::strings::function_id] =
+ kFunctionId;
+ }
+
+ am::MockMessageHelper& mock_message_helper_;
+ MessageSharedPtr command_msg_;
+ ::utils::SharedPtr<UpdateTurnListRequest> command_;
+ TypeIf<kMocksAreNice,
+ NiceMock<policy_test::MockPolicyHandlerInterface>,
+ policy_test::MockPolicyHandlerInterface>::Result mock_policy_handler_;
+};
+
+TEST_F(UpdateTurnListRequestTest, Run_ApplicationIsNotRegistered_UNSUCCESS) {
+ EXPECT_CALL(app_mngr_, application(kConnectionKey))
+ .WillOnce(Return(ApplicationSharedPtr()));
+
+ EXPECT_CALL(
+ app_mngr_,
+ ManageMobileCommand(
+ MobileResultCodeIs(mobile_result::APPLICATION_NOT_REGISTERED), _));
+
+ command_->Run();
+}
+
+TEST_F(UpdateTurnListRequestTest, Run_InvalidNavigationText_UNSUCCESS) {
+ (*command_msg_)[am::strings::msg_params][am::strings::turn_list][0]
+ [am::strings::navigation_text] = "invalid_navigation_text\t\n";
+
+ MockAppPtr mock_app(CreateMockApp());
+ EXPECT_CALL(app_mngr_, application(kConnectionKey))
+ .WillOnce(Return(mock_app));
+
+ EXPECT_CALL(
+ app_mngr_,
+ ManageMobileCommand(MobileResultCodeIs(mobile_result::INVALID_DATA), _));
+
+ command_->Run();
+}
+
+TEST_F(UpdateTurnListRequestTest, Run_InvalidTurnIcon_UNSUCCESS) {
+ (*command_msg_)[am::strings::msg_params][am::strings::turn_list][0]
+ [am::strings::navigation_text] = "valid_navigation_text";
+ (*command_msg_)[am::strings::msg_params][am::strings::turn_list][0]
+ [am::strings::turn_icon][am::strings::value] =
+ "invalid_turn_icon\t\n";
+
+ MockAppPtr mock_app(CreateMockApp());
+ EXPECT_CALL(app_mngr_, application(kConnectionKey))
+ .WillOnce(Return(mock_app));
+
+ EXPECT_CALL(
+ app_mngr_,
+ ManageMobileCommand(MobileResultCodeIs(mobile_result::INVALID_DATA), _));
+
+ command_->Run();
+}
+
+TEST_F(UpdateTurnListRequestTest,
+ Run_ProcessSoftButtonsNotSucceeded_UNSUCCESS) {
+ (*command_msg_)[am::strings::msg_params][am::strings::turn_list][0]
+ [am::strings::navigation_text] = "valid_navigation_text";
+ (*command_msg_)[am::strings::msg_params][am::strings::turn_list][0]
+ [am::strings::turn_icon][am::strings::value] =
+ "valid_turn_icon";
+
+ MockAppPtr mock_app(CreateMockApp());
+ EXPECT_CALL(app_mngr_, application(kConnectionKey))
+ .WillOnce(Return(mock_app));
+
+ EXPECT_CALL(app_mngr_, GetPolicyHandler())
+ .WillOnce(ReturnRef(mock_policy_handler_));
+
+ const mobile_result::eType kExpectedResult = mobile_result::INVALID_ENUM;
+ EXPECT_CALL(mock_message_helper_,
+ ProcessSoftButtons((*command_msg_)[am::strings::msg_params],
+ Eq(mock_app),
+ Ref(mock_policy_handler_),
+ Ref(app_mngr_)))
+ .WillOnce(Return(kExpectedResult));
+
+ EXPECT_CALL(app_mngr_,
+ ManageMobileCommand(MobileResultCodeIs(kExpectedResult), _));
+
+ command_->Run();
+}
+
+TEST_F(UpdateTurnListRequestTest, Run_NoTurnList_UNSUCCESS) {
+ MockAppPtr mock_app(CreateMockApp());
+ EXPECT_CALL(app_mngr_, application(kConnectionKey))
+ .WillOnce(Return(mock_app));
+
+ EXPECT_CALL(app_mngr_, GetPolicyHandler())
+ .WillOnce(ReturnRef(mock_policy_handler_));
+
+ EXPECT_CALL(mock_message_helper_,
+ ProcessSoftButtons((*command_msg_)[am::strings::msg_params],
+ Eq(mock_app),
+ Ref(mock_policy_handler_),
+ Ref(app_mngr_)))
+ .WillOnce(Return(mobile_result::SUCCESS));
+
+ EXPECT_CALL(
+ app_mngr_,
+ ManageMobileCommand(MobileResultCodeIs(mobile_result::INVALID_DATA), _));
+
+ command_->Run();
+}
+
+TEST_F(UpdateTurnListRequestTest, Run_ValidTurnList_SUCCESS) {
+ const std::string kNavigationText = "valid_navigation_text";
+
+ (*command_msg_)[am::strings::msg_params][am::strings::turn_list][0]
+ [am::strings::navigation_text] = kNavigationText;
+ (*command_msg_)[am::strings::msg_params][am::strings::turn_list][0]
+ [am::strings::turn_icon][am::strings::value] =
+ "valid_turn_icon";
+ (*command_msg_)[am::strings::msg_params][am::strings::soft_buttons] = 0;
+
+ MockAppPtr mock_app(CreateMockApp());
+ EXPECT_CALL(app_mngr_, application(kConnectionKey))
+ .WillOnce(Return(mock_app));
+
+ EXPECT_CALL(app_mngr_, GetPolicyHandler())
+ .WillOnce(ReturnRef(mock_policy_handler_));
+
+ EXPECT_CALL(mock_message_helper_,
+ ProcessSoftButtons((*command_msg_)[am::strings::msg_params],
+ Eq(mock_app),
+ Ref(mock_policy_handler_),
+ Ref(app_mngr_)))
+ .WillOnce(Return(mobile_result::SUCCESS));
+
+ EXPECT_CALL(
+ mock_message_helper_,
+ VerifyImage(
+ (*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));
+
+ EXPECT_CALL(mock_message_helper_,
+ SubscribeApplicationToSoftButton(_, _, kFunctionId));
+
+ MessageSharedPtr result_msg(CatchHMICommandResult(CallRun(*command_)));
+ ASSERT_TRUE(result_msg);
+ EXPECT_EQ(
+ hmi_apis::FunctionID::Navigation_UpdateTurnList,
+ (*result_msg)[am::strings::params][am::strings::function_id].asInt());
+
+ ASSERT_TRUE((*result_msg)[am::strings::msg_params][am::strings::turn_list][0]
+ .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));
+ EXPECT_EQ(
+ hmi_apis::Common_TextFieldName::turnText,
+ (*result_msg)[am::strings::msg_params][am::strings::turn_list][0]
+ [am::hmi_request::navi_text][am::hmi_request::field_name]
+ .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));
+ EXPECT_EQ(
+ kNavigationText,
+ (*result_msg)[am::strings::msg_params][am::strings::turn_list][0]
+ [am::hmi_request::navi_text][am::hmi_request::field_text]
+ .asString());
+}
+
+TEST_F(UpdateTurnListRequestTest, OnEvent_UnknownEvent_UNSUCCESS) {
+ Event event(hmi_apis::FunctionID::INVALID_ENUM);
+
+ EXPECT_CALL(app_mngr_, ManageMobileCommand(_, _)).Times(0);
+
+ command_->on_event(event);
+}
+
+TEST_F(UpdateTurnListRequestTest, OnEvent_UnsupportedResource_SUCCESS) {
+ MessageSharedPtr event_msg(CreateMessage(smart_objects::SmartType_Map));
+ (*event_msg)[am::strings::params][am::hmi_response::code] =
+ mobile_result::UNSUPPORTED_RESOURCE;
+ (*event_msg)[am::strings::msg_params] = 0;
+
+ Event event(hmi_apis::FunctionID::Navigation_UpdateTurnList);
+ event.set_smart_object(*event_msg);
+
+ MockHMICapabilities mock_hmi_capabilities;
+ EXPECT_CALL(app_mngr_, hmi_capabilities())
+ .WillOnce(ReturnRef(mock_hmi_capabilities));
+
+ EXPECT_CALL(mock_hmi_capabilities, is_ui_cooperating())
+ .WillOnce(Return(true));
+
+ EXPECT_CALL(app_mngr_,
+ ManageMobileCommand(
+ MobileResultCodeIs(mobile_result::UNSUPPORTED_RESOURCE), _));
+
+ command_->on_event(event);
+}
+
+TEST_F(UpdateTurnListRequestTest,
+ OnEvent_ReceivedNavigationUpdateTurnListEvent_SUCCESS) {
+ MessageSharedPtr event_msg(CreateMessage(smart_objects::SmartType_Map));
+ (*event_msg)[am::strings::params][am::hmi_response::code] =
+ mobile_result::SUCCESS;
+ (*event_msg)[am::strings::msg_params] = 0;
+
+ Event event(hmi_apis::FunctionID::Navigation_UpdateTurnList);
+ event.set_smart_object(*event_msg);
+
+ MockHMICapabilities mock_hmi_capabilities;
+ EXPECT_CALL(app_mngr_, hmi_capabilities())
+ .WillOnce(ReturnRef(mock_hmi_capabilities));
+
+ EXPECT_CALL(mock_hmi_capabilities, is_ui_cooperating()).Times(0);
+
+ EXPECT_CALL(
+ app_mngr_,
+ ManageMobileCommand(MobileResultCodeIs(mobile_result::SUCCESS), _));
+
+ command_->on_event(event);
+}
+
+} // namespace mobile_commands_test
+} // namespace commands_test
+} // namespace components
+} // namespace test
diff --git a/src/components/application_manager/test/include/application_manager/commands/command_request_test.h b/src/components/application_manager/test/include/application_manager/commands/command_request_test.h
new file mode 100644
index 0000000000..d4cca96431
--- /dev/null
+++ b/src/components/application_manager/test/include/application_manager/commands/command_request_test.h
@@ -0,0 +1,141 @@
+/*
+ * Copyright (c) 2016, 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.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_TEST_INCLUDE_APPLICATION_MANAGER_COMMAND_RESPONSES_TEST_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_TEST_INCLUDE_APPLICATION_MANAGER_COMMAND_RESPONSES_TEST_H_
+
+#include <stdint.h>
+
+#include "gtest/gtest.h"
+#include "utils/shared_ptr.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_impl.h"
+#include "application_manager/mock_event_dispatcher.h"
+#include "application_manager/event_engine/event.h"
+
+namespace test {
+namespace components {
+namespace commands_test {
+
+using ::testing::_;
+using ::testing::Return;
+using ::testing::SaveArg;
+using ::testing::DoAll;
+using ::testing::NiceMock;
+using ::test::components::event_engine_test::MockEventDispatcher;
+namespace am = ::application_manager;
+using am::commands::Command;
+using am::commands::CommandRequestImpl;
+using am::event_engine::Event;
+
+class CallRun {
+ public:
+ CallRun(CommandRequestImpl& command) : command_(command) {}
+
+ void operator()() {
+ command_.Run();
+ }
+
+ CommandRequestImpl& command_;
+};
+
+class CallOnEvent {
+ public:
+ CallOnEvent(CommandRequestImpl& command, Event& event)
+ : command_(command), event_(event) {}
+
+ void operator()() {
+ command_.on_event(event_);
+ }
+
+ CommandRequestImpl& command_;
+ Event& event_;
+};
+
+template <const CommandsTestMocks kIsNice = CommandsTestMocks::kNotNice>
+class CommandRequestTest : public CommandsTest<kIsNice> {
+ public:
+ typedef typename TypeIf<kIsNice,
+ NiceMock<MockEventDispatcher>,
+ MockEventDispatcher>::Result MockEventDisp;
+
+ template <class CallableT>
+ MessageSharedPtr CatchMobileCommandResult(CallableT delegate,
+ bool call_return = true) {
+ MessageSharedPtr result_msg;
+ EXPECT_CALL(this->app_mngr_, ManageMobileCommand(_, _))
+ .WillOnce(DoAll(SaveArg<0>(&result_msg), Return(call_return)));
+ delegate();
+ return result_msg;
+ }
+
+ template <class CallableT>
+ MessageSharedPtr CatchHMICommandResult(CallableT delegate,
+ bool call_return = true) {
+ MessageSharedPtr result_msg;
+ EXPECT_CALL(this->app_mngr_, ManageHMICommand(_))
+ .WillOnce(DoAll(SaveArg<0>(&result_msg), Return(call_return)));
+ delegate();
+ return result_msg;
+ }
+
+ MockEventDisp event_dispatcher_;
+
+ protected:
+ CommandRequestTest() : CommandsTest<kIsNice>() {}
+
+ virtual void InitCommand(const uint32_t& default_timeout) OVERRIDE {
+ CommandsTest<kIsNice>::InitCommand(default_timeout);
+ ON_CALL(CommandsTest<kIsNice>::app_mngr_, event_dispatcher())
+ .WillByDefault(ReturnRef(event_dispatcher_));
+ }
+};
+
+MATCHER_P(MobileResultCodeIs, result_code, "") {
+ return result_code ==
+ static_cast<mobile_apis::Result::eType>(
+ (*arg)[am::strings::msg_params][am::strings::result_code].asInt());
+}
+
+MATCHER_P(HMIResultCodeIs, result_code, "") {
+ return result_code ==
+ static_cast<hmi_apis::FunctionID::eType>(
+ (*arg)[am::strings::params][am::strings::function_id].asInt());
+}
+
+} // namespace commands_test
+} // namespace components
+} // namespace test
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_TEST_INCLUDE_APPLICATION_MANAGER_COMMAND_RESPONSES_TEST_H_
diff --git a/src/components/application_manager/test/include/application_manager/commands/commands_test.h b/src/components/application_manager/test/include/application_manager/commands/commands_test.h
new file mode 100644
index 0000000000..260f1abe3e
--- /dev/null
+++ b/src/components/application_manager/test/include/application_manager/commands/commands_test.h
@@ -0,0 +1,144 @@
+/*
+ * Copyright (c) 2016, 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.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_TEST_INCLUDE_APPLICATION_MANAGER_COMMANDS_TEST_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_TEST_INCLUDE_APPLICATION_MANAGER_COMMANDS_TEST_H_
+
+#include <stdint.h>
+#include "gtest/gtest.h"
+
+#include "utils/shared_ptr.h"
+#include "smart_objects/smart_object.h"
+#include "application_manager/commands/command.h"
+#include "utils/make_shared.h"
+#include "application_manager/mock_application_manager.h"
+#include "test/application_manager/mock_application_manager_settings.h"
+#include "application_manager/mock_application.h"
+
+namespace test {
+namespace components {
+namespace commands_test {
+
+using ::testing::ReturnRef;
+using ::testing::NiceMock;
+
+using ::utils::SharedPtr;
+using ::smart_objects::SmartObject;
+using ::application_manager::commands::MessageSharedPtr;
+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;
+
+// Depending on the value type will be selected
+template <const bool kIf, class ThenT, class ElseT>
+struct TypeIf {
+ typedef ThenT Result;
+};
+template <class ThenT, class ElseT>
+struct TypeIf<false, ThenT, ElseT> {
+ typedef ElseT Result;
+};
+
+// If `kIsNice` is `true` then all used mock types
+// will be wrapped by a `NiceMock`
+
+enum CommandsTestMocks { kNotNice = 0, kIsNice };
+
+template <const CommandsTestMocks kIsNice = CommandsTestMocks::kNotNice>
+class CommandsTest : public ::testing::Test {
+ public:
+ enum { kMocksAreNice = kIsNice };
+
+ typedef NiceMock<MockApplicationManagerSettings> MockAppManagerSettings;
+ typedef typename TypeIf<kIsNice,
+ NiceMock<MockApplicationManager>,
+ MockApplicationManager>::Result MockAppManager;
+ typedef typename TypeIf<kIsNice,
+ NiceMock<MockApplication>,
+ MockApplication>::Result MockApp;
+
+ typedef SharedPtr<MockApp> MockAppPtr;
+
+ virtual ~CommandsTest() {}
+
+ static MessageSharedPtr CreateMessage(
+ const smart_objects::SmartType type = smart_objects::SmartType_Null) {
+ return ::utils::MakeShared<SmartObject>(type);
+ }
+
+ static MockAppPtr CreateMockApp() {
+ return ::utils::MakeShared<MockApp>();
+ }
+
+ template <class Command>
+ SharedPtr<Command> CreateCommand(const uint32_t timeout,
+ MessageSharedPtr& msg) {
+ InitCommand(timeout);
+ return ::utils::MakeShared<Command>((msg ? msg : msg = CreateMessage()),
+ app_mngr_);
+ }
+
+ template <class Command>
+ SharedPtr<Command> CreateCommand(MessageSharedPtr& msg) {
+ return CreateCommand<Command>(kDefaultTimeout_, msg);
+ }
+
+ template <class Command>
+ SharedPtr<Command> CreateCommand(const uint32_t timeout = kDefaultTimeout_) {
+ InitCommand(timeout);
+ MessageSharedPtr msg = CreateMessage();
+ return ::utils::MakeShared<Command>(msg, app_mngr_);
+ }
+
+ enum { kDefaultTimeout_ = 100 };
+
+ MockAppManager app_mngr_;
+ MockAppManagerSettings app_mngr_settings_;
+
+ protected:
+ virtual void InitCommand(const uint32_t& timeout) {
+ EXPECT_CALL(app_mngr_, get_settings())
+ .WillOnce(ReturnRef(app_mngr_settings_));
+ ON_CALL(app_mngr_settings_, default_timeout())
+ .WillByDefault(ReturnRef(timeout));
+ }
+
+ CommandsTest() {}
+};
+
+} // namespace commands_test
+} // namespace components
+} // namespace test
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_TEST_INCLUDE_APPLICATION_MANAGER_COMMANDS_TEST_H_
diff --git a/src/components/application_manager/test/include/application_manager/mock_application.h b/src/components/application_manager/test/include/application_manager/mock_application.h
index a6f86eafa0..f57ce53e38 100644
--- a/src/components/application_manager/test/include/application_manager/mock_application.h
+++ b/src/components/application_manager/test/include/application_manager/mock_application.h
@@ -143,7 +143,7 @@ class MockApplication : public ::application_manager::Application {
MOCK_CONST_METHOD1(IsSubscribedToIVI, bool(uint32_t vehicle_info_type));
MOCK_METHOD1(UnsubscribeFromIVI, bool(uint32_t vehicle_info_type));
MOCK_METHOD0(ResetDataInNone, void());
- MOCK_METHOD2(IsCommandLimitsExceeded,
+ MOCK_METHOD2(AreCommandLimitsExceeded,
bool(mobile_apis::FunctionID::eType cmd_id,
::application_manager::TLimitSource source));
MOCK_METHOD0(usage_report, ::application_manager::UsageStatistics&());
diff --git a/src/components/application_manager/test/include/application_manager/mock_hmi_capabilities.h b/src/components/application_manager/test/include/application_manager/mock_hmi_capabilities.h
new file mode 100644
index 0000000000..0309435b06
--- /dev/null
+++ b/src/components/application_manager/test/include/application_manager/mock_hmi_capabilities.h
@@ -0,0 +1,177 @@
+/*
+ * Copyright (c) 2016, 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.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_TEST_INCLUDE_APPLICATION_MANAGER_MOCK_HMI_CAPABILITIES_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_TEST_INCLUDE_APPLICATION_MANAGER_MOCK_HMI_CAPABILITIES_H_
+
+#include <stdint.h>
+
+#include "application_manager/hmi_capabilities.h"
+#include "gmock/gmock.h"
+
+namespace test {
+namespace components {
+namespace application_manager_test {
+
+class MockHMICapabilities : public ::application_manager::HMICapabilities {
+ public:
+ MOCK_CONST_METHOD0(is_hmi_capabilities_initialized, bool());
+ MOCK_CONST_METHOD1(VerifyImageType, bool(const int32_t image_type));
+
+ MOCK_CONST_METHOD0(is_vr_cooperating, bool());
+ MOCK_METHOD1(set_is_vr_cooperating, void(const bool value));
+
+ MOCK_CONST_METHOD0(is_tts_cooperating, bool());
+ MOCK_METHOD1(set_is_tts_cooperating, void(const bool value));
+
+ MOCK_CONST_METHOD0(is_ui_cooperating, bool());
+ MOCK_METHOD1(set_is_ui_cooperating, void(const bool value));
+
+ MOCK_CONST_METHOD0(is_navi_cooperating, bool());
+ MOCK_METHOD1(set_is_navi_cooperating, void(const bool value));
+
+ MOCK_CONST_METHOD0(is_ivi_cooperating, bool());
+ MOCK_METHOD1(set_is_ivi_cooperating, void(const bool value));
+
+ MOCK_CONST_METHOD0(attenuated_supported, bool());
+
+ MOCK_METHOD1(set_attenuated_supported, void(const bool state));
+
+ MOCK_CONST_METHOD0(active_ui_language,
+ const hmi_apis::Common_Language::eType());
+
+ MOCK_METHOD1(set_active_ui_language,
+ void(const hmi_apis::Common_Language::eType language));
+
+ MOCK_CONST_METHOD0(ui_supported_languages,
+ const smart_objects::SmartObject*());
+ MOCK_METHOD1(set_ui_supported_languages,
+ void(const smart_objects::SmartObject& supported_languages));
+
+ MOCK_CONST_METHOD0(active_vr_language,
+ const hmi_apis::Common_Language::eType());
+ MOCK_METHOD1(set_active_vr_language,
+ void(const hmi_apis::Common_Language::eType language));
+
+ MOCK_CONST_METHOD0(vr_supported_languages,
+ const smart_objects::SmartObject*());
+ MOCK_METHOD1(set_vr_supported_languages,
+ void(const smart_objects::SmartObject& supported_languages));
+
+ MOCK_CONST_METHOD0(active_tts_language,
+ const hmi_apis::Common_Language::eType());
+ MOCK_METHOD1(set_active_tts_language,
+ void(const hmi_apis::Common_Language::eType language));
+
+ MOCK_CONST_METHOD0(tts_supported_languages,
+ const smart_objects::SmartObject*());
+ MOCK_METHOD1(set_tts_supported_languages,
+ void(const smart_objects::SmartObject& supported_languages));
+
+ MOCK_CONST_METHOD0(display_capabilities, const smart_objects::SmartObject*());
+ MOCK_METHOD1(set_display_capabilities,
+ void(const smart_objects::SmartObject& display_capabilities));
+
+ MOCK_CONST_METHOD0(hmi_zone_capabilities,
+ const smart_objects::SmartObject*());
+ MOCK_METHOD1(set_hmi_zone_capabilities,
+ void(const smart_objects::SmartObject& hmi_zone_capabilities));
+
+ MOCK_CONST_METHOD0(soft_button_capabilities,
+ const smart_objects::SmartObject*());
+ MOCK_METHOD1(
+ set_soft_button_capabilities,
+ void(const smart_objects::SmartObject& soft_button_capabilities));
+
+ MOCK_CONST_METHOD0(button_capabilities, const smart_objects::SmartObject*());
+ MOCK_METHOD1(set_button_capabilities,
+ void(const smart_objects::SmartObject& button_capabilities));
+
+ MOCK_CONST_METHOD0(speech_capabilities, const smart_objects::SmartObject*());
+ MOCK_METHOD1(set_speech_capabilities,
+ void(const smart_objects::SmartObject& speech_capabilities));
+
+ MOCK_CONST_METHOD0(vr_capabilities, const smart_objects::SmartObject*());
+ MOCK_METHOD1(set_vr_capabilities,
+ void(const smart_objects::SmartObject& vr_capabilities));
+
+ MOCK_CONST_METHOD0(audio_pass_thru_capabilities,
+ const smart_objects::SmartObject*());
+ MOCK_METHOD1(
+ set_audio_pass_thru_capabilities,
+ void(const smart_objects::SmartObject& audio_pass_thru_capabilities));
+
+ MOCK_CONST_METHOD0(pcm_stream_capabilities,
+ const smart_objects::SmartObject*());
+ MOCK_METHOD1(set_pcm_stream_capabilities,
+ void(const smart_objects::SmartObject& pcm_stream_capabilities));
+
+ MOCK_CONST_METHOD0(preset_bank_capabilities,
+ const smart_objects::SmartObject*());
+ MOCK_METHOD1(
+ set_preset_bank_capabilities,
+ void(const smart_objects::SmartObject& preset_bank_capabilities));
+
+ MOCK_CONST_METHOD0(vehicle_type, const smart_objects::SmartObject*());
+ MOCK_METHOD1(set_vehicle_type,
+ void(const smart_objects::SmartObject& vehicle_type));
+
+ MOCK_CONST_METHOD0(prerecorded_speech, const smart_objects::SmartObject*());
+ MOCK_METHOD1(set_prerecorded_speech,
+ void(const smart_objects::SmartObject& prerecorded_speech));
+
+ MOCK_CONST_METHOD0(navigation_supported, bool());
+ MOCK_METHOD1(set_navigation_supported, void(const bool supported));
+
+ MOCK_CONST_METHOD0(phone_call_supported, bool());
+ MOCK_METHOD1(set_phone_call_supported, void(const bool supported));
+
+ MOCK_METHOD1(Init, void(resumption::LastState* last_state));
+
+ MOCK_CONST_METHOD0(ccpu_version, const std::string&());
+ MOCK_METHOD1(set_ccpu_version, void(const std::string& ccpu_version));
+
+ protected:
+ MOCK_CONST_METHOD2(check_existing_json_member,
+ bool(const Json::Value& json_member,
+ const char* name_of_member));
+
+ MOCK_CONST_METHOD2(convert_json_languages_to_obj,
+ void(const Json::Value& json_languages,
+ smart_objects::SmartObject& languages));
+};
+
+} // namespace application_manager_test
+} // namespace components
+} // namespace test
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_TEST_INCLUDE_APPLICATION_MANAGER_MOCK_HMI_CAPABILITIES_H_
diff --git a/src/components/application_manager/test/include/application_manager/mock_message_helper.h b/src/components/application_manager/test/include/application_manager/mock_message_helper.h
index 289b20a105..964e037d84 100644
--- a/src/components/application_manager/test/include/application_manager/mock_message_helper.h
+++ b/src/components/application_manager/test/include/application_manager/mock_message_helper.h
@@ -34,6 +34,7 @@
#define SRC_COMPONENTS_APPLICATION_MANAGER_TEST_MOCK_MESSAGE_HELPER_H_
#include "gmock/gmock.h"
#include "application_manager/application.h"
+#include "application_manager/message_helper.h"
#include "interfaces/HMI_API.h"
#include "policy/policy_types.h"
#include "application_manager/policies/policy_handler_interface.h"
@@ -151,9 +152,13 @@ class MockMessageHelper {
smart_objects::SmartObjectList(ApplicationSharedPtr app));
MOCK_METHOD3(VerifyImageFiles,
mobile_apis::Result::eType(smart_objects::SmartObject& message,
-
ApplicationConstSharedPtr app,
ApplicationManager& app_mngr));
+ MOCK_METHOD3(VerifyImage,
+ mobile_apis::Result::eType(smart_objects::SmartObject& message,
+ ApplicationConstSharedPtr app,
+ ApplicationManager& app_mngr));
+
MOCK_METHOD6(GetBCActivateAppRequestToHMI,
smart_objects::SmartObjectSPtr(
ApplicationConstSharedPtr app,
@@ -166,6 +171,78 @@ class MockMessageHelper {
NsSmartDeviceLink::NsSmartObjects::SmartObjectSPtr(
int32_t connection_key,
mobile_apis::AppInterfaceUnregisteredReason::eType reason));
+ MOCK_METHOD4(ProcessSoftButtons,
+ mobile_apis::Result::eType(
+ smart_objects::SmartObject& message_params,
+ ApplicationConstSharedPtr app,
+ const policy::PolicyHandlerInterface& policy_handler,
+ ApplicationManager& app_mngr));
+ MOCK_METHOD3(SubscribeApplicationToSoftButton,
+ void(smart_objects::SmartObject& message_params,
+ ApplicationSharedPtr app,
+ int32_t function_id));
+ MOCK_METHOD4(CreateNegativeResponse,
+ smart_objects::SmartObjectSPtr(uint32_t connection_key,
+ int32_t function_id,
+ const uint32_t correlation_id,
+ int32_t result_code));
+ MOCK_METHOD4(
+ CreateBlockedByPoliciesResponse,
+ smart_objects::SmartObjectSPtr(mobile_apis::FunctionID::eType function_id,
+ mobile_apis::Result::eType result,
+ const uint32_t correlation_id,
+ uint32_t connection_key));
+ MOCK_METHOD0(vehicle_data, const VehicleData&());
+ MOCK_METHOD1(SendStopAudioPathThru, bool(ApplicationManager& app_mngr));
+ MOCK_METHOD1(StringifiedFunctionID,
+ std::string(const mobile_apis::FunctionID::eType function_id));
+ MOCK_METHOD2(SendUIChangeRegistrationRequestToHMI,
+ void(ApplicationConstSharedPtr app,
+ ApplicationManager& app_mngr));
+ MOCK_METHOD5(CreateHMIApplicationStruct,
+ bool(ApplicationConstSharedPtr app,
+ const protocol_handler::SessionObserver& session_observer,
+ const policy::PolicyHandlerInterface& policy_handler,
+ smart_objects::SmartObject* output,
+ ApplicationManager& app_mngr));
+ MOCK_METHOD3(SendOnAppUnregNotificationToHMI,
+ void(ApplicationConstSharedPtr app,
+ const bool is_unexpected_disconnect,
+ ApplicationManager& app_mngr));
+ MOCK_METHOD4(SendLaunchApp,
+ void(const uint32_t connection_key,
+ const std::string& urlSchema,
+ const std::string& packageName,
+ ApplicationManager& app_man));
+ MOCK_METHOD1(SendUnsubscribedWayPoints, bool(ApplicationManager& app_mngr));
+
+ MOCK_METHOD2(SendQueryApps,
+ void(const uint32_t connection_key,
+ ApplicationManager& app_man));
+ MOCK_METHOD1(CreateAppVrHelp,
+ smart_objects::SmartObjectSPtr(ApplicationConstSharedPtr app));
+ MOCK_METHOD3(VerifyImageVrHelpItems,
+ mobile_apis::Result::eType(smart_objects::SmartObject& message,
+ ApplicationConstSharedPtr app,
+ ApplicationManager& app_mngr));
+ MOCK_METHOD2(SendChangeRegistrationRequestToHMI,
+ void(ApplicationConstSharedPtr app,
+ ApplicationManager& app_mngr));
+
+ MOCK_METHOD1(GetPriorityCode, const uint32_t(const std::string& priority));
+
+ MOCK_METHOD1(PrintSmartObject,
+ bool(const smart_objects::SmartObject& object));
+ MOCK_METHOD3(SendTTSGlobalProperties,
+ void(ApplicationSharedPtr app,
+ const bool default_help_prompt,
+ ApplicationManager& app_man));
+ MOCK_METHOD3(SendSetAppIcon,
+ void(const uint32_t app_id,
+ const std::string& icon_path,
+ ApplicationManager& application_manager));
+ MOCK_METHOD1(StringifiedHMILevel,
+ std::string(const mobile_apis::HMILevel::eType hmi_level));
static MockMessageHelper* message_helper_mock();
};
diff --git a/src/components/application_manager/test/mock_message_helper.cc b/src/components/application_manager/test/mock_message_helper.cc
index c53927d3a4..607349e585 100644
--- a/src/components/application_manager/test/mock_message_helper.cc
+++ b/src/components/application_manager/test/mock_message_helper.cc
@@ -269,6 +269,14 @@ smart_objects::SmartObjectList MessageHelper::GetIVISubscriptionRequests(
app);
}
+mobile_apis::Result::eType MessageHelper::VerifyImage(
+ smart_objects::SmartObject& message,
+ ApplicationConstSharedPtr app,
+ ApplicationManager& app_mngr) {
+ return MockMessageHelper::message_helper_mock()->VerifyImage(
+ message, app, app_mngr);
+}
+
mobile_apis::Result::eType MessageHelper::VerifyImageFiles(
smart_objects::SmartObject& message,
ApplicationConstSharedPtr app,
@@ -276,6 +284,7 @@ mobile_apis::Result::eType MessageHelper::VerifyImageFiles(
return MockMessageHelper::message_helper_mock()->VerifyImageFiles(
message, app, app_mngr);
}
+
std::string MessageHelper::CommonLanguageToString(
hmi_apis::Common_Language::eType lang) {
return MockMessageHelper::message_helper_mock()->CommonLanguageToString(lang);
@@ -306,4 +315,145 @@ MessageHelper::GetOnAppInterfaceUnregisteredNotificationToMobile(
reason);
}
+mobile_apis::Result::eType MessageHelper::ProcessSoftButtons(
+ smart_objects::SmartObject& message_params,
+ ApplicationConstSharedPtr app,
+ const policy::PolicyHandlerInterface& policy_handler,
+ ApplicationManager& app_mngr) {
+ return MockMessageHelper::message_helper_mock()->ProcessSoftButtons(
+ message_params, app, policy_handler, app_mngr);
+}
+
+void MessageHelper::SubscribeApplicationToSoftButton(
+ smart_objects::SmartObject& message_params,
+ ApplicationSharedPtr app,
+ int32_t function_id) {
+ return MockMessageHelper::message_helper_mock()
+ ->SubscribeApplicationToSoftButton(message_params, app, function_id);
+}
+
+smart_objects::SmartObjectSPtr MessageHelper::CreateNegativeResponse(
+ uint32_t connection_key,
+ int32_t function_id,
+ const uint32_t correlation_id,
+ int32_t result_code) {
+ return MockMessageHelper::message_helper_mock()->CreateNegativeResponse(
+ connection_key, function_id, correlation_id, result_code);
+}
+
+smart_objects::SmartObjectSPtr MessageHelper::CreateBlockedByPoliciesResponse(
+ mobile_apis::FunctionID::eType function_id,
+ mobile_apis::Result::eType result,
+ const uint32_t correlation_id,
+ uint32_t connection_key) {
+ return MockMessageHelper::message_helper_mock()
+ ->CreateBlockedByPoliciesResponse(
+ function_id, result, correlation_id, connection_key);
+}
+
+const VehicleData& MessageHelper::vehicle_data() {
+ return MockMessageHelper::message_helper_mock()->vehicle_data();
+}
+
+bool MessageHelper::SendStopAudioPathThru(ApplicationManager& app_mngr) {
+ return MockMessageHelper::message_helper_mock()->SendStopAudioPathThru(
+ app_mngr);
+}
+
+std::string MessageHelper::StringifiedFunctionID(
+ const mobile_apis::FunctionID::eType function_id) {
+ return MockMessageHelper::message_helper_mock()->StringifiedFunctionID(
+ function_id);
+}
+
+void MessageHelper::SendUIChangeRegistrationRequestToHMI(
+ ApplicationConstSharedPtr app, ApplicationManager& app_mngr) {
+ MockMessageHelper::message_helper_mock()
+ ->SendUIChangeRegistrationRequestToHMI(app, app_mngr);
+}
+
+bool MessageHelper::CreateHMIApplicationStruct(
+ ApplicationConstSharedPtr app,
+ const protocol_handler::SessionObserver& session_observer,
+ const policy::PolicyHandlerInterface& policy_handler,
+ smart_objects::SmartObject* output,
+ ApplicationManager& app_mngr) {
+ return MockMessageHelper::message_helper_mock()->CreateHMIApplicationStruct(
+ app, session_observer, policy_handler, output, app_mngr);
+}
+
+void MessageHelper::SendOnAppUnregNotificationToHMI(
+ ApplicationConstSharedPtr app,
+ const bool is_unexpected_disconnect,
+ ApplicationManager& app_mngr) {
+ MockMessageHelper::message_helper_mock()->SendOnAppUnregNotificationToHMI(
+ app, is_unexpected_disconnect, app_mngr);
+}
+
+void MessageHelper::SendLaunchApp(const uint32_t connection_key,
+ const std::string& urlSchema,
+ const std::string& packageName,
+ ApplicationManager& app_man) {
+ MockMessageHelper::message_helper_mock()->SendLaunchApp(
+ connection_key, urlSchema, packageName, app_man);
+}
+
+bool MessageHelper::SendUnsubscribedWayPoints(ApplicationManager& app_mngr) {
+ return MockMessageHelper::message_helper_mock()->SendUnsubscribedWayPoints(
+ app_mngr);
+}
+
+void MessageHelper::SendQueryApps(const uint32_t connection_key,
+ ApplicationManager& app_man) {
+ MockMessageHelper::message_helper_mock()->SendQueryApps(connection_key,
+ app_man);
+}
+
+smart_objects::SmartObjectSPtr MessageHelper::CreateAppVrHelp(
+ ApplicationConstSharedPtr app) {
+ return MockMessageHelper::message_helper_mock()->CreateAppVrHelp(app);
+}
+
+mobile_apis::Result::eType MessageHelper::VerifyImageVrHelpItems(
+ smart_objects::SmartObject& message,
+ ApplicationConstSharedPtr app,
+ ApplicationManager& app_mngr) {
+ return MockMessageHelper::message_helper_mock()->VerifyImageVrHelpItems(
+ message, app, app_mngr);
+}
+
+void MessageHelper::SendChangeRegistrationRequestToHMI(
+ ApplicationConstSharedPtr app, ApplicationManager& app_mngr) {
+ MockMessageHelper::message_helper_mock()->SendChangeRegistrationRequestToHMI(
+ app, app_mngr);
+}
+
+const uint32_t MessageHelper::GetPriorityCode(const std::string& priority) {
+ return MockMessageHelper::message_helper_mock()->GetPriorityCode(priority);
+}
+
+void MessageHelper::SendTTSGlobalProperties(ApplicationSharedPtr app,
+ const bool default_help_prompt,
+ ApplicationManager& app_man) {
+ MockMessageHelper::message_helper_mock()->SendTTSGlobalProperties(
+ app, default_help_prompt, app_man);
+}
+
+bool MessageHelper::PrintSmartObject(const smart_objects::SmartObject& object) {
+ return MockMessageHelper::message_helper_mock()->PrintSmartObject(object);
+}
+
+void MessageHelper::SendSetAppIcon(const uint32_t app_id,
+ const std::string& icon_path,
+ ApplicationManager& application_manager) {
+ MockMessageHelper::message_helper_mock()->SendSetAppIcon(
+ app_id, icon_path, application_manager);
+}
+
+std::string MessageHelper::StringifiedHMILevel(
+ const mobile_apis::HMILevel::eType hmi_level) {
+ return MockMessageHelper::message_helper_mock()->StringifiedHMILevel(
+ hmi_level);
+}
+
} // namespace application_manager