diff options
Diffstat (limited to 'src/components/application_manager/test/commands/mobile/unsubscribe_way_points_request_test.cc')
-rw-r--r-- | src/components/application_manager/test/commands/mobile/unsubscribe_way_points_request_test.cc | 57 |
1 files changed, 47 insertions, 10 deletions
diff --git a/src/components/application_manager/test/commands/mobile/unsubscribe_way_points_request_test.cc b/src/components/application_manager/test/commands/mobile/unsubscribe_way_points_request_test.cc index 5615b0cabd..a75609ed50 100644 --- a/src/components/application_manager/test/commands/mobile/unsubscribe_way_points_request_test.cc +++ b/src/components/application_manager/test/commands/mobile/unsubscribe_way_points_request_test.cc @@ -64,7 +64,8 @@ using am::commands::MessageSharedPtr; namespace { const uint32_t kConnectionKey = 3u; -const uint32_t kAppId = 5u; +const uint32_t kAppId1 = 5u; +const uint32_t kAppId2 = 6u; } // namespace class UnSubscribeWayPointsRequestTest @@ -100,9 +101,9 @@ TEST_F(UnSubscribeWayPointsRequestTest, EXPECT_CALL(app_mngr_, application(kConnectionKey)) .WillOnce(Return(mock_app)); - EXPECT_CALL(app_mngr_, - IsAppSubscribedForWayPoints( - ::testing::Matcher<am::ApplicationSharedPtr>(mock_app))) + EXPECT_CALL(*mock_app, app_id()).WillOnce(Return(kAppId1)); + + EXPECT_CALL(app_mngr_, IsAppSubscribedForWayPoints(kAppId1)) .WillOnce(Return(false)); EXPECT_CALL( @@ -112,20 +113,51 @@ TEST_F(UnSubscribeWayPointsRequestTest, command_->Run(); } +TEST_F(UnSubscribeWayPointsRequestTest, + Run_AnotherAppSubscribedForWayPoints_SUCCESS) { + MockAppPtr mock_app(CreateMockApp()); + EXPECT_CALL(app_mngr_, application(kConnectionKey)) + .WillOnce(Return(mock_app)); + + EXPECT_CALL(*mock_app, app_id()).WillRepeatedly(Return(kAppId1)); + + EXPECT_CALL(app_mngr_, IsAppSubscribedForWayPoints(kAppId1)) + .WillOnce(Return(true)); + + EXPECT_CALL(app_mngr_, UnsubscribeAppFromWayPoints(kAppId1)); + + std::set<int32_t> subscribed_apps; + subscribed_apps.insert(kAppId1); + subscribed_apps.insert(kAppId2); + + EXPECT_CALL(app_mngr_, GetAppsSubscribedForWayPoints()) + .WillOnce(Return(subscribed_apps)); + + EXPECT_CALL( + app_mngr_, + ManageMobileCommand(MobileResultCodeIs(mobile_result::SUCCESS), _)); + + command_->Run(); +} + TEST_F(UnSubscribeWayPointsRequestTest, Run_AppSubscribedForWayPoints_SUCCESS) { MockAppPtr mock_app(CreateMockApp()); EXPECT_CALL(app_mngr_, application(kConnectionKey)) .WillOnce(Return(mock_app)); - EXPECT_CALL(app_mngr_, - IsAppSubscribedForWayPoints( - ::testing::Matcher<am::ApplicationSharedPtr>(mock_app))) + EXPECT_CALL(*mock_app, app_id()).WillOnce(Return(kAppId1)); + + EXPECT_CALL(app_mngr_, IsAppSubscribedForWayPoints(kAppId1)) .WillOnce(Return(true)); EXPECT_CALL(app_mngr_, ManageHMICommand(HMIResultCodeIs( hmi_apis::FunctionID::Navigation_UnsubscribeWayPoints))); + std::set<int32_t> subscribed_apps; + EXPECT_CALL(app_mngr_, GetAppsSubscribedForWayPoints()) + .WillOnce(Return(subscribed_apps)); + command_->Run(); } @@ -154,9 +186,14 @@ TEST_F(UnSubscribeWayPointsRequestTest, Event event(hmi_apis::FunctionID::Navigation_UnsubscribeWayPoints); event.set_smart_object(*event_msg); - EXPECT_CALL(app_mngr_, - UnsubscribeAppFromWayPoints( - ::testing::Matcher<am::ApplicationSharedPtr>(mock_app))); + EXPECT_CALL(*mock_app, app_id()).WillOnce(Return(kAppId1)); + + EXPECT_CALL(app_mngr_, UnsubscribeAppFromWayPoints(kAppId1)); + + std::set<int32_t> subscribed_apps; + EXPECT_CALL(app_mngr_, GetAppsSubscribedForWayPoints()) + .WillOnce(Return(subscribed_apps)); + EXPECT_CALL(app_mngr_, SetWaypointsInfo(_)); EXPECT_CALL( app_mngr_, |