diff options
Diffstat (limited to 'src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_system_request_notification_test.cc')
-rw-r--r-- | src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_system_request_notification_test.cc | 46 |
1 files changed, 30 insertions, 16 deletions
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_system_request_notification_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_system_request_notification_test.cc index d6e1b2fe52..94ec61ad06 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_system_request_notification_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_system_request_notification_test.cc @@ -73,14 +73,18 @@ class OnSystemRequestNotificationTest void PreConditions() { ON_CALL(app_mngr_, application(kConnectionKey)) .WillByDefault(Return(mock_app_)); + + ON_CALL(app_mngr_, GetPolicyHandler()) + .WillByDefault(ReturnRef(mock_policy_handler_)); ON_CALL(*mock_app_, policy_app_id()).WillByDefault(Return(kPolicyAppId)); } protected: MockAppPtr mock_app_; + MockPolicyHandlerInterface mock_policy_handler_; }; -TEST_F(OnSystemRequestNotificationTest, Run_ProprietaryType_SUCCESS) { +TEST_F(OnSystemRequestNotificationTest, DISABLED_Run_ProprietaryType_SUCCESS) { const mobile_apis::RequestType::eType request_type = mobile_apis::RequestType::PROPRIETARY; @@ -91,12 +95,13 @@ TEST_F(OnSystemRequestNotificationTest, Run_ProprietaryType_SUCCESS) { SharedPtr<OnSystemRequestNotification> command = CreateCommand<OnSystemRequestNotification>(msg); + MockAppPtr mock_app = CreateMockApp(); EXPECT_CALL(app_mngr_, application(kConnectionKey)) - .WillRepeatedly(Return(mock_app_)); - - EXPECT_CALL(*mock_app_, policy_app_id()).WillOnce(Return(kPolicyAppId)); + .WillRepeatedly(Return(mock_app)); + std::string policy_app_id; + EXPECT_CALL(*mock_app, policy_app_id()).WillOnce(Return(policy_app_id)); EXPECT_CALL(mock_policy_handler_, - IsRequestTypeAllowed(kPolicyAppId, request_type)) + IsRequestTypeAllowed(policy_app_id, request_type)) .WillRepeatedly(Return(true)); #ifdef PROPRIETARY_MODE @@ -120,7 +125,7 @@ TEST_F(OnSystemRequestNotificationTest, Run_ProprietaryType_SUCCESS) { (*msg)[strings::params][strings::protocol_version].asInt()); } -TEST_F(OnSystemRequestNotificationTest, Run_HTTPType_SUCCESS) { +TEST_F(OnSystemRequestNotificationTest, DISABLED_Run_HTTPType_SUCCESS) { const mobile_apis::RequestType::eType request_type = mobile_apis::RequestType::HTTP; @@ -131,9 +136,11 @@ TEST_F(OnSystemRequestNotificationTest, Run_HTTPType_SUCCESS) { SharedPtr<OnSystemRequestNotification> command = CreateCommand<OnSystemRequestNotification>(msg); + MockAppPtr mock_app = CreateMockApp(); EXPECT_CALL(app_mngr_, application(kConnectionKey)) - .WillOnce(Return(mock_app_)); - EXPECT_CALL(*mock_app_, policy_app_id()).WillOnce(Return(kPolicyAppId)); + .WillOnce(Return(mock_app)); + 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)); @@ -154,7 +161,8 @@ TEST_F(OnSystemRequestNotificationTest, Run_HTTPType_SUCCESS) { (*msg)[strings::params][strings::protocol_version].asInt()); } -TEST_F(OnSystemRequestNotificationTest, Run_InvalidApp_NoNotification) { +TEST_F(OnSystemRequestNotificationTest, + DISABLED_Run_InvalidApp_NoNotification) { const mobile_apis::RequestType::eType request_type = mobile_apis::RequestType::HTTP; @@ -165,9 +173,10 @@ TEST_F(OnSystemRequestNotificationTest, Run_InvalidApp_NoNotification) { SharedPtr<OnSystemRequestNotification> command = CreateCommand<OnSystemRequestNotification>(msg); + MockAppPtr mock_app = CreateMockApp(); EXPECT_CALL(app_mngr_, application(kConnectionKey)) .WillOnce(Return(MockAppPtr())); - EXPECT_CALL(*mock_app_, policy_app_id()).Times(0); + EXPECT_CALL(*mock_app, policy_app_id()).Times(0); EXPECT_CALL(mock_policy_handler_, IsRequestTypeAllowed(_, _)).Times(0); EXPECT_CALL(mock_message_helper_, PrintSmartObject(_)).Times(0); @@ -177,7 +186,8 @@ TEST_F(OnSystemRequestNotificationTest, Run_InvalidApp_NoNotification) { command->Run(); } -TEST_F(OnSystemRequestNotificationTest, Run_RequestNotAllowed_NoNotification) { +TEST_F(OnSystemRequestNotificationTest, + DISABLED_Run_RequestNotAllowed_NoNotification) { const mobile_apis::RequestType::eType request_type = mobile_apis::RequestType::HTTP; @@ -188,22 +198,25 @@ TEST_F(OnSystemRequestNotificationTest, Run_RequestNotAllowed_NoNotification) { SharedPtr<OnSystemRequestNotification> command = CreateCommand<OnSystemRequestNotification>(msg); + MockAppPtr mock_app = CreateMockApp(); EXPECT_CALL(app_mngr_, application(kConnectionKey)) - .WillOnce(Return(mock_app_)); - EXPECT_CALL(*mock_app_, policy_app_id()).WillOnce(Return(kPolicyAppId)); + .WillOnce(Return(mock_app)); + 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(mock_message_helper_, PrintSmartObject(_)).Times(0); EXPECT_CALL(mock_rpc_service_, SendMessageToMobile(msg, _)).Times(0); + ; command->Run(); } TEST_F( OnSystemRequestNotificationTest, - Run_RequestTypeAllowedAndRequestSubTypeDisallowed_MessageNotSentToMobile) { + DISABLED_Run_RequestTypeAllowedAndRequestSubTypeDisallowed_MessageNotSentToMobile) { MessageSharedPtr msg = CreateMessage(); (*msg)[strings::params][strings::connection_key] = kConnectionKey; const auto request_type = mobile_apis::RequestType::HTTP; @@ -229,8 +242,9 @@ TEST_F( command->Run(); } -TEST_F(OnSystemRequestNotificationTest, - Run_RequestTypeAllowedAndRequestSubTypeAllowed_SendMessageToMobile) { +TEST_F( + OnSystemRequestNotificationTest, + DISABLED_Run_RequestTypeAllowedAndRequestSubTypeAllowed_SendMessageToMobile) { MessageSharedPtr msg = CreateMessage(); (*msg)[strings::params][strings::connection_key] = kConnectionKey; const auto request_type = mobile_apis::RequestType::OEM_SPECIFIC; |