summaryrefslogtreecommitdiff
path: root/src/components/application_manager/test/app_launch/app_launch_data_json_test.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/application_manager/test/app_launch/app_launch_data_json_test.cc')
-rw-r--r--src/components/application_manager/test/app_launch/app_launch_data_json_test.cc30
1 files changed, 21 insertions, 9 deletions
diff --git a/src/components/application_manager/test/app_launch/app_launch_data_json_test.cc b/src/components/application_manager/test/app_launch/app_launch_data_json_test.cc
index 12a375685e..f7bd636a66 100644
--- a/src/components/application_manager/test/app_launch/app_launch_data_json_test.cc
+++ b/src/components/application_manager/test/app_launch/app_launch_data_json_test.cc
@@ -39,6 +39,7 @@
#include "gtest/gtest.h"
#include "json/json.h"
#include "resumption/last_state_impl.h"
+#include "resumption/last_state_wrapper_impl.h"
#include "smart_objects/smart_object.h"
#include "utils/date_time.h"
#include "utils/file_system.h"
@@ -66,8 +67,9 @@ class AppLaunchDataJsonTest : public ::testing::Test {
private:
virtual void SetUp() {
::file_system::DeleteFile(kAppStorageFile);
- test_last_state_ = std::unique_ptr<resumption::LastState>(
- new resumption::LastStateImpl(kAppStorageFolder, kAppInfoStorage));
+ last_state_wrapper_ = std::make_shared<resumption::LastStateWrapperImpl>(
+ std::make_shared<resumption::LastStateImpl>(kAppStorageFolder,
+ kAppInfoStorage));
ASSERT_TRUE(::file_system::CreateFile(kAppStorageFile));
NiceMock<app_launch_test::MockAppLaunchSettings> mock_app_launch_settings_;
@@ -75,7 +77,7 @@ class AppLaunchDataJsonTest : public ::testing::Test {
.WillByDefault(Return(15u));
res_json_.reset(
- new AppLaunchDataJson(mock_app_launch_settings_, *test_last_state_));
+ new AppLaunchDataJson(mock_app_launch_settings_, last_state_wrapper_));
}
public:
@@ -101,7 +103,7 @@ class AppLaunchDataJsonTest : public ::testing::Test {
void GetApplicationData_EXPECT_FALSE(const ApplicationData& in_data);
std::string AddCounter(const std::string& inp, int32_t val);
- std::unique_ptr<resumption::LastState> test_last_state_;
+ resumption::LastStateWrapperPtr last_state_wrapper_;
std::unique_ptr<AppLaunchDataJson> res_json_;
void SetTimestamp(const ApplicationData& in_data,
date_time::TimeDuration& timestamp);
@@ -133,9 +135,11 @@ date_time::TimeDuration AppLaunchDataJsonTest::GetApplicationData_EXPECT_TRUE(
const ApplicationData& in_data, ApplicationData& out_data) {
uint32_t sizeBeforeGetting = res_json()->GetCurentNumberOfAppData();
+ Json::Value dictionary =
+ last_state_wrapper_->get_accessor().GetData().dictionary();
int32_t index = NotFound;
Json::Value& json_data_list =
- res_json()->GetApplicationListAndIndex(in_data, index);
+ res_json()->GetApplicationListAndIndex(in_data, index, dictionary);
EXPECT_FALSE(index == NotFound);
uint32_t sizeAfterGetting = res_json()->GetCurentNumberOfAppData();
@@ -150,7 +154,8 @@ date_time::TimeDuration AppLaunchDataJsonTest::GetApplicationData_EXPECT_TRUE(
// time stamp
date_time::TimeDuration tmVal = date_time::seconds(
json_data_list[index][am::strings::app_launch_last_session].asUInt64());
-
+ last_state_wrapper_->get_accessor().GetMutableData().set_dictionary(
+ dictionary);
return tmVal;
}
@@ -158,12 +163,15 @@ void AppLaunchDataJsonTest::GetApplicationData_EXPECT_FALSE(
const ApplicationData& in_data) {
uint32_t sizeBeforeGetting = res_json()->GetCurentNumberOfAppData();
+ Json::Value dictionary =
+ last_state_wrapper_->get_accessor().GetData().dictionary();
int32_t index = NotFound;
- res_json()->GetApplicationListAndIndex(in_data, index);
+ res_json()->GetApplicationListAndIndex(in_data, index, dictionary);
EXPECT_TRUE(index == NotFound);
uint32_t sizeAfterGetting = res_json()->GetCurentNumberOfAppData();
-
+ last_state_wrapper_->get_accessor().GetMutableData().set_dictionary(
+ dictionary);
EXPECT_EQ(sizeBeforeGetting, sizeAfterGetting);
}
@@ -172,8 +180,10 @@ void AppLaunchDataJsonTest::SetTimestamp(const ApplicationData& in_data,
uint32_t sizeBeforeGetting = res_json()->GetCurentNumberOfAppData();
int32_t index = NotFound;
+ Json::Value dictionary =
+ last_state_wrapper_->get_accessor().GetData().dictionary();
Json::Value& json_data_list =
- res_json()->GetApplicationListAndIndex(in_data, index);
+ res_json()->GetApplicationListAndIndex(in_data, index, dictionary);
EXPECT_FALSE(index == NotFound);
uint32_t sizeAfterGetting = res_json()->GetCurentNumberOfAppData();
@@ -184,6 +194,8 @@ void AppLaunchDataJsonTest::SetTimestamp(const ApplicationData& in_data,
// time stamp
json_data_list[index][am::strings::app_launch_last_session] =
static_cast<Json::Value::UInt64>(date_time::getSecs(timestamp));
+ last_state_wrapper_->get_accessor().GetMutableData().set_dictionary(
+ dictionary);
}
std::string AppLaunchDataJsonTest::AddCounter(const std::string& inp,