Skip to content

Commit

Permalink
Fix affected unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
AKalinich-Luxoft committed Jul 16, 2021
1 parent 9e461d0 commit e7e1ebf
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,9 @@ TYPED_TEST(OnButtonNotificationCommandsTest,
typename TestFixture::MockAppPtr mock_app = this->CreateMockApp();
EXPECT_CALL(this->app_mngr_, application(kAppId)).WillOnce(Return(mock_app));

EXPECT_CALL(*mock_app,
IsSubscribedToButton(mobile_apis::ButtonName::CUSTOM_BUTTON))
.WillOnce(Return(true));
EXPECT_CALL(*mock_app, IsSubscribedToSoftButton(kCustomButtonId))
.WillOnce(Return(false));

Expand Down Expand Up @@ -228,6 +231,9 @@ TYPED_TEST(OnButtonNotificationCommandsTest, Run_CustomButton_SUCCESS) {
ON_CALL(*mock_app, hmi_level(kDefaultWindowId))
.WillByDefault(Return(mobile_apis::HMILevel::HMI_FULL));
EXPECT_CALL(this->app_mngr_, application(kAppId)).WillOnce(Return(mock_app));
EXPECT_CALL(*mock_app,
IsSubscribedToButton(mobile_apis::ButtonName::CUSTOM_BUTTON))
.WillOnce(Return(true));
EXPECT_CALL(*mock_app, IsSubscribedToSoftButton(kCustomButtonId))
.WillOnce(Return(true));
EXPECT_CALL(this->mock_rpc_service_,
Expand Down Expand Up @@ -268,6 +274,10 @@ TYPED_TEST(OnButtonNotificationCommandsTest,
.WillOnce(Return(mobile_apis::HMILevel::HMI_BACKGROUND));

EXPECT_CALL(this->app_mngr_, application(kAppId)).WillOnce(Return(mock_app));

EXPECT_CALL(*mock_app,
IsSubscribedToButton(mobile_apis::ButtonName::CUSTOM_BUTTON))
.WillOnce(Return(true));
EXPECT_CALL(*mock_app, IsSubscribedToSoftButton(kCustomButtonId))
.WillOnce(Return(true));

Expand Down Expand Up @@ -357,23 +367,21 @@ TYPED_TEST(OnButtonNotificationCommandsTest, Run_SUCCESS) {
std::shared_ptr<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);
auto mock_message_helper = am::MockMessageHelper::message_helper_mock();
smart_objects::SmartObjectSPtr msg =
std::make_shared<smart_objects::SmartObject>();
EXPECT_CALL(*mock_message_helper, CreateButtonNotificationToMobile(_, _))
.WillRepeatedly(Return(msg));

typename TestFixture::MockAppPtr mock_app = this->CreateMockApp();
EXPECT_CALL(*mock_app, IsSubscribedToButton(kButtonName))
.WillOnce(Return(true));
EXPECT_CALL(*mock_app, hmi_level(kDefaultWindowId))
.WillRepeatedly(Return(mobile_apis::HMILevel::HMI_FULL));

ON_CALL(*mock_app, IsFullscreen()).WillByDefault(Return(true));
ON_CALL(this->app_mngr_, application(kAppId)).WillByDefault(Return(mock_app));

EXPECT_CALL(this->app_mngr_, applications_by_button(kButtonName))
.WillOnce(Return(subscribed_apps_list));
EXPECT_CALL(this->mock_rpc_service_,
SendMessageToMobile(
CheckNotificationMessage(TestFixture::kFunctionId), _));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -560,9 +560,9 @@ TEST_F(ApplicationImplTest, SubscribeToButton_UnsubscribeFromButton) {
EXPECT_FALSE(app_impl->IsSubscribedToButton(ButtonName::PRESET_0));
}

TEST_F(ApplicationImplTest, SubscribeToDefaultButton_UnsubscribeFromButton) {
EXPECT_TRUE(app_impl->IsSubscribedToButton(ButtonName::CUSTOM_BUTTON));
EXPECT_FALSE(app_impl->SubscribeToButton(ButtonName::CUSTOM_BUTTON));
TEST_F(ApplicationImplTest, NotSubscribedToDefaultButton_SubscribeToButton) {
EXPECT_FALSE(app_impl->IsSubscribedToButton(ButtonName::CUSTOM_BUTTON));
EXPECT_TRUE(app_impl->SubscribeToButton(ButtonName::CUSTOM_BUTTON));
}

TEST_F(ApplicationImplTest, SubscribeToSoftButton_UnsubscribeFromSoftButton) {
Expand Down

0 comments on commit e7e1ebf

Please sign in to comment.