summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYana Chernysheva <ychernysheva@luxoft.com>2020-12-30 16:23:41 +0200
committerLitvinenkoIra <ilytvynenko@luxoft.com>2021-02-02 11:24:11 +0200
commitdc420f008494a0f8c1faf75fbb27e245db463ee4 (patch)
treecda19e7dc53392a794230a642647816e602ef502
parentd0c1264475e93859c3957728abcdb2259149b4a4 (diff)
downloadsdl_core-dc420f008494a0f8c1faf75fbb27e245db463ee4.tar.gz
Add new methods to PolicyManager classes
-rw-r--r--src/components/include/policy/policy_external/policy/policy_manager.h13
-rw-r--r--src/components/include/policy/policy_regular/policy/policy_manager.h13
-rw-r--r--src/components/include/test/policy/policy_external/policy/mock_policy_manager.h2
-rw-r--r--src/components/include/test/policy/policy_regular/policy/mock_policy_manager.h2
-rw-r--r--src/components/policy/policy_external/include/policy/policy_manager_impl.h4
-rw-r--r--src/components/policy/policy_external/src/policy_manager_impl.cc11
-rw-r--r--src/components/policy/policy_regular/include/policy/policy_manager_impl.h4
-rw-r--r--src/components/policy/policy_regular/src/policy_manager_impl.cc11
-rw-r--r--src/components/policy/policy_regular/test/policy_manager_impl_test.cc14
9 files changed, 60 insertions, 14 deletions
diff --git a/src/components/include/policy/policy_external/policy/policy_manager.h b/src/components/include/policy/policy_external/policy/policy_manager.h
index 9d4ad5ea57..3f17e50702 100644
--- a/src/components/include/policy/policy_external/policy/policy_manager.h
+++ b/src/components/include/policy/policy_external/policy/policy_manager.h
@@ -433,12 +433,25 @@ class PolicyManager : public usage_statistics::StatisticsManager,
const std::string& language) = 0;
/**
+ * @brief Set hardware version from GetSystemInfo response to policy table, if
+ * present
+ * @param hardware_version Hardware version
+ */
+ virtual void SetHardwareVersion(const std::string& hardware_version) = 0;
+
+ /**
* @brief Get information about last ccpu_version from PT
* @return ccpu_version from PT
*/
virtual std::string GetCCPUVersionFromPT() const = 0;
/**
+ * @brief Get information about last hardware version from PT
+ * @return hardware version from PT
+ */
+ virtual std::string GetHardwareVersionFromPT() const = 0;
+
+ /**
* @brief Send OnPermissionsUpdated for choosen application
* @param device_id device identifier
* @param application_id Unique application id
diff --git a/src/components/include/policy/policy_regular/policy/policy_manager.h b/src/components/include/policy/policy_regular/policy/policy_manager.h
index c90006928a..b4043067ab 100644
--- a/src/components/include/policy/policy_regular/policy/policy_manager.h
+++ b/src/components/include/policy/policy_regular/policy/policy_manager.h
@@ -424,12 +424,25 @@ class PolicyManager : public usage_statistics::StatisticsManager,
const std::string& language) = 0;
/**
+ * @brief Set hardware version from GetSystemInfo response to policy table, if
+ * present
+ * @param hardware_version Hardware version
+ */
+ virtual void SetHardwareVersion(const std::string& hardware_version) = 0;
+
+ /**
* @brief Get information about last ccpu_version from PT
* @return ccpu_version from PT
*/
virtual std::string GetCCPUVersionFromPT() const = 0;
/**
+ * @brief Get information about last hardware version from PT
+ * @return hardware version from PT
+ */
+ virtual std::string GetHardwareVersionFromPT() const = 0;
+
+ /**
* @brief Send OnPermissionsUpdated for choosen application
* @param device_id device identifier
* @param application_id Unique application id
diff --git a/src/components/include/test/policy/policy_external/policy/mock_policy_manager.h b/src/components/include/test/policy/policy_external/policy/mock_policy_manager.h
index 0123c6c912..84a8b3ecce 100644
--- a/src/components/include/test/policy/policy_external/policy/mock_policy_manager.h
+++ b/src/components/include/test/policy/policy_external/policy/mock_policy_manager.h
@@ -173,6 +173,7 @@ class MockPolicyManager : public PolicyManager {
void(const std::string& ccpu_version,
const std::string& wers_country_code,
const std::string& language));
+ MOCK_METHOD1(SetHardwareVersion, void(const std::string& hardware_version));
MOCK_METHOD1(SetPreloadedPtFlag, void(const bool is_preloaded));
MOCK_METHOD2(SendNotificationOnPermissionsUpdated,
void(const std::string& device_id,
@@ -308,6 +309,7 @@ class MockPolicyManager : public PolicyManager {
MOCK_METHOD0(RetrySequenceFailed, void());
MOCK_METHOD0(ResetTimeout, void());
MOCK_CONST_METHOD0(GetCCPUVersionFromPT, std::string());
+ MOCK_CONST_METHOD0(GetHardwareVersionFromPT, std::string());
};
} // namespace policy_manager_test
} // namespace components
diff --git a/src/components/include/test/policy/policy_regular/policy/mock_policy_manager.h b/src/components/include/test/policy/policy_regular/policy/mock_policy_manager.h
index 4cb6455db6..076f0423ef 100644
--- a/src/components/include/test/policy/policy_regular/policy/mock_policy_manager.h
+++ b/src/components/include/test/policy/policy_regular/policy/mock_policy_manager.h
@@ -172,6 +172,7 @@ class MockPolicyManager : public PolicyManager {
void(const std::string& ccpu_version,
const std::string& wers_country_code,
const std::string& language));
+ MOCK_METHOD1(SetHardwareVersion, void(const std::string& hardware_version));
MOCK_METHOD1(SetPreloadedPtFlag, void(const bool is_preloaded));
MOCK_METHOD2(SendNotificationOnPermissionsUpdated,
void(const std::string& device_id,
@@ -311,6 +312,7 @@ class MockPolicyManager : public PolicyManager {
RequestSubType::State(const std::string& policy_app_id));
MOCK_METHOD0(ResetTimeout, void());
MOCK_CONST_METHOD0(GetCCPUVersionFromPT, std::string());
+ MOCK_CONST_METHOD0(GetHardwareVersionFromPT, std::string());
};
} // namespace policy_manager_test
diff --git a/src/components/policy/policy_external/include/policy/policy_manager_impl.h b/src/components/policy/policy_external/include/policy/policy_manager_impl.h
index 27ce30bb3d..cd4d6f40d5 100644
--- a/src/components/policy/policy_external/include/policy/policy_manager_impl.h
+++ b/src/components/policy/policy_external/include/policy/policy_manager_impl.h
@@ -435,10 +435,14 @@ class PolicyManagerImpl : public PolicyManager {
const std::string& wers_country_code,
const std::string& language) OVERRIDE;
+ void SetHardwareVersion(const std::string& hardware_version) OVERRIDE;
+
void SetPreloadedPtFlag(const bool is_preloaded) OVERRIDE;
std::string GetCCPUVersionFromPT() const OVERRIDE;
+ std::string GetHardwareVersionFromPT() const OVERRIDE;
+
/**
* @brief Get number of notification by priority
* @param priority Specified priority
diff --git a/src/components/policy/policy_external/src/policy_manager_impl.cc b/src/components/policy/policy_external/src/policy_manager_impl.cc
index 9bcea70803..d4348957f7 100644
--- a/src/components/policy/policy_external/src/policy_manager_impl.cc
+++ b/src/components/policy/policy_external/src/policy_manager_impl.cc
@@ -1617,11 +1617,22 @@ void PolicyManagerImpl::SetSystemInfo(const std::string& ccpu_version,
cache_->SetMetaInfo(ccpu_version, wers_country_code, language);
}
+void PolicyManagerImpl::SetHardwareVersion(
+ const std::string& hardware_version) {
+ SDL_LOG_AUTO_TRACE();
+ cache_->SetHardwareVersion(hardware_version);
+}
+
std::string PolicyManagerImpl::GetCCPUVersionFromPT() const {
SDL_LOG_AUTO_TRACE();
return cache_->GetCCPUVersionFromPT();
}
+std::string PolicyManagerImpl::GetHardwareVersionFromPT() const {
+ SDL_LOG_AUTO_TRACE();
+ return cache_->GetHardwareVersionFromPT();
+}
+
uint32_t PolicyManagerImpl::GetNotificationsNumber(const std::string& priority,
const bool is_subtle) const {
SDL_LOG_AUTO_TRACE();
diff --git a/src/components/policy/policy_regular/include/policy/policy_manager_impl.h b/src/components/policy/policy_regular/include/policy/policy_manager_impl.h
index dff4802d82..32c546df62 100644
--- a/src/components/policy/policy_regular/include/policy/policy_manager_impl.h
+++ b/src/components/policy/policy_regular/include/policy/policy_manager_impl.h
@@ -451,10 +451,14 @@ class PolicyManagerImpl : public PolicyManager {
const std::string& wers_country_code,
const std::string& language) OVERRIDE;
+ void SetHardwareVersion(const std::string& hardware_version) OVERRIDE;
+
void SetPreloadedPtFlag(const bool is_preloaded) OVERRIDE;
std::string GetCCPUVersionFromPT() const OVERRIDE;
+ std::string GetHardwareVersionFromPT() const OVERRIDE;
+
/**
* @brief Get number of notification by priority
* @param priority Specified priority
diff --git a/src/components/policy/policy_regular/src/policy_manager_impl.cc b/src/components/policy/policy_regular/src/policy_manager_impl.cc
index 059375322a..b6101eb960 100644
--- a/src/components/policy/policy_regular/src/policy_manager_impl.cc
+++ b/src/components/policy/policy_regular/src/policy_manager_impl.cc
@@ -1217,11 +1217,22 @@ void PolicyManagerImpl::SetSystemInfo(const std::string& ccpu_version,
cache_->SetMetaInfo(ccpu_version, wers_country_code, language);
}
+void PolicyManagerImpl::SetHardwareVersion(
+ const std::string& hardware_version) {
+ SDL_LOG_AUTO_TRACE();
+ cache_->SetHardwareVersion(hardware_version);
+}
+
std::string PolicyManagerImpl::GetCCPUVersionFromPT() const {
SDL_LOG_AUTO_TRACE();
return cache_->GetCCPUVersionFromPT();
}
+std::string PolicyManagerImpl::GetHardwareVersionFromPT() const {
+ SDL_LOG_AUTO_TRACE();
+ return cache_->GetHardwareVersionFromPT();
+}
+
uint32_t PolicyManagerImpl::GetNotificationsNumber(const std::string& priority,
const bool is_subtle) const {
SDL_LOG_AUTO_TRACE();
diff --git a/src/components/policy/policy_regular/test/policy_manager_impl_test.cc b/src/components/policy/policy_regular/test/policy_manager_impl_test.cc
index d5a66f4388..c456561328 100644
--- a/src/components/policy/policy_regular/test/policy_manager_impl_test.cc
+++ b/src/components/policy/policy_regular/test/policy_manager_impl_test.cc
@@ -599,20 +599,6 @@ TEST_F(PolicyManagerImplTest, GetHMITypes_ValidHmiTypes_ReturnTrue) {
EXPECT_TRUE(policy_manager_->GetHMITypes(kValidAppId, &app_types));
}
-TEST_F(PolicyManagerImplTest, SetMetaInfo_SetCCPUVersion_SUCCESS) {
- const std::string ccpu_version = "ccpu_version";
- const std::string wers_country_code = "wersCountryCode";
- const std::string language = "language";
-
- EXPECT_CALL(*mock_cache_manager_,
- SetMetaInfo(ccpu_version, wers_country_code, language));
- policy_manager_->SetSystemInfo(ccpu_version, wers_country_code, language);
-
- EXPECT_CALL(*mock_cache_manager_, GetCCPUVersionFromPT())
- .WillOnce(Return(ccpu_version));
- EXPECT_EQ(ccpu_version, policy_manager_->GetCCPUVersionFromPT());
-}
-
} // namespace policy_test
} // namespace components
} // namespace test