summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAKalinich-Luxoft <AKalinich@luxoft.com>2017-09-14 14:19:56 +0300
committerAKalinich-Luxoft <AKalinich@luxoft.com>2017-09-18 18:59:38 +0300
commit86974f42574b6a1427192bc2842fbbdf82425841 (patch)
tree269e590623c119c73b146ce222c11cb5fea72ea0
parent6b882d404bf081fc01d5fcb548119d05213091e5 (diff)
downloadsdl_core-86974f42574b6a1427192bc2842fbbdf82425841.tar.gz
Fix affected mocks and unit tests logic
After adding new method to few classes some of unit tests and mocks have to be updated.
-rw-r--r--src/components/functional_module/test/plugins/mock_generic_module.h2
-rw-r--r--src/components/functional_module/test/src/plugin_manager_test.cc8
-rw-r--r--src/components/remote_control/test/include/mock_remote_control_plugin.h2
-rw-r--r--src/components/remote_control/test/include/mock_resource_allocation_manager.h2
-rw-r--r--src/components/remote_control/test/src/resource_allocation_manager_impl_test.cc19
5 files changed, 23 insertions, 10 deletions
diff --git a/src/components/functional_module/test/plugins/mock_generic_module.h b/src/components/functional_module/test/plugins/mock_generic_module.h
index 0139866d67..faea0f135d 100644
--- a/src/components/functional_module/test/plugins/mock_generic_module.h
+++ b/src/components/functional_module/test/plugins/mock_generic_module.h
@@ -63,7 +63,7 @@ class MockGenericModule : public GenericModule {
MOCK_METHOD1(OnUnregisterApplication, void(const uint32_t app_id));
MOCK_METHOD2(OnApplicationEvent,
void(functional_modules::ApplicationEvent event,
- const uint32_t application_id));
+ application_manager::ApplicationSharedPtr application));
MOCK_METHOD1(OnPolicyEvent, void(functional_modules::PolicyEvent event));
MOCK_METHOD0(RemoveAppExtensions, void());
};
diff --git a/src/components/functional_module/test/src/plugin_manager_test.cc b/src/components/functional_module/test/src/plugin_manager_test.cc
index 5c251113a8..f99b8b798e 100644
--- a/src/components/functional_module/test/src/plugin_manager_test.cc
+++ b/src/components/functional_module/test/src/plugin_manager_test.cc
@@ -10,6 +10,7 @@
using application_manager::Message;
using protocol_handler::MajorProtocolVersion;
using application_manager::MockService;
+using test::components::application_manager_test::MockApplication;
using ::testing::NiceMock;
using ::testing::Expectation;
using ::testing::ReturnRef;
@@ -76,11 +77,12 @@ TEST_F(PluginManagerTest, SDL_events_triggers_module) {
app_events.push_back(ApplicationEvent::kApplicationExit);
app_events.push_back(ApplicationEvent::kApplicationUnregistered);
+ application_manager::ApplicationSharedPtr dummy_ptr =
+ utils::MakeShared<MockApplication>();
std::vector<ApplicationEvent>::const_iterator ev = app_events.begin();
- const uint32_t kDummyAppId = 1;
for (; app_events.end() != ev; ++ev) {
- EXPECT_CALL(*module, OnApplicationEvent(*ev, kDummyAppId));
- manager->OnApplicationEvent(*ev, kDummyAppId);
+ EXPECT_CALL(*module, OnApplicationEvent(*ev, dummy_ptr));
+ manager->OnApplicationEvent(*ev, dummy_ptr);
}
std::vector<PolicyEvent> policy_events;
diff --git a/src/components/remote_control/test/include/mock_remote_control_plugin.h b/src/components/remote_control/test/include/mock_remote_control_plugin.h
index 2e221ca75d..a8143f448c 100644
--- a/src/components/remote_control/test/include/mock_remote_control_plugin.h
+++ b/src/components/remote_control/test/include/mock_remote_control_plugin.h
@@ -43,7 +43,7 @@ class MockRemotePluginInterface : public remote_control::RemotePluginInterface {
remote_control::ResourceAllocationManager&());
MOCK_METHOD2(OnApplicationEvent,
void(functional_modules::ApplicationEvent event,
- const uint32_t application_id));
+ application_manager::ApplicationSharedPtr application));
MOCK_METHOD1(OnPolicyEvent, void(functional_modules::PolicyEvent event));
};
diff --git a/src/components/remote_control/test/include/mock_resource_allocation_manager.h b/src/components/remote_control/test/include/mock_resource_allocation_manager.h
index d55af2b00d..6337d8a32a 100644
--- a/src/components/remote_control/test/include/mock_resource_allocation_manager.h
+++ b/src/components/remote_control/test/include/mock_resource_allocation_manager.h
@@ -20,7 +20,7 @@ class MockResourceAllocationManager
void(const std::string& module_type, const uint32_t app_id));
MOCK_METHOD2(OnApplicationEvent,
void(functional_modules::ApplicationEvent event,
- const uint32_t application_id));
+ application_manager::ApplicationSharedPtr application));
MOCK_METHOD1(OnPolicyEvent, void(functional_modules::PolicyEvent event));
MOCK_METHOD1(SetAccessMode,
void(const hmi_apis::Common_RCAccessMode::eType access_mode));
diff --git a/src/components/remote_control/test/src/resource_allocation_manager_impl_test.cc b/src/components/remote_control/test/src/resource_allocation_manager_impl_test.cc
index 4d1b399add..a69702d424 100644
--- a/src/components/remote_control/test/src/resource_allocation_manager_impl_test.cc
+++ b/src/components/remote_control/test/src/resource_allocation_manager_impl_test.cc
@@ -258,8 +258,11 @@ TEST_F(RAManagerTest, AppExit_ReleaseResource) {
ra_manager.AcquireResource(kModuleType1, kAppId1));
// Act
+ application_manager::ApplicationSharedPtr app_ptr(mock_app_1_);
+ EXPECT_CALL(*mock_app_1_, app_id()).WillRepeatedly(Return(kAppId1));
+
ra_manager.OnApplicationEvent(
- functional_modules::ApplicationEvent::kApplicationExit, kAppId1);
+ functional_modules::ApplicationEvent::kApplicationExit, app_ptr);
EXPECT_CALL(*mock_service_, GetApplication(kAppId2))
.WillRepeatedly(Return(mock_app_2_));
@@ -289,8 +292,10 @@ TEST_F(RAManagerTest, AnotherAppExit_NoReleaseResource) {
.WillOnce(Return(rc_extention_ptr));
// Act
+ application_manager::ApplicationSharedPtr app_ptr(mock_app_2_);
+ EXPECT_CALL(*mock_app_2_, app_id()).WillRepeatedly(Return(kAppId2));
ra_manager.OnApplicationEvent(
- functional_modules::ApplicationEvent::kApplicationExit, kAppId2);
+ functional_modules::ApplicationEvent::kApplicationExit, app_ptr);
EXPECT_CALL(*mock_service_, GetApplication(kAppId2))
.WillOnce(Return(mock_app_2_));
@@ -318,8 +323,11 @@ TEST_F(RAManagerTest, AppUnregistered_ReleaseResource) {
ra_manager.AcquireResource(kModuleType1, kAppId1));
// Act
+ application_manager::ApplicationSharedPtr app_ptr(mock_app_1_);
+ EXPECT_CALL(*mock_app_1_, app_id()).WillRepeatedly(Return(kAppId1));
+
ra_manager.OnApplicationEvent(
- functional_modules::ApplicationEvent::kApplicationUnregistered, kAppId1);
+ functional_modules::ApplicationEvent::kApplicationUnregistered, app_ptr);
EXPECT_CALL(*mock_service_, GetApplication(kAppId2))
.WillOnce(Return(mock_app_2_));
@@ -348,8 +356,11 @@ TEST_F(RAManagerTest, AnotherAppUnregistered_NoReleaseResource) {
.WillOnce(Return(rc_extention_ptr));
// Act
+ application_manager::ApplicationSharedPtr app_ptr(mock_app_2_);
+ EXPECT_CALL(*mock_app_2_, app_id()).WillRepeatedly(Return(kAppId2));
+
ra_manager.OnApplicationEvent(
- functional_modules::ApplicationEvent::kApplicationUnregistered, kAppId2);
+ functional_modules::ApplicationEvent::kApplicationUnregistered, app_ptr);
EXPECT_CALL(*mock_service_, GetApplication(kAppId2))
.WillOnce(Return(mock_app_2_));