Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2651)

Unified Diff: chrome/common/media_galleries/pmp_test_helper.cc

Issue 23499006: Media Galleries API Picasa: Add file watch to invalidate database data on disk write. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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);

Powered by Google App Engine
This is Rietveld 408576698