summaryrefslogtreecommitdiff
path: root/src/components/policy/policy_external/test/include
diff options
context:
space:
mode:
authorAlex Kutsan <akutsan@luxoft.com>2017-01-27 16:28:34 +0200
committerAlex Kutsan <akutsan@luxoft.com>2017-01-27 16:28:34 +0200
commit6b408ccced65e5bc7ce0d911cc4884223eaeac56 (patch)
treec3495a73ec8a16f681433448023f43b0e973334a /src/components/policy/policy_external/test/include
parent6cc4475f1300dfd351d3b203d9881fa6fe6e4ee1 (diff)
parent55d7b3429d974e9e4d945920a93cdec02f2dcb06 (diff)
downloadsdl_core-6b408ccced65e5bc7ce0d911cc4884223eaeac56.tar.gz
Merge release to develop
Diffstat (limited to 'src/components/policy/policy_external/test/include')
-rw-r--r--src/components/policy/policy_external/test/include/policy/driver_dbms.h159
-rw-r--r--src/components/policy/policy_external/test/include/policy/mock_cache_manager.h241
-rw-r--r--src/components/policy/policy_external/test/include/policy/mock_pt_ext_representation.h146
-rw-r--r--src/components/policy/policy_external/test/include/policy/mock_pt_representation.h109
-rw-r--r--src/components/policy/policy_external/test/include/policy/mock_update_status_manager.h61
-rw-r--r--src/components/policy/policy_external/test/include/policy/policy_manager_impl_test_base.h245
6 files changed, 961 insertions, 0 deletions
diff --git a/src/components/policy/policy_external/test/include/policy/driver_dbms.h b/src/components/policy/policy_external/test/include/policy/driver_dbms.h
new file mode 100644
index 0000000000..e438c87b03
--- /dev/null
+++ b/src/components/policy/policy_external/test/include/policy/driver_dbms.h
@@ -0,0 +1,159 @@
+/*
+ * Copyright (c) 2016, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef SRC_COMPONENTS_POLICY_POLICY_EXTERNAL_TEST_INCLUDE_POLICY_DRIVER_DBMS_H_
+#define SRC_COMPONENTS_POLICY_POLICY_EXTERNAL_TEST_INCLUDE_POLICY_DRIVER_DBMS_H_
+
+#ifdef __QNX__
+#include <qdb/qdb.h>
+#else // __QNX__
+#include <sqlite3.h>
+#endif // __QNX__
+
+namespace test {
+namespace components {
+namespace policy_test {
+
+#ifdef __QNX__
+class DBMS {
+ public:
+ explicit DBMS(std::string db_name) : db_name_(db_name), conn_(0) {}
+ ~DBMS() {
+ Close();
+ }
+ bool Open() {
+ conn_ = qdb_connect(db_name_.c_str(), 0);
+ return conn_ != NULL;
+ }
+ void Close() {
+ qdb_disconnect(conn_);
+ }
+ bool Exec(const char* query) {
+ return -1 != qdb_statement(conn_, query);
+ }
+ int FetchOneInt(const char* query) {
+ int stmt = qdb_stmt_init(conn_, query, strlen(query) + 1);
+ qdb_stmt_exec(conn_, stmt, NULL, 0);
+ qdb_result_t* res = qdb_getresult(conn_);
+ void* ret = qdb_cell(res, 0, 0);
+ int value = 0;
+ if (ret) {
+ value = *static_cast<int*>(ret);
+ }
+ qdb_stmt_free(conn_, stmt);
+ return value;
+ }
+ double FetchOneDouble(const char* query) {
+ int stmt = qdb_stmt_init(conn_, query, strlen(query) + 1);
+ qdb_stmt_exec(conn_, stmt, NULL, 0);
+ qdb_result_t* res = qdb_getresult(conn_);
+ void* ret = qdb_cell(res, 0, 0);
+ double value = 0.0;
+ if (ret) {
+ value = *static_cast<double*>(ret);
+ }
+ qdb_stmt_free(conn_, stmt);
+
+ return value;
+ }
+ std::string FetchOneString(const char* query) {
+ int stmt = qdb_stmt_init(conn_, query, strlen(query) + 1);
+ qdb_stmt_exec(conn_, stmt, NULL, 0);
+ qdb_result_t* res = qdb_getresult(conn_);
+ void* ret = qdb_cell(res, 0, 0);
+ std::string value = "";
+ if (ret) {
+ value = std::string(static_cast<const char*>(ret));
+ }
+ qdb_stmt_free(conn_, stmt);
+
+ return value;
+ }
+
+ private:
+ std::string db_name_;
+ qdb_hdl_t* conn_;
+};
+
+#else // __QNX__
+class DBMS {
+ public:
+ explicit DBMS(std::string file_name) : file_name_(file_name), conn_(0) {}
+ ~DBMS() {
+ Close();
+ }
+ bool Open() {
+ return SQLITE_OK == sqlite3_open(file_name_.c_str(), &conn_);
+ }
+ void Close() {
+ sqlite3_close(conn_);
+ remove(file_name_.c_str());
+ }
+ bool Exec(const char* query) {
+ return SQLITE_OK == sqlite3_exec(conn_, query, NULL, NULL, NULL);
+ }
+ int FetchOneInt(const char* query) {
+ sqlite3_stmt* statement;
+ sqlite3_prepare(conn_, query, -1, &statement, NULL);
+ sqlite3_step(statement);
+ int value = sqlite3_column_int(statement, 0);
+ sqlite3_finalize(statement);
+ return value;
+ }
+ double FethcOneDouble(const char* query) {
+ sqlite3_stmt* statement;
+ sqlite3_prepare(conn_, query, -1, &statement, NULL);
+ sqlite3_step(statement);
+ double value = sqlite3_column_double(statement, 0);
+ sqlite3_finalize(statement);
+ return value;
+ }
+ std::string FetchOneString(const char* query) {
+ sqlite3_stmt* statement;
+ sqlite3_prepare(conn_, query, -1, &statement, NULL);
+ sqlite3_step(statement);
+ const unsigned char* txt = sqlite3_column_text(statement, 0);
+ std::string value = std::string(reinterpret_cast<const char*>(txt));
+ sqlite3_finalize(statement);
+ return value;
+ }
+
+ private:
+ std::string file_name_;
+ sqlite3* conn_;
+};
+#endif // __QNX__
+
+} // namespace policy_test
+} // namespace components
+} // namespace test
+
+#endif // SRC_COMPONENTS_POLICY_POLICY_EXTERNAL_TEST_INCLUDE_POLICY_DRIVER_DBMS_H_
diff --git a/src/components/policy/policy_external/test/include/policy/mock_cache_manager.h b/src/components/policy/policy_external/test/include/policy/mock_cache_manager.h
new file mode 100644
index 0000000000..7d37260ef7
--- /dev/null
+++ b/src/components/policy/policy_external/test/include/policy/mock_cache_manager.h
@@ -0,0 +1,241 @@
+/*
+ * Copyright (c) 2016, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef SRC_COMPONENTS_POLICY_POLICY_EXTERNAL_TEST_INCLUDE_POLICY_MOCK_CACHE_MANAGER_H_
+#define SRC_COMPONENTS_POLICY_POLICY_EXTERNAL_TEST_INCLUDE_POLICY_MOCK_CACHE_MANAGER_H_
+
+#include <string>
+#include <vector>
+
+#include "gmock/gmock.h"
+
+#include "policy/cache_manager_interface.h"
+
+namespace policy_table = rpc::policy_table_interface_base;
+
+using namespace ::policy;
+
+namespace test {
+namespace components {
+namespace policy_test {
+
+class MockCacheManagerInterface : public ::policy::CacheManagerInterface {
+ public:
+ MOCK_METHOD4(CheckPermissions,
+ void(const PTString& app_id,
+ const PTString& hmi_level,
+ const PTString& rpc,
+ CheckPermissionResult& result));
+ MOCK_METHOD0(IsPTPreloaded, bool());
+ MOCK_METHOD0(IgnitionCyclesBeforeExchange, int());
+ MOCK_METHOD1(KilometersBeforeExchange, int(int current));
+ MOCK_CONST_METHOD1(GetPermissionsList, bool(StringArray& perm_list));
+ MOCK_METHOD2(SetCountersPassedForSuccessfulUpdate,
+ bool(Counters counter, int value));
+ MOCK_METHOD1(DaysBeforeExchange, int(uint16_t current));
+ MOCK_METHOD0(IncrementIgnitionCycles, void());
+
+ MOCK_METHOD2(SaveDeviceConsentToCache,
+ void(const std::string& device_id, const bool is_allowed));
+
+ MOCK_METHOD1(ResetCalculatedPermissionsForDevice,
+ void(const std::string& device_id));
+ MOCK_METHOD0(ResetIgnitionCycles, void());
+ MOCK_METHOD0(TimeoutResponse, int());
+ MOCK_METHOD1(SecondsBetweenRetries, bool(std::vector<int>& seconds));
+ MOCK_CONST_METHOD1(IsDeviceConsentCached, bool(const std::string& device_id));
+ MOCK_CONST_METHOD0(GetVehicleInfo, const VehicleInfo());
+ MOCK_CONST_METHOD1(GetDeviceConsent,
+ DeviceConsent(const std::string& device_id));
+ MOCK_METHOD2(SetDeviceConsent,
+ void(const std::string& device_id, bool is_allowed));
+
+ MOCK_CONST_METHOD2(HasDeviceSpecifiedConsent,
+ bool(const std::string& device_id, const bool is_allowed));
+ MOCK_CONST_METHOD1(GetCachedDeviceConsent,
+ DeviceConsent(const std::string& device_id));
+ MOCK_METHOD1(SetVINValue, bool(const std::string& value));
+ MOCK_METHOD3(GetUserFriendlyMsg,
+ std::vector<UserFriendlyMessage>(
+ const std::vector<std::string>& msg_codes,
+ const std::string& language,
+ const std::string& active_hmi_language));
+ MOCK_METHOD2(GetUpdateUrls,
+ void(const std::string& service_type,
+ EndpointUrls& out_end_points));
+ MOCK_METHOD2(GetUpdateUrls,
+ void(const uint32_t service_type, EndpointUrls& out_end_points));
+ MOCK_CONST_METHOD0(GetLockScreenIconUrl, std::string());
+ MOCK_METHOD1(
+ GetNotificationsNumber,
+ policy_table::NumberOfNotificationsType(const std::string& priority));
+ MOCK_CONST_METHOD2(GetPriority,
+ bool(const std::string& policy_app_id,
+ std::string& priority));
+ MOCK_METHOD2(Init,
+ bool(const std::string& file_name,
+ const PolicySettings* settings));
+ MOCK_METHOD0(GenerateSnapshot, utils::SharedPtr<policy_table::Table>());
+ MOCK_METHOD1(ApplyUpdate, bool(const policy_table::Table& update_pt));
+ MOCK_METHOD1(Save, bool(const policy_table::Table& table));
+ MOCK_CONST_METHOD0(UpdateRequired, bool());
+ MOCK_METHOD1(SaveUpdateRequired, void(bool status));
+ MOCK_METHOD3(GetInitialAppData,
+ bool(const std::string& app_id,
+ StringArray& nicknames,
+ StringArray& app_hmi_types));
+ MOCK_CONST_METHOD1(IsApplicationRevoked, bool(const std::string& app_id));
+ MOCK_METHOD1(GetFunctionalGroupings,
+ bool(policy_table::FunctionalGroupings& groups));
+ MOCK_CONST_METHOD1(IsApplicationRepresented, bool(const std::string& app_id));
+ MOCK_CONST_METHOD1(IsDefaultPolicy, bool(const std::string& app_id));
+ MOCK_METHOD1(SetIsDefault, bool(const std::string& app_id));
+ MOCK_METHOD1(SetIsPredata, bool(const std::string& app_id));
+ MOCK_CONST_METHOD1(IsPredataPolicy, bool(const std::string& app_id));
+ MOCK_METHOD1(SetDefaultPolicy, bool(const std::string& app_id));
+ MOCK_CONST_METHOD1(CanAppKeepContext, bool(const std::string& app_id));
+ MOCK_CONST_METHOD1(CanAppStealFocus, bool(const std::string& app_id));
+ MOCK_CONST_METHOD2(GetDefaultHMI,
+ bool(const std::string& app_id, std::string& default_hmi));
+ MOCK_METHOD0(ResetUserConsent, bool());
+ MOCK_CONST_METHOD3(GetUserPermissionsForDevice,
+ bool(const std::string& device_id,
+ StringArray& consented_groups,
+ StringArray& disallowed_groups));
+ MOCK_METHOD3(GetPermissionsForApp,
+ bool(const std::string& device_id,
+ const std::string& app_id,
+ FunctionalIdType& group_types));
+ MOCK_CONST_METHOD2(
+ GetDeviceGroupsFromPolicies,
+ bool(rpc::policy_table_interface_base::Strings& groups,
+ rpc::policy_table_interface_base::Strings& preconsented_groups));
+ MOCK_METHOD2(AddDevice,
+ bool(const std::string& device_id,
+ const std::string& connection_type));
+ MOCK_METHOD8(SetDeviceData,
+ bool(const std::string& device_id,
+ const std::string& hardware,
+ const std::string& firmware,
+ const std::string& os,
+ const std::string& os_version,
+ const std::string& carrier,
+ const uint32_t number_of_ports,
+ const std::string& connection_type));
+ MOCK_METHOD3(SetUserPermissionsForDevice,
+ bool(const std::string& device_id,
+ const StringArray& consented_groups,
+ const StringArray& disallowed_groups));
+ MOCK_METHOD2(ReactOnUserDevConsentForApp,
+ bool(const std::string& app_id, bool is_device_allowed));
+ MOCK_METHOD1(SetUserPermissionsForApp,
+ bool(const PermissionConsent& permissions));
+ MOCK_METHOD3(SetMetaInfo,
+ bool(const std::string& ccpu_version,
+ const std::string& wers_country_code,
+ const std::string& language));
+ MOCK_CONST_METHOD0(IsMetaInfoPresent, bool());
+ MOCK_METHOD1(SetSystemLanguage, bool(const std::string& language));
+ MOCK_METHOD1(Increment, void(usage_statistics::GlobalCounterId type));
+ MOCK_METHOD2(Increment,
+ void(const std::string& app_id,
+ usage_statistics::AppCounterId type));
+ MOCK_METHOD3(Set,
+ void(const std::string& app_id,
+ usage_statistics::AppInfoId type,
+ const std::string& value));
+ MOCK_METHOD3(Add,
+ void(const std::string& app_id,
+ usage_statistics::AppStopwatchId type,
+ int seconds));
+ MOCK_METHOD2(CountUnconsentedGroups,
+ int(const std::string& policy_app_id,
+ const std::string& device_id));
+ MOCK_METHOD1(GetFunctionalGroupNames, bool(FunctionalGroupNames& names));
+ MOCK_METHOD2(GetAllAppGroups,
+ void(const std::string& app_id,
+ FunctionalGroupIDs& all_group_ids));
+ MOCK_METHOD2(GetPreConsentedGroups,
+ void(const std::string& app_id,
+ FunctionalGroupIDs& preconsented_groups));
+ MOCK_METHOD4(GetConsentedGroups,
+ void(const std::string& device_id,
+ const std::string& app_id,
+ FunctionalGroupIDs& allowed_groups,
+ FunctionalGroupIDs& disallowed_groups));
+ MOCK_METHOD3(GetUnconsentedGroups,
+ void(const std::string& device_id,
+ const std::string& policy_app_id,
+ FunctionalGroupIDs& unconsented_groups));
+ MOCK_METHOD2(RemoveAppConsentForGroup,
+ void(const std::string& app_id, const std::string& group_name));
+ MOCK_METHOD1(SetPredataPolicy, bool(const std::string& app_id));
+ MOCK_METHOD0(CleanupUnpairedDevices, bool());
+ MOCK_METHOD2(SetUnpairedDevice,
+ bool(const std::string& device_id, bool unpaired));
+ MOCK_METHOD1(UnpairedDevicesList, bool(DeviceIds& device_ids));
+ MOCK_METHOD1(ResetPT, bool(const std::string& file_name));
+ MOCK_METHOD0(LoadFromBackup, bool());
+ MOCK_METHOD2(LoadFromFile,
+ bool(const std::string& file_name, policy_table::Table&));
+ MOCK_METHOD0(Backup, void());
+ MOCK_CONST_METHOD1(HeartBeatTimeout, uint32_t(const std::string& app_id));
+ MOCK_CONST_METHOD2(GetAppRequestTypes,
+ void(const std::string& policy_app_id,
+ std::vector<std::string>& request_types));
+ MOCK_METHOD1(GetHMIAppTypeAfterUpdate,
+ void(std::map<std::string, StringArray>& app_hmi_types));
+
+ MOCK_CONST_METHOD2(AppHasHMIType,
+ bool(const std::string& application_id,
+ policy_table::AppHMIType hmi_type));
+
+ MOCK_METHOD0(ResetCalculatedPermissions, void());
+ MOCK_METHOD3(AddCalculatedPermissions,
+ void(const std::string& device_id,
+ const std::string& policy_app_id,
+ const policy::Permissions& permissions));
+ MOCK_METHOD3(IsPermissionsCalculated,
+ bool(const std::string& device_id,
+ const std::string& policy_app_id,
+ policy::Permissions& permission));
+ MOCK_CONST_METHOD0(GetPT, utils::SharedPtr<policy_table::Table>());
+ MOCK_CONST_METHOD0(GetMetaInfo, const MetaInfo());
+ MOCK_CONST_METHOD0(GetCertificate, std::string());
+ MOCK_METHOD1(SetDecryptedCertificate, void(const std::string&));
+ MOCK_METHOD1(set_settings, void(const PolicySettings* settings));
+};
+
+} // namespace policy_test
+} // namespace components
+} // namespace test
+
+#endif // SRC_COMPONENTS_POLICY_POLICY_EXTERNAL_TEST_INCLUDE_POLICY_MOCK_CACHE_MANAGER_H_
diff --git a/src/components/policy/policy_external/test/include/policy/mock_pt_ext_representation.h b/src/components/policy/policy_external/test/include/policy/mock_pt_ext_representation.h
new file mode 100644
index 0000000000..2dda69bd73
--- /dev/null
+++ b/src/components/policy/policy_external/test/include/policy/mock_pt_ext_representation.h
@@ -0,0 +1,146 @@
+/* Copyright (c) 2016, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_POLICY_POLICY_EXTERNAL_TEST_INCLUDE_POLICY_MOCK_PT_EXT_REPRESENTATION_H_
+#define SRC_COMPONENTS_POLICY_POLICY_EXTERNAL_TEST_INCLUDE_POLICY_MOCK_PT_EXT_REPRESENTATION_H_
+
+#include <string>
+#include <vector>
+
+#include "gmock/gmock.h"
+
+#include "policy/pt_ext_representation.h"
+#include "rpc_base/rpc_base.h"
+#include "policy/policy_table/types.h"
+#include "mock_pt_representation.h"
+
+namespace policy_table = ::rpc::policy_table_interface_base;
+
+using namespace ::policy;
+
+namespace test {
+namespace components {
+namespace policy_test {
+
+class MockPTExtRepresentation : public MockPTRepresentation,
+ public PTExtRepresentation {
+ public:
+ MOCK_METHOD1(CanAppKeepContext, bool(const std::string& app_id));
+ MOCK_METHOD1(CanAppStealFocus, bool(const std::string& app_id));
+ MOCK_METHOD2(GetDefaultHMI,
+ bool(const std::string& app_id, std::string* default_hmi));
+ MOCK_METHOD0(ResetUserConsent, bool());
+ MOCK_METHOD0(ResetDeviceConsents, bool());
+ MOCK_METHOD0(ResetAppConsents, bool());
+ MOCK_METHOD3(GetUserPermissionsForDevice,
+ bool(const std::string&, StringArray*, StringArray*));
+ MOCK_METHOD3(GetPermissionsForApp,
+ bool(const std::string&,
+ const std::string&,
+ FunctionalIdType* group_types));
+ MOCK_METHOD2(GetDeviceGroupsFromPolicies,
+ bool(policy_table::Strings*, policy_table::Strings*));
+ MOCK_METHOD2(
+ GetUserFriendlyMsg,
+ std::vector<UserFriendlyMessage>(const std::vector<std::string>& msg_code,
+ const std::string& language));
+ MOCK_METHOD8(SetDeviceData,
+ bool(const std::string& device_id,
+ const std::string& hardware,
+ const std::string& firmware,
+ const std::string& os,
+ const std::string& os_version,
+ const std::string& carrier,
+ const uint32_t number_of_ports,
+ const std::string& connection_type));
+ MOCK_METHOD6(SetDeviceData,
+ bool(const std::string&,
+ const std::string&,
+ const std::string&,
+ const std::string&,
+ const std::string&,
+ const std::string&));
+ MOCK_METHOD2(SetMaxNumberPorts,
+ bool(const std::string& device_id,
+ unsigned int number_of_ports));
+ MOCK_METHOD3(SetUserPermissionsForDevice,
+ bool(const std::string&,
+ const StringArray&,
+ const StringArray&));
+ MOCK_METHOD1(SetUserPermissionsForApp, bool(const PermissionConsent&));
+ MOCK_METHOD1(IncreaseStatisticsData, bool(StatisticsType type));
+ MOCK_METHOD3(SetAppRegistrationLanguage,
+ bool(const std::string& app_id,
+ LanguageType type,
+ const std::string& language));
+ MOCK_METHOD3(SetMetaInfo,
+ bool(const std::string& ccpu_version,
+ const std::string& wers_country_code,
+ const std::string& vin));
+ MOCK_METHOD0(IsMetaInfoPresent, bool());
+ MOCK_METHOD1(SetSystemLanguage, bool(const std::string& language));
+ MOCK_METHOD0(GetKmFromSuccessfulExchange, int());
+ MOCK_METHOD0(GetDayFromScsExchange, int());
+ MOCK_METHOD0(GetIgnitionsFromScsExchange, int());
+ MOCK_CONST_METHOD1(Increment, void(const std::string& type));
+ MOCK_CONST_METHOD2(Increment,
+ void(const std::string& app_id, const std::string& type));
+ MOCK_CONST_METHOD3(Set,
+ void(const std::string& app_id,
+ const std::string& type,
+ const std::string& value));
+ MOCK_CONST_METHOD3(Add,
+ void(const std::string& app_id,
+ const std::string& type,
+ int seconds));
+ MOCK_CONST_METHOD3(CountUnconsentedGroups,
+ bool(const std::string& app_id,
+ const std::string& device_id,
+ int* count));
+ MOCK_METHOD1(GetFunctionalGroupNames, bool(FunctionalGroupNames& names));
+ MOCK_CONST_METHOD1(CleanupUnpairedDevices, bool(const DeviceIds& device_ids));
+ MOCK_METHOD2(ReactOnUserDevConsentForApp,
+ bool(const std::string& app_id, bool is_device_allowed));
+ MOCK_METHOD1(SetPredataPolicy, bool(const std::string& app_id));
+ MOCK_METHOD2(SetIsPredata, bool(const std::string& app_id, bool is_predata));
+ MOCK_CONST_METHOD2(SetUnpairedDevice,
+ bool(const std::string& device_id, bool unpaired));
+ MOCK_CONST_METHOD1(UnpairedDevicesList, bool(DeviceIds* device_ids));
+ MOCK_CONST_METHOD2(RemoveAppConsentForGroup,
+ bool(const std::string& policy_app_id,
+ const std::string& functional_group));
+};
+
+} // namespace policy_test
+} // namespace components
+} // namespace test
+
+#endif // SRC_COMPONENTS_POLICY_POLICY_EXTERNAL_TEST_INCLUDE_POLICY_MOCK_PT_EXT_REPRESENTATION_H_
diff --git a/src/components/policy/policy_external/test/include/policy/mock_pt_representation.h b/src/components/policy/policy_external/test/include/policy/mock_pt_representation.h
new file mode 100644
index 0000000000..995c63ed20
--- /dev/null
+++ b/src/components/policy/policy_external/test/include/policy/mock_pt_representation.h
@@ -0,0 +1,109 @@
+/* Copyright (c) 2016, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_POLICY_POLICY_EXTERNAL_TEST_INCLUDE_POLICY_MOCK_PT_REPRESENTATION_H_
+#define SRC_COMPONENTS_POLICY_POLICY_EXTERNAL_TEST_INCLUDE_POLICY_MOCK_PT_REPRESENTATION_H_
+
+#include <string>
+#include <vector>
+
+#include "gmock/gmock.h"
+
+#include "policy/pt_representation.h"
+#include "rpc_base/rpc_base.h"
+#include "policy/policy_table/types.h"
+
+namespace policy_table = ::rpc::policy_table_interface_base;
+
+namespace test {
+namespace components {
+namespace policy_test {
+
+class MockPTRepresentation : virtual public ::policy::PTRepresentation {
+ public:
+ MOCK_METHOD4(CheckPermissions,
+ void(const ::policy::PTString& app_id,
+ const ::policy::PTString& hmi_level,
+ const ::policy::PTString& rpc,
+ ::policy::CheckPermissionResult& result));
+ MOCK_METHOD0(IsPTPreloaded, bool());
+ MOCK_METHOD0(IgnitionCyclesBeforeExchange, int());
+ MOCK_METHOD1(KilometersBeforeExchange, int(int current));
+ MOCK_METHOD2(SetCountersPassedForSuccessfulUpdate,
+ bool(int kilometers, int days_after_epoch));
+ MOCK_METHOD1(DaysBeforeExchange, int(uint16_t current));
+ MOCK_METHOD0(IncrementIgnitionCycles, void());
+ MOCK_METHOD0(ResetIgnitionCycles, void());
+ MOCK_METHOD0(TimeoutResponse, int());
+ MOCK_METHOD1(SecondsBetweenRetries, bool(std::vector<int>* seconds));
+ MOCK_METHOD2(GetPriority,
+ bool(const std::string& app_id, std::string* priority));
+ MOCK_CONST_METHOD0(GetVehicleInfo, const ::policy::VehicleInfo());
+ MOCK_METHOD1(SetVINValue, bool(const std::string& value));
+ MOCK_METHOD2(GetUserFriendlyMsg,
+ std::vector< ::policy::UserFriendlyMessage>(
+ const std::vector<std::string>& msg_code,
+ const std::string& language));
+ MOCK_METHOD2(GetUpdateUrls, void(int service_type, ::policy::EndpointUrls&));
+ MOCK_METHOD1(GetNotificationsNumber, int(const std::string& priority));
+ MOCK_METHOD0(Init, ::policy::InitResult());
+ MOCK_METHOD0(Close, bool());
+ MOCK_METHOD0(Clear, bool());
+ MOCK_METHOD0(Drop, bool());
+ MOCK_CONST_METHOD0(GenerateSnapshot, utils::SharedPtr<policy_table::Table>());
+ MOCK_METHOD1(Save, bool(const policy_table::Table& table));
+ MOCK_CONST_METHOD0(UpdateRequired, bool());
+ MOCK_METHOD1(SaveUpdateRequired, void(bool value));
+ MOCK_METHOD3(GetInitialAppData,
+ bool(const std::string& app_id,
+ ::policy::StringArray* nicknames,
+ ::policy::StringArray* app_types));
+
+ MOCK_METHOD4(SaveApplicationCustomData,
+ bool(const std::string& app_id,
+ bool is_revoked,
+ bool is_default,
+ bool is_predata));
+
+ MOCK_CONST_METHOD1(IsApplicationRevoked, bool(const std::string& app_id));
+ MOCK_METHOD1(GetFunctionalGroupings,
+ bool(policy_table::FunctionalGroupings& groups));
+ MOCK_CONST_METHOD1(IsApplicationRepresented, bool(const std::string& app_id));
+ MOCK_CONST_METHOD1(IsDefaultPolicy, bool(const std::string& app_id));
+ MOCK_METHOD1(SetDefaultPolicy, bool(const std::string& app_id));
+ MOCK_CONST_METHOD1(IsPredataPolicy, bool(const std::string& app_id));
+};
+
+} // namespace policy_test
+} // namespace components
+} // namespace test
+
+#endif // SRC_COMPONENTS_POLICY_POLICY_EXTERNAL_TEST_INCLUDE_POLICY_MOCK_PT_REPRESENTATION_H_
diff --git a/src/components/policy/policy_external/test/include/policy/mock_update_status_manager.h b/src/components/policy/policy_external/test/include/policy/mock_update_status_manager.h
new file mode 100644
index 0000000000..a1c808d23a
--- /dev/null
+++ b/src/components/policy/policy_external/test/include/policy/mock_update_status_manager.h
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2017, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef SRC_COMPONENTS_POLICY_POLICY_EXTERNAL_TEST_INCLUDE_POLICY_MOCK_UPDATE_STATUS_MANAGER_H_
+#define SRC_COMPONENTS_POLICY_POLICY_EXTERNAL_TEST_INCLUDE_POLICY_MOCK_UPDATE_STATUS_MANAGER_H_
+
+#include "gmock/gmock.h"
+
+#include "policy/update_status_manager.h"
+
+namespace test {
+namespace components {
+namespace policy_test {
+
+class MockUpdateStatusManager : public ::policy::UpdateStatusManager {
+ public:
+ MOCK_METHOD1(set_listener, void(PolicyListener* listener));
+ MOCK_METHOD1(OnUpdateSentOut, void(uint32_t update_timeout));
+ MOCK_METHOD0(OnUpdateTimeoutOccurs, void());
+ MOCK_METHOD0(OnValidUpdateReceived, void());
+ MOCK_METHOD0(OnWrongUpdateReceived, void());
+ MOCK_METHOD1(OnResetDefaultPT, void(bool is_update_required));
+ MOCK_METHOD0(OnResetRetrySequence, void());
+ MOCK_METHOD1(OnNewApplicationAdded, void(const DeviceConsent));
+ MOCK_METHOD1(OnPolicyInit, void(bool is_update_required));
+ MOCK_METHOD0(GetUpdateStatus, PolicyTableStatus());
+};
+
+} // namespace policy_test
+} // namespace components
+} // namespace test
+
+#endif // SRC_COMPONENTS_POLICY_POLICY_EXTERNAL_TEST_INCLUDE_POLICY_MOCK_UPDATE_STATUS_MANAGER_H_
diff --git a/src/components/policy/policy_external/test/include/policy/policy_manager_impl_test_base.h b/src/components/policy/policy_external/test/include/policy/policy_manager_impl_test_base.h
new file mode 100644
index 0000000000..e0fc308cbc
--- /dev/null
+++ b/src/components/policy/policy_external/test/include/policy/policy_manager_impl_test_base.h
@@ -0,0 +1,245 @@
+/*
+ * Copyright (c) 2016, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef SRC_COMPONENTS_POLICY_POLICY_EXTERNAL_TEST_INCLUDE_POLICY_POLICY_MANAGER_IMPL_TEST_BASE_H_
+#define SRC_COMPONENTS_POLICY_POLICY_EXTERNAL_TEST_INCLUDE_POLICY_POLICY_MANAGER_IMPL_TEST_BASE_H_
+
+#include <string>
+#include <vector>
+
+#include "gtest/gtest.h"
+
+#include "policy/policy_manager_impl.h"
+
+#include "policy/mock_cache_manager.h"
+#include "policy/mock_update_status_manager.h"
+#include "policy/mock_policy_listener.h"
+#include "policy/mock_policy_settings.h"
+
+namespace test {
+namespace components {
+namespace policy_test {
+
+using ::testing::NiceMock;
+using ::policy::PolicyManagerImpl;
+
+typedef std::multimap<std::string, policy_table::Rpcs&>
+ UserConsentPromptToRpcsConnections;
+
+typedef utils::SharedPtr<policy_table::Table> PolicyTableSPtr;
+
+namespace {
+const std::string kSdlPreloadedPtJson = "json/sdl_preloaded_pt.json";
+const std::string kSdlPreloadedPtJson2 = "json/sdl_preloaded_pt1.json";
+const std::string kFilePtUpdateJson = "json/file_pt_update.json";
+const std::string kHmiLevelFull = "FULL";
+const std::string kHmiLevelLimited = "LIMITED";
+const std::string kHmiLevelBackground = "BACKGROUND";
+const std::string kHmiLevelNone = "None";
+
+const std::string kPtuJson = "json/PTU.json";
+const std::string kPtu3Json = "json/PTU3.json";
+const std::string kValidSdlPtUpdateJson = "json/valid_sdl_pt_update.json";
+const std::string kPtuRequestTypeJson = "json/ptu_requestType.json";
+const std::string kPtu2RequestTypeJson = "json/ptu2_requestType.json";
+} // namespace
+
+struct StringsForUpdate {
+ std::string new_field_value_;
+ std::string new_field_name_;
+ std::string new_date_;
+};
+
+char GenRandomChar(char range_from, char range_to);
+struct StringsForUpdate CreateNewRandomData(StringsForUpdate& str);
+void CheckIsParamInList(const ::policy::RPCParams& list,
+ const std::string& parameter);
+Json::Value createPTforLoad();
+void InsertRpcParametersInList(::policy::RPCParams& input_params);
+
+template <typename T>
+void SortAndCheckEquality(std::vector<T> first, std::vector<T> second) {
+ ASSERT_EQ(first.size(), second.size());
+ std::sort(first.begin(), first.end());
+ std::sort(second.begin(), second.end());
+
+ EXPECT_TRUE(std::equal(first.begin(), first.end(), second.begin()));
+}
+
+template <typename T>
+std::string NumberToString(T Number) {
+ std::ostringstream ss;
+ ss << Number;
+ return ss.str();
+}
+
+class PolicyManagerImplTest : public ::testing::Test {
+ public:
+ PolicyManagerImplTest();
+
+ protected:
+ const std::string unpaired_device_id_;
+
+ PolicyManagerImpl* manager_;
+ MockCacheManagerInterface* cache_manager_;
+ MockUpdateStatusManager update_manager_;
+ NiceMock<MockPolicyListener> listener_;
+
+ void SetUp() OVERRIDE;
+
+ void TearDown() OVERRIDE;
+
+ ::testing::AssertionResult IsValid(const policy_table::Table& table);
+};
+
+class PolicyManagerImplTest2 : public ::testing::Test {
+ public:
+ PolicyManagerImplTest2();
+
+ protected:
+ const std::string app_id_1_;
+ const std::string app_id_2_;
+ const std::string app_id_3_;
+ const std::string device_id_1_;
+ const std::string device_id_2_;
+ const std::string application_id_;
+ const std::string app_storage_folder_;
+ const std::string preloadet_pt_filename_;
+ const bool in_memory_;
+
+ PolicyManagerImpl* manager_;
+ NiceMock<MockPolicyListener> listener_;
+ ::policy::StringArray hmi_level_;
+ ::policy::StringArray pt_request_types_;
+ size_t ptu_request_types_size_;
+ uint32_t index_;
+ Json::Value ptu_request_types_;
+ NiceMock<policy_handler_test::MockPolicySettings> policy_settings_;
+
+ void SetUp() OVERRIDE;
+
+ ::policy::StringArray JsonToVectorString(
+ const Json::Value& PTU_request_types);
+
+ const Json::Value GetPTU(const std::string& file_name);
+
+ void CreateLocalPT(const std::string& file_name);
+
+ void AddRTtoPT(const std::string& update_file_name,
+ const std::string& section_name,
+ const uint32_t rt_number,
+ const uint32_t invalid_rt_number);
+
+ void AddRTtoAppSectionPT(const std::string& update_file_name,
+ const std::string& section_name,
+ const uint32_t rt_number,
+ const uint32_t invalid_rt_number);
+
+ std::vector<policy_table::RequestType> PushRequestTypesToContainer(
+ const ::policy::StringArray& temp_result);
+
+ void CheckResultForValidRT();
+
+ void CheckResultForInvalidRT();
+
+ void FillMultimapFromFunctionalGroupings(
+ UserConsentPromptToRpcsConnections& input_multimap,
+ policy_table::FunctionalGroupings& fg_table);
+
+ void GetFunctionalGroupingsFromManager(
+ policy_table::FunctionalGroupings& input_functional_groupings);
+
+ void TearDown() OVERRIDE;
+
+ void ResetOutputList(::policy::CheckPermissionResult& output);
+ // To avoid duplicate test with different json files
+ void CheckPermissions_AllParamsAllowed_CheckRpcsInDiffLvls(
+ const std::string& update_file);
+
+ // To avoid duplicates in tests
+ void CheckRpcPermissions(const std::string& rpc_name,
+ const PermitResult& expected_permission);
+
+ // To avoid duplicate arrange of test
+ void AddSetDeviceData();
+
+ // Load Json File and set it as PTU
+ void LoadPTUFromJsonFile(const std::string& update_file);
+};
+
+class PolicyManagerImplTest_RequestTypes : public ::testing::Test {
+ public:
+ PolicyManagerImplTest_RequestTypes();
+
+ protected:
+ const ::policy::StringArray kJsonFiles;
+ const std::string kAppId;
+ const std::string kDefaultAppId;
+ const std::string app_storage_folder_;
+ const std::string preloadet_pt_filename_;
+
+ utils::SharedPtr<PolicyManagerImpl> policy_manager_impl_sptr_;
+ NiceMock<MockPolicyListener> listener_;
+ NiceMock<policy_handler_test::MockPolicySettings> policy_settings_;
+
+ void SetUp() OVERRIDE;
+
+ const Json::Value GetPTU(const std::string& file_name);
+
+ void RefreshPT(const std::string& preloaded_pt_file,
+ const std::string& update_pt_file);
+
+ PolicyTableSPtr GetPolicyTableSnapshot();
+
+ policy_table::RequestTypes GetRequestTypesForApplication(
+ const std::string& app_id);
+
+ void CompareAppRequestTypesWithDefault(const std::string& app_id,
+ const std::string& ptu_file);
+
+ policy_table::RequestTypes CreateDefaultAppPTURequestValues();
+
+ policy_table::RequestTypes CreateDefaultAppDatabaseRequestValues();
+
+ policy_table::RequestTypes CreatePreDataConsentAppPTURequestValues();
+
+ void CompareRequestTypesContainers(
+ const policy_table::RequestTypes& expected_data,
+ const policy_table::RequestTypes& received_data);
+
+ void TearDown() OVERRIDE;
+};
+
+} // namespace policy_test
+} // namespace components
+} // namespace test
+
+#endif // SRC_COMPONENTS_POLICY_POLICY_EXTERNAL_TEST_INCLUDE_POLICY_POLICY_MANAGER_IMPL_TEST_BASE_H_