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

Unified Diff: chrome/browser/prefs/tracked/pref_hash_browsertest.cc

Issue 2903933002: Re-enable PrefHashBrowserTest with a few more mitigations and cleanups. (Closed)
Patch Set: Created 3 years, 7 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/prefs/tracked/pref_hash_browsertest.cc
diff --git a/chrome/browser/prefs/tracked/pref_hash_browsertest.cc b/chrome/browser/prefs/tracked/pref_hash_browsertest.cc
index 6cf4a89d3fa98a2ab9b34409ddd82bc80b69e8c7..202c30a8c9df327bd2e5ca6a7faa8af561a114e8 100644
--- a/chrome/browser/prefs/tracked/pref_hash_browsertest.cc
+++ b/chrome/browser/prefs/tracked/pref_hash_browsertest.cc
@@ -44,7 +44,8 @@
#endif
#if defined(OS_WIN)
-#include "base/test/test_reg_util_win.h"
+#include "base/win/registry.h"
+#include "chrome/install_static/install_util.h"
#endif
namespace {
@@ -67,9 +68,25 @@ enum AllowedBuckets {
#if defined(OS_WIN)
base::string16 GetRegistryPathForTestProfile() {
+ // Cleanup follow-up to http://crbug.com/721245 for the previous location of
+ // this test key which had similar problems (to a lesser extent). It's
+ // redundant but harmless to have multiple callers hit this on the same
+ // machine. TODO(gab): remove this mid-june 2017.
+ base::win::RegKey key;
+ if (key.Open(HKEY_CURRENT_USER, L"SOFTWARE\\Chromium\\PrefHashBrowserTest",
+ KEY_SET_VALUE | KEY_WOW64_32KEY) == ERROR_SUCCESS) {
+ LONG result = key.DeleteKey(L"");
+ EXPECT_TRUE(result == ERROR_SUCCESS || result == ERROR_FILE_NOT_FOUND);
+ }
+
base::FilePath profile_dir;
EXPECT_TRUE(PathService::Get(chrome::DIR_USER_DATA, &profile_dir));
- return L"SOFTWARE\\Chromium\\PrefHashBrowserTest\\" +
+
+ // Use a location under the real PreferenceMACs path so that the backup
+ // cleanup logic in ChromeTestLauncherDelegate::PreSharding() for interrupted
+ // tests covers this test key as well.
+ return install_static::GetRegistryPath() +
+ L"\\PreferenceMACs\\PrefHashBrowserTest\\" +
profile_dir.BaseName().value();
}
#endif
@@ -297,8 +314,6 @@ class PrefHashBrowserTestBase
void TearDown() override {
#if defined(OS_WIN)
// When done, delete the Registry key to avoid polluting the registry.
- // TODO(proberge): it would be nice to delete keys from interrupted tests
- // as well.
if (!IsPRETest()) {
base::string16 registry_key = GetRegistryPathForTestProfile();
base::win::RegKey key;
@@ -519,9 +534,7 @@ class PrefHashBrowserTestUnchangedDefault : public PrefHashBrowserTestBase {
}
};
-// Test is flaky. crbug.com/723639
-PREF_HASH_BROWSER_TEST(PrefHashBrowserTestUnchangedDefault,
- DISABLED_UnchangedDefault);
+PREF_HASH_BROWSER_TEST(PrefHashBrowserTestUnchangedDefault, UnchangedDefault);
// Augments PrefHashBrowserTestUnchangedDefault to confirm that nothing is reset
// when nothing is tampered with, even if Chrome itself wrote custom prefs in
@@ -548,9 +561,7 @@ class PrefHashBrowserTestUnchangedCustom
}
};
-// Test is flaky. crbug.com/723639
-PREF_HASH_BROWSER_TEST(PrefHashBrowserTestUnchangedCustom,
- DISABLED_UnchangedCustom);
+PREF_HASH_BROWSER_TEST(PrefHashBrowserTestUnchangedCustom, UnchangedCustom);
// Verifies that cleared prefs are reported.
class PrefHashBrowserTestClearedAtomic : public PrefHashBrowserTestBase {
@@ -622,9 +633,7 @@ class PrefHashBrowserTestClearedAtomic : public PrefHashBrowserTestBase {
}
};
-// Test is flaky. crbug.com/723639
-PREF_HASH_BROWSER_TEST(PrefHashBrowserTestClearedAtomic,
- DISABLED_ClearedAtomic);
+PREF_HASH_BROWSER_TEST(PrefHashBrowserTestClearedAtomic, ClearedAtomic);
// Verifies that clearing the MACs results in untrusted Initialized pings for
// non-null protected prefs.
@@ -758,9 +767,8 @@ class PrefHashBrowserTestUntrustedInitialized : public PrefHashBrowserTestBase {
}
};
-// Test is flaky. crbug.com/723639
PREF_HASH_BROWSER_TEST(PrefHashBrowserTestUntrustedInitialized,
- DISABLED_UntrustedInitialized);
+ UntrustedInitialized);
// Verifies that changing an atomic pref results in it being reported (and reset
// if the protection level allows it).
@@ -858,9 +866,7 @@ class PrefHashBrowserTestChangedAtomic : public PrefHashBrowserTestBase {
}
};
-// Test is flaky. crbug.com/723639
-PREF_HASH_BROWSER_TEST(PrefHashBrowserTestChangedAtomic,
- DISABLED_ChangedAtomic);
+PREF_HASH_BROWSER_TEST(PrefHashBrowserTestChangedAtomic, ChangedAtomic);
// Verifies that changing or adding an entry in a split pref results in both
// items being reported (and remove if the protection level allows it).
@@ -967,9 +973,7 @@ class PrefHashBrowserTestChangedSplitPref : public PrefHashBrowserTestBase {
}
};
-// Test is flaky. crbug.com/723639
-PREF_HASH_BROWSER_TEST(PrefHashBrowserTestChangedSplitPref,
- DISABLED_ChangedSplitPref);
+PREF_HASH_BROWSER_TEST(PrefHashBrowserTestChangedSplitPref, ChangedSplitPref);
// Verifies that adding a value to unprotected preferences for a key which is
// still using the default (i.e. has no value stored in protected preferences)
@@ -1053,9 +1057,8 @@ class PrefHashBrowserTestUntrustedAdditionToPrefs
}
};
-// Test is flaky. crbug.com/723639
PREF_HASH_BROWSER_TEST(PrefHashBrowserTestUntrustedAdditionToPrefs,
- DISABLED_UntrustedAdditionToPrefs);
+ UntrustedAdditionToPrefs);
// Verifies that adding a value to unprotected preferences while wiping a
// user-selected value from protected preferences doesn't allow that value to
@@ -1141,9 +1144,8 @@ class PrefHashBrowserTestUntrustedAdditionToPrefsAfterWipe
}
};
-// Test is flaky. crbug.com/723639
PREF_HASH_BROWSER_TEST(PrefHashBrowserTestUntrustedAdditionToPrefsAfterWipe,
- DISABLED_UntrustedAdditionToPrefsAfterWipe);
+ UntrustedAdditionToPrefsAfterWipe);
#if defined(OS_WIN)
class PrefHashBrowserTestRegistryValidationFailure
@@ -1186,9 +1188,8 @@ class PrefHashBrowserTestRegistryValidationFailure
}
};
-// Test is flaky. crbug.com/723639
PREF_HASH_BROWSER_TEST(PrefHashBrowserTestRegistryValidationFailure,
- DISABLED_RegistryValidationFailure);
+ RegistryValidationFailure);
#endif
// Verifies that all preferences related to choice of default search engine are
@@ -1293,6 +1294,4 @@ class PrefHashBrowserTestDefaultSearch : public PrefHashBrowserTestBase {
}
};
-// Test is flaky. crbug.com/723639
-PREF_HASH_BROWSER_TEST(PrefHashBrowserTestDefaultSearch,
- DISABLED_SearchProtected);
+PREF_HASH_BROWSER_TEST(PrefHashBrowserTestDefaultSearch, SearchProtected);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698