diff options
author | Yana Chernysheva (GitHub) <59469418+ychernysheva@users.noreply.github.com> | 2020-10-23 17:59:35 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-23 10:59:35 -0400 |
commit | 3a9dd1a661bef9d013baa3fca6f9fcc25b596c54 (patch) | |
tree | 0c2b0598e134ba68ac239fe730626333278284c6 /src/components/application_manager/rpc_plugins | |
parent | 93d12eb664afd667379741fabda47d177893bbb9 (diff) | |
download | sdl_core-3a9dd1a661bef9d013baa3fca6f9fcc25b596c54.tar.gz |
Add missed NACK reasons (#3545)
* Add missed NACK reasons, update UTs and add minor changes
Diffstat (limited to 'src/components/application_manager/rpc_plugins')
2 files changed, 24 insertions, 29 deletions
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_set_video_config_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_set_video_config_request.cc index e4fbdaa0d6..ff9d861def 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_set_video_config_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_set_video_config_request.cc @@ -93,16 +93,15 @@ void NaviSetVideoConfigRequest::on_event(const event_engine::Event& event) { const hmi_apis::Common_Result::eType code = static_cast<hmi_apis::Common_Result::eType>( message[strings::params][hmi_response::code].asInt()); - bool result = false; - std::vector<std::string> rejected_params; if (code == hmi_apis::Common_Result::SUCCESS) { SDL_LOG_DEBUG("Received SetVideoConfig success response"); - result = true; + application_manager_.OnStreamingConfigurationSuccessful( + app->app_id(), protocol_handler::ServiceType::kMobileNav); } else { SDL_LOG_DEBUG("Received SetVideoConfig failure response (" << event.id() << ")"); - result = false; + std::vector<std::string> rejected_params; if (message[strings::msg_params].keyExists(strings::rejected_params)) { const smart_objects::SmartArray* list = message[strings::msg_params][strings::rejected_params].asArray(); @@ -118,13 +117,14 @@ void NaviSetVideoConfigRequest::on_event(const event_engine::Event& event) { } } } + + application_manager_.OnStreamingConfigurationFailed( + app->app_id(), + rejected_params, + "Received SetVideoConfig failure response"); + + break; } - application_manager_.OnStreamingConfigured( - app->app_id(), - protocol_handler::ServiceType::kMobileNav, - result, - rejected_params); - break; } default: SDL_LOG_ERROR("Received unknown event " << event.id()); @@ -143,8 +143,10 @@ void NaviSetVideoConfigRequest::onTimeOut() { } std::vector<std::string> empty; - application_manager_.OnStreamingConfigured( - app->app_id(), protocol_handler::ServiceType::kMobileNav, false, empty); + application_manager_.OnStreamingConfigurationFailed( + app->app_id(), + empty, + "Timed out while waiting for SetVideoConfig response"); application_manager_.TerminateRequest( connection_key(), correlation_id(), function_id()); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/navi_set_video_config_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/navi_set_video_config_request_test.cc index d6ef540bc0..7ce3a353e9 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/navi_set_video_config_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/navi_set_video_config_request_test.cc @@ -101,11 +101,9 @@ TEST_F(NaviSetVideoConfigRequestTest, OnEventWithSuccessResponse) { Event event(kEventID); event.set_smart_object(*event_msg); - std::vector<std::string> empty; - EXPECT_CALL( - app_mngr_, - OnStreamingConfigured( - kAppId, protocol_handler::ServiceType::kMobileNav, true, empty)) + EXPECT_CALL(app_mngr_, + OnStreamingConfigurationSuccessful( + kAppId, protocol_handler::ServiceType::kMobileNav)) .Times(1); command->on_event(event); @@ -151,10 +149,9 @@ TEST_F(NaviSetVideoConfigRequestTest, OnEventWithRejectedResponse) { event.set_smart_object(*event_msg); std::vector<std::string> rejected_params; - EXPECT_CALL(app_mngr_, - OnStreamingConfigured( - kAppId, protocol_handler::ServiceType::kMobileNav, false, _)) - .WillOnce(SaveArg<3>(&rejected_params)); + std::string reason("Received SetVideoConfig failure response"); + EXPECT_CALL(app_mngr_, OnStreamingConfigurationFailed(kAppId, _, reason)) + .WillOnce(SaveArg<1>(&rejected_params)); command->on_event(event); @@ -181,10 +178,8 @@ TEST_F(NaviSetVideoConfigRequestTest, event.set_smart_object(*event_msg); std::vector<std::string> empty; - EXPECT_CALL( - app_mngr_, - OnStreamingConfigured( - kAppId, protocol_handler::ServiceType::kMobileNav, false, empty)) + std::string reason("Received SetVideoConfig failure response"); + EXPECT_CALL(app_mngr_, OnStreamingConfigurationFailed(kAppId, empty, reason)) .WillOnce(Return()); command->on_event(event); @@ -198,10 +193,8 @@ TEST_F(NaviSetVideoConfigRequestTest, OnTimeout) { CreateCommand<NaviSetVideoConfigRequest>(request_msg); std::vector<std::string> empty; - EXPECT_CALL( - app_mngr_, - OnStreamingConfigured( - kAppId, protocol_handler::ServiceType::kMobileNav, false, empty)) + std::string reason("Timed out while waiting for SetVideoConfig response"); + EXPECT_CALL(app_mngr_, OnStreamingConfigurationFailed(kAppId, empty, reason)) .WillOnce(Return()); EXPECT_CALL(app_mngr_, TerminateRequest(_, _, _)).Times(1); |