Revert "Merge latest oemcrypto-v17 change"

This reverts commit 642965c678.

Reason for revert: Droidfood Blocking Bug: 217145027

Change-Id: I669b72fcd91c62e28883b5f55eb36af274d85806
(cherry picked from commit 8dbea15e5da05b371572297041454569dc166c90)
Merged-In:I669b72fcd91c62e28883b5f55eb36af274d85806
This commit is contained in:
Daniel Chapin
2022-01-31 19:21:18 +00:00
committed by Android Build Coastguard Worker
parent 860a48ff8c
commit 5558e492c9
176 changed files with 296842 additions and 301106 deletions

View File

@@ -10,7 +10,7 @@
#include "file_store.h"
#include "test_vectors.h"
namespace wvutil {
namespace wvcdm {
namespace {
const std::string kTestDirName = "test_dir";
@@ -31,14 +31,14 @@ class FileUtilsTest : public testing::Test {
virtual void TearDown() { RemoveTestDir(); }
void CreateTestDir() {
if (!file_system_.Exists(wvcdm::test_vectors::kTestDir)) {
EXPECT_TRUE(FileUtils::CreateDirectory(wvcdm::test_vectors::kTestDir));
if (!file_system_.Exists(test_vectors::kTestDir)) {
EXPECT_TRUE(FileUtils::CreateDirectory(test_vectors::kTestDir));
}
EXPECT_TRUE(file_system_.Exists(wvcdm::test_vectors::kTestDir));
EXPECT_TRUE(file_system_.Exists(test_vectors::kTestDir));
}
void RemoveTestDir() {
EXPECT_TRUE(file_system_.Remove(wvcdm::test_vectors::kTestDir));
EXPECT_TRUE(file_system_.Remove(test_vectors::kTestDir));
}
void CreateTestFile(const std::string file_path) {
@@ -63,43 +63,43 @@ class FileUtilsTest : public testing::Test {
};
TEST_F(FileUtilsTest, CreateDirectory) {
std::string dir_wo_delimiter = wvcdm::test_vectors::kTestDir.substr(
0, wvcdm::test_vectors::kTestDir.size() - 1);
std::string dir_wo_delimiter =
test_vectors::kTestDir.substr(0, test_vectors::kTestDir.size() - 1);
if (file_system_.Exists(dir_wo_delimiter))
EXPECT_TRUE(file_system_.Remove(dir_wo_delimiter));
EXPECT_FALSE(file_system_.Exists(dir_wo_delimiter));
EXPECT_TRUE(FileUtils::CreateDirectory(dir_wo_delimiter));
EXPECT_TRUE(file_system_.Exists(dir_wo_delimiter));
EXPECT_TRUE(file_system_.Remove(dir_wo_delimiter));
EXPECT_TRUE(FileUtils::CreateDirectory(wvcdm::test_vectors::kTestDir));
EXPECT_TRUE(file_system_.Exists(wvcdm::test_vectors::kTestDir));
EXPECT_TRUE(file_system_.Remove(wvcdm::test_vectors::kTestDir));
EXPECT_TRUE(FileUtils::CreateDirectory(test_vectors::kTestDir));
EXPECT_TRUE(file_system_.Exists(test_vectors::kTestDir));
EXPECT_TRUE(file_system_.Remove(test_vectors::kTestDir));
}
TEST_F(FileUtilsTest, IsDir) {
std::string path = wvcdm::test_vectors::kTestDir + kTestFileName;
std::string path = test_vectors::kTestDir + kTestFileName;
std::unique_ptr<File> file = file_system_.Open(path, FileSystem::kCreate);
EXPECT_TRUE(file);
EXPECT_TRUE(file_system_.Exists(path));
EXPECT_TRUE(file_system_.Exists(wvcdm::test_vectors::kTestDir));
EXPECT_TRUE(file_system_.Exists(test_vectors::kTestDir));
EXPECT_FALSE(FileUtils::IsDirectory(path));
EXPECT_TRUE(FileUtils::IsDirectory(wvcdm::test_vectors::kTestDir));
EXPECT_TRUE(FileUtils::IsDirectory(test_vectors::kTestDir));
}
TEST_F(FileUtilsTest, IsRegularFile) {
std::string path = wvcdm::test_vectors::kTestDir + kTestFileName;
std::string path = test_vectors::kTestDir + kTestFileName;
std::unique_ptr<File> file = file_system_.Open(path, FileSystem::kCreate);
EXPECT_TRUE(file);
EXPECT_TRUE(file_system_.Exists(path));
EXPECT_TRUE(file_system_.Exists(wvcdm::test_vectors::kTestDir));
EXPECT_TRUE(file_system_.Exists(test_vectors::kTestDir));
EXPECT_TRUE(FileUtils::IsRegularFile(path));
EXPECT_FALSE(FileUtils::IsRegularFile(wvcdm::test_vectors::kTestDir));
EXPECT_FALSE(FileUtils::IsRegularFile(test_vectors::kTestDir));
}
TEST_F(FileUtilsTest, CopyFile) {
std::string path = wvcdm::test_vectors::kTestDir + kTestFileName;
std::string path = test_vectors::kTestDir + kTestFileName;
file_system_.Remove(path);
std::string write_data = GenerateRandomData(600);
@@ -110,7 +110,7 @@ TEST_F(FileUtilsTest, CopyFile) {
write_data_size);
ASSERT_TRUE(file_system_.Exists(path));
std::string path_copy = wvcdm::test_vectors::kTestDir + kTestFileName2;
std::string path_copy = test_vectors::kTestDir + kTestFileName2;
EXPECT_FALSE(file_system_.Exists(path_copy));
EXPECT_TRUE(FileUtils::Copy(path, path_copy));
@@ -127,15 +127,15 @@ TEST_F(FileUtilsTest, CopyFile) {
TEST_F(FileUtilsTest, ListEmptyDirectory) {
std::vector<std::string> files;
EXPECT_TRUE(FileUtils::List(wvcdm::test_vectors::kTestDir, &files));
EXPECT_TRUE(FileUtils::List(test_vectors::kTestDir, &files));
EXPECT_EQ(0u, files.size());
}
TEST_F(FileUtilsTest, ListFiles) {
std::string path = wvcdm::test_vectors::kTestDir + kTestDirName;
std::string path = test_vectors::kTestDir + kTestDirName;
EXPECT_TRUE(FileUtils::CreateDirectory(path));
path = wvcdm::test_vectors::kTestDir + kTestFileName;
path = test_vectors::kTestDir + kTestFileName;
std::string write_data = GenerateRandomData(600);
size_t write_data_size = write_data.size();
std::unique_ptr<File> file = file_system_.Open(path, FileSystem::kCreate);
@@ -143,7 +143,7 @@ TEST_F(FileUtilsTest, ListFiles) {
EXPECT_EQ(file->Write(write_data.data(), write_data_size), write_data_size);
EXPECT_TRUE(file_system_.Exists(path));
path = wvcdm::test_vectors::kTestDir + kTestFileName2;
path = test_vectors::kTestDir + kTestFileName2;
write_data = GenerateRandomData(600);
write_data_size = write_data.size();
file = file_system_.Open(path, FileSystem::kCreate);
@@ -152,7 +152,7 @@ TEST_F(FileUtilsTest, ListFiles) {
EXPECT_TRUE(file_system_.Exists(path));
std::vector<std::string> files;
EXPECT_TRUE(FileUtils::List(wvcdm::test_vectors::kTestDir, &files));
EXPECT_TRUE(FileUtils::List(test_vectors::kTestDir, &files));
EXPECT_EQ(3u, files.size());
for (size_t i = 0; i < files.size(); ++i) {
@@ -162,7 +162,7 @@ TEST_F(FileUtilsTest, ListFiles) {
}
TEST_F(FileUtilsTest, RemoveDirectory) {
std::string path = wvcdm::test_vectors::kTestDir;
std::string path = test_vectors::kTestDir;
EXPECT_TRUE(FileUtils::CreateDirectory(path));
EXPECT_TRUE(FileUtils::Exists(path));
@@ -171,8 +171,8 @@ TEST_F(FileUtilsTest, RemoveDirectory) {
}
TEST_F(FileUtilsTest, RemoveTopLevelDirectory) {
std::string base_path = wvcdm::test_vectors::kTestDir;
std::string sub_dir_path = wvcdm::test_vectors::kTestDir + kTestDirName;
std::string base_path = test_vectors::kTestDir;
std::string sub_dir_path = test_vectors::kTestDir + kTestDirName;
EXPECT_TRUE(FileUtils::CreateDirectory(sub_dir_path));
EXPECT_TRUE(FileUtils::Exists(sub_dir_path));
@@ -191,7 +191,7 @@ TEST_F(FileUtilsTest, RemoveTopLevelDirectory) {
}
TEST_F(FileUtilsTest, RemoveFilesUsingWildcard) {
std::string base_path = wvcdm::test_vectors::kTestDir + kTestDirName;
std::string base_path = test_vectors::kTestDir + kTestDirName;
EXPECT_TRUE(FileUtils::CreateDirectory(base_path));
EXPECT_TRUE(FileUtils::Exists(base_path));
@@ -221,7 +221,7 @@ TEST_F(FileUtilsTest, RemoveFilesUsingWildcard) {
}
TEST_F(FileUtilsTest, RemoveFilesUsingWildcardAndExtension) {
std::string base_path = wvcdm::test_vectors::kTestDir + kTestDirName;
std::string base_path = test_vectors::kTestDir + kTestDirName;
EXPECT_TRUE(FileUtils::CreateDirectory(base_path));
EXPECT_TRUE(FileUtils::Exists(base_path));
@@ -252,7 +252,7 @@ TEST_F(FileUtilsTest, RemoveFilesUsingWildcardAndExtension) {
}
TEST_F(FileUtilsTest, RemoveFilesUsingPrefixAndWildcard) {
std::string base_path = wvcdm::test_vectors::kTestDir + kTestDirName;
std::string base_path = test_vectors::kTestDir + kTestDirName;
EXPECT_TRUE(FileUtils::CreateDirectory(base_path));
EXPECT_TRUE(FileUtils::Exists(base_path));
@@ -283,7 +283,7 @@ TEST_F(FileUtilsTest, RemoveFilesUsingPrefixAndWildcard) {
}
TEST_F(FileUtilsTest, RemoveFilesUsingPrefixWildcardAndExtension) {
std::string base_path = wvcdm::test_vectors::kTestDir + kTestDirName;
std::string base_path = test_vectors::kTestDir + kTestDirName;
EXPECT_TRUE(FileUtils::CreateDirectory(base_path));
EXPECT_TRUE(FileUtils::Exists(base_path));
@@ -314,4 +314,4 @@ TEST_F(FileUtilsTest, RemoveFilesUsingPrefixWildcardAndExtension) {
EXPECT_TRUE(FileUtils::Exists(file_path_with_different_prefix));
}
} // namespace wvutil
} // namespace wvcdm