| Index: chrome/common/media_galleries/pmp_test_helper.cc
|
| diff --git a/chrome/common/media_galleries/pmp_test_helper.cc b/chrome/common/media_galleries/pmp_test_helper.cc
|
| index 12464931ace92d5650dec1dfe76de89e16deb88c..ba75d812698b51a73eb36fdd6e5e280a602367ef 100644
|
| --- a/chrome/common/media_galleries/pmp_test_helper.cc
|
| +++ b/chrome/common/media_galleries/pmp_test_helper.cc
|
| @@ -59,30 +59,36 @@ PmpTestHelper::PmpTestHelper(const std::string& table_name)
|
| }
|
|
|
| bool PmpTestHelper::Init() {
|
| - if (!temp_dir_.CreateUniqueTempDir() || !temp_dir_.IsValid())
|
| + if (!root_dir_.CreateUniqueTempDir() ||
|
| + !root_dir_.IsValid() ||
|
| + !file_util::CreateDirectory(GetDatabaseDirPath()) ||
|
| + !file_util::CreateDirectory(GetTempDirPath())) {
|
| return false;
|
| + }
|
|
|
| - base::FilePath indicator_path = temp_dir_.path().Append(
|
| + base::FilePath indicator_path = GetTempDirPath().Append(
|
| base::FilePath::FromUTF8Unsafe(table_name_ + "_0"));
|
|
|
| return file_util::WriteFile(indicator_path, NULL, 0) == 0;
|
| }
|
|
|
| +base::FilePath PmpTestHelper::GetDatabaseDirPath() {
|
| + DCHECK(root_dir_.IsValid());
|
| + return root_dir_.path().AppendASCII(kPicasaDatabaseDirName);
|
| +}
|
| +
|
| base::FilePath PmpTestHelper::GetTempDirPath() {
|
| - DCHECK(temp_dir_.IsValid());
|
| - return temp_dir_.path();
|
| + DCHECK(root_dir_.IsValid());
|
| + return root_dir_.path().AppendASCII(kPicasaTempDirName);
|
| }
|
|
|
| template<class T>
|
| bool PmpTestHelper::WriteColumnFileFromVector(
|
| const std::string& column_name, const PmpFieldType field_type,
|
| const std::vector<T>& elements_vector) {
|
| - DCHECK(temp_dir_.IsValid());
|
| -
|
| std::string file_name = table_name_ + "_" + column_name + "." + kPmpExtension;
|
|
|
| - base::FilePath path = temp_dir_.path().Append(
|
| - base::FilePath::FromUTF8Unsafe(file_name));
|
| + base::FilePath path = GetTempDirPath().AppendASCII(file_name);
|
|
|
| std::vector<char> data = PmpTestHelper::MakeHeaderAndBody(
|
| field_type, elements_vector.size(), elements_vector);
|
|
|