summaryrefslogtreecommitdiff
path: root/src/components/policy/policy_regular/test/sql_pt_representation_test.cc
diff options
context:
space:
mode:
authorJackLivio <jack@livio.io>2018-10-19 15:05:09 -0400
committerGitHub <noreply@github.com>2018-10-19 15:05:09 -0400
commitd36316738785c96dab2ee892762ed08c059fffde (patch)
tree168a7c0705b5bc8f0dee7ce4b511ccf71759d9b4 /src/components/policy/policy_regular/test/sql_pt_representation_test.cc
parent7f7fcbb998fb17f2954fd103349af67ea9b71a3f (diff)
parent83c5e805346d55ec7fb9f4ba8b6f6855d992273e (diff)
downloadsdl_core-d36316738785c96dab2ee892762ed08c059fffde.tar.gz
Release 5.0.0
Diffstat (limited to 'src/components/policy/policy_regular/test/sql_pt_representation_test.cc')
-rw-r--r--src/components/policy/policy_regular/test/sql_pt_representation_test.cc19
1 files changed, 13 insertions, 6 deletions
diff --git a/src/components/policy/policy_regular/test/sql_pt_representation_test.cc b/src/components/policy/policy_regular/test/sql_pt_representation_test.cc
index fd83c82b1a..7d192515dc 100644
--- a/src/components/policy/policy_regular/test/sql_pt_representation_test.cc
+++ b/src/components/policy/policy_regular/test/sql_pt_representation_test.cc
@@ -47,8 +47,7 @@
#include "json/writer.h"
#include "json/reader.h"
#include "rpc_base/rpc_base.h"
-#include "utils/shared_ptr.h"
-#include "utils/make_shared.h"
+
#include "utils/file_system.h"
#include "utils/sqlite_wrapper/sql_database.h"
@@ -78,12 +77,12 @@ class SQLPTRepresentationTest : public SQLPTRepresentation,
static const std::string kDatabaseName;
static const std::string kAppStorageFolder;
// Gtest can show message that this object doesn't destroyed
- std::auto_ptr<NiceMock<MockPolicySettings> > policy_settings_;
+ std::unique_ptr<NiceMock<MockPolicySettings> > policy_settings_;
void SetUp() OVERRIDE {
file_system::CreateDirectory(kAppStorageFolder);
reps = new SQLPTRepresentation;
- policy_settings_ = std::auto_ptr<NiceMock<MockPolicySettings> >(
+ policy_settings_ = std::unique_ptr<NiceMock<MockPolicySettings> >(
new NiceMock<MockPolicySettings>());
ON_CALL(*policy_settings_, app_storage_folder())
.WillByDefault(ReturnRef(kAppStorageFolder));
@@ -289,6 +288,7 @@ class SQLPTRepresentationTest : public SQLPTRepresentation,
app_policies["default"]["default_hmi"] = Json::Value("FULL");
app_policies["default"]["keep_context"] = Json::Value(true);
app_policies["default"]["steal_focus"] = Json::Value(true);
+ app_policies["default"]["RequestType"] = Json::Value(Json::arrayValue);
app_policies["pre_DataConsent"] = Json::Value(Json::objectValue);
app_policies["pre_DataConsent"]["memory_kb"] = Json::Value(40);
@@ -300,6 +300,9 @@ class SQLPTRepresentationTest : public SQLPTRepresentation,
app_policies["pre_DataConsent"]["is_revoked"] = Json::Value(false);
app_policies["pre_DataConsent"]["keep_context"] = Json::Value(true);
app_policies["pre_DataConsent"]["steal_focus"] = Json::Value(true);
+ app_policies["pre_DataConsent"]["RequestType"] =
+ Json::Value(Json::arrayValue);
+
app_policies["1234"] = Json::Value(Json::objectValue);
app_policies["1234"]["memory_kb"] = Json::Value(150);
app_policies["1234"]["heart_beat_timeout_ms"] = Json::Value(200);
@@ -310,6 +313,8 @@ class SQLPTRepresentationTest : public SQLPTRepresentation,
app_policies["1234"]["is_revoked"] = Json::Value(true);
app_policies["1234"]["keep_context"] = Json::Value(false);
app_policies["1234"]["steal_focus"] = Json::Value(false);
+ app_policies["1234"]["RequestType"] = Json::Value(Json::arrayValue);
+
app_policies["device"] = Json::Value(Json::objectValue);
app_policies["device"]["groups"] = Json::Value(Json::arrayValue);
app_policies["device"]["groups"][0] = Json::Value("default");
@@ -420,7 +425,9 @@ TEST_F(SQLPTRepresentationTest,
ASSERT_EQ(0, dbms->FetchOneInt(query_select));
ASSERT_TRUE(reps->RefreshDB());
// Check PT structure destroyed and tables number is 0
- const int32_t total_tables_number = 28;
+
+ // There are 29 tables in the database, now.
+ const int32_t total_tables_number = 29;
ASSERT_EQ(total_tables_number, dbms->FetchOneInt(query_select));
const char* query_select_count_of_iap_buffer_full =
"SELECT `count_of_iap_buffer_full` FROM `usage_and_error_count`";
@@ -1509,7 +1516,7 @@ TEST_F(SQLPTRepresentationTest,
ASSERT_TRUE(reps->Save(update));
// Act
- utils::SharedPtr<policy_table::Table> snapshot = reps->GenerateSnapshot();
+ std::shared_ptr<policy_table::Table> snapshot = reps->GenerateSnapshot();
snapshot->SetPolicyTableType(rpc::policy_table_interface_base::PT_SNAPSHOT);
// Remove fields which must be absent in snapshot
table["policy_table"]["consumer_friendly_messages"].removeMember("messages");