Rename CacheLocation to Paths.

We have a general need for overriding more paths (e.g. "/tmp"), mostly
for testing purpose. Rename CacheLocation to Paths, and use that to
manage TEMPORARY_{INSTALL,LOG}_FILE.

Test: mmma -j bootable/recovery
Test: recovery_component_test
Change-Id: Ia8ce8e5695df37ca434f13ac4d3206de1e8e9396
This commit is contained in:
Tao Bao
2018-04-25 21:46:00 -07:00
parent d97b643de4
commit 641fa97def
16 changed files with 229 additions and 212 deletions
+5 -5
View File
@@ -16,7 +16,6 @@
#include <dirent.h>
#include <fcntl.h>
#include <gtest/gtest.h>
#include <libgen.h>
#include <stdio.h>
#include <stdlib.h>
@@ -36,12 +35,13 @@
#include <android-base/test_utils.h>
#include <android-base/unique_fd.h>
#include <bsdiff/bsdiff.h>
#include <gtest/gtest.h>
#include <openssl/sha.h>
#include "applypatch/applypatch.h"
#include "applypatch/applypatch_modes.h"
#include "common/test_constants.h"
#include "otautil/cache_location.h"
#include "otautil/paths.h"
#include "otautil/print_sha1.h"
using namespace std::string_literals;
@@ -110,14 +110,14 @@ class ApplyPatchCacheTest : public ApplyPatchTest {
protected:
void SetUp() override {
ApplyPatchTest::SetUp();
CacheLocation::location().set_cache_temp_source(old_file);
Paths::Get().set_cache_temp_source(old_file);
}
};
class ApplyPatchModesTest : public ::testing::Test {
protected:
void SetUp() override {
CacheLocation::location().set_cache_temp_source(cache_source.path);
Paths::Get().set_cache_temp_source(cache_source.path);
android::base::InitLogging(nullptr, &test_logger);
android::base::SetMinimumLogSeverity(android::base::LogSeverity::DEBUG);
}
@@ -157,7 +157,7 @@ class FreeCacheTest : public ::testing::Test {
}
void SetUp() override {
CacheLocation::location().set_cache_log_directory(mock_log_dir.path);
Paths::Get().set_cache_log_directory(mock_log_dir.path);
}
// A mock method to calculate the free space. It assumes the partition has a total size of 40960