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

Unified Diff: chrome/browser/prefs/pref_service_browsertest.cc

Issue 90563003: Fix a race condition in preference metric reporting. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Also filter 'empty loads' as in new run or corrupted pref file scenarios. Created 7 years 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
« no previous file with comments | « chrome/browser/prefs/pref_metrics_service_unittest.cc ('k') | chrome/browser/profiles/profile_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/prefs/pref_service_browsertest.cc
diff --git a/chrome/browser/prefs/pref_service_browsertest.cc b/chrome/browser/prefs/pref_service_browsertest.cc
index f5249815f61c366402271d8ed543e8cc1db1a197..26f88204cb352170da41a4670b27f34af471c90f 100644
--- a/chrome/browser/prefs/pref_service_browsertest.cc
+++ b/chrome/browser/prefs/pref_service_browsertest.cc
@@ -65,9 +65,8 @@ class PreferenceServiceTest : public InProcessBrowserTest {
base::FilePath user_data_directory;
PathService::Get(chrome::DIR_USER_DATA, &user_data_directory);
- base::FilePath reference_pref_file;
if (new_profile_) {
- reference_pref_file = ui_test_utils::GetTestFilePath(
+ original_pref_file_ = ui_test_utils::GetTestFilePath(
base::FilePath().AppendASCII("profiles").
AppendASCII("window_placement").
AppendASCII("Default"),
@@ -77,17 +76,17 @@ class PreferenceServiceTest : public InProcessBrowserTest {
CHECK(base::CreateDirectory(tmp_pref_file_));
tmp_pref_file_ = tmp_pref_file_.Append(chrome::kPreferencesFilename);
} else {
- reference_pref_file = ui_test_utils::GetTestFilePath(
+ original_pref_file_ = ui_test_utils::GetTestFilePath(
base::FilePath().AppendASCII("profiles").
AppendASCII("window_placement"),
base::FilePath().Append(chrome::kLocalStateFilename));
tmp_pref_file_ = user_data_directory.Append(chrome::kLocalStateFilename);
}
- CHECK(base::PathExists(reference_pref_file));
+ CHECK(base::PathExists(original_pref_file_));
// Copy only the Preferences file if |new_profile_|, or Local State if not,
// and the rest will be automatically created.
- CHECK(base::CopyFile(reference_pref_file, tmp_pref_file_));
+ CHECK(base::CopyFile(original_pref_file_, tmp_pref_file_));
#if defined(OS_WIN)
// Make the copy writable. On POSIX we assume the umask allows files
@@ -99,6 +98,7 @@ class PreferenceServiceTest : public InProcessBrowserTest {
}
protected:
+ base::FilePath original_pref_file_;
base::FilePath tmp_pref_file_;
private:
@@ -127,7 +127,7 @@ IN_PROC_BROWSER_TEST_F(PreservedWindowPlacementIsLoaded, Test) {
// The window should open with the new reference profile, with window
// placement values stored in the user data directory.
- JSONFileValueSerializer deserializer(tmp_pref_file_);
+ JSONFileValueSerializer deserializer(original_pref_file_);
scoped_ptr<base::Value> root(deserializer.Deserialize(NULL, NULL));
ASSERT_TRUE(root.get());
@@ -188,7 +188,7 @@ IN_PROC_BROWSER_TEST_F(PreservedWindowPlacementIsMigrated, Test) {
// The window should open with the old reference profile, with window
// placement values stored in Local State.
- JSONFileValueSerializer deserializer(tmp_pref_file_);
+ JSONFileValueSerializer deserializer(original_pref_file_);
scoped_ptr<base::Value> root(deserializer.Deserialize(NULL, NULL));
ASSERT_TRUE(root.get());
« no previous file with comments | « chrome/browser/prefs/pref_metrics_service_unittest.cc ('k') | chrome/browser/profiles/profile_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698