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

Unified Diff: chrome/browser/extensions/content_verifier_browsertest.cc

Issue 2537623002: Fix flaky test ContentVerifierPolicyTest.PolicyCorruptedOnStartup (Closed)
Patch Set: review fixes Created 4 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 | « 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/extensions/content_verifier_browsertest.cc
diff --git a/chrome/browser/extensions/content_verifier_browsertest.cc b/chrome/browser/extensions/content_verifier_browsertest.cc
index 645875d85ea483c839fbfd1eef33e050467d10cb..1afe938ccca82b6724c1624048b499f0e2f1f9ab 100644
--- a/chrome/browser/extensions/content_verifier_browsertest.cc
+++ b/chrome/browser/extensions/content_verifier_browsertest.cc
@@ -707,11 +707,10 @@ class ContentVerifierPolicyTest : public ContentVerifierTest {
DownloaderTestDelegate downloader_;
};
-// Disabled due to flakiness (crbug.com/668067)
// We want to test what happens at startup with a corroption-disabled policy
// force installed extension. So we set that up in the PRE test here.
IN_PROC_BROWSER_TEST_F(ContentVerifierPolicyTest,
- DISABLED_PRE_PolicyCorruptedOnStartup) {
+ PRE_PolicyCorruptedOnStartup) {
ExtensionRegistry* registry = ExtensionRegistry::Get(profile());
RegistryObserver registry_observer(registry);
@@ -732,22 +731,23 @@ IN_PROC_BROWSER_TEST_F(ContentVerifierPolicyTest,
EXPECT_TRUE(reasons & Extension::DISABLE_CORRUPTED);
}
-// Disabled due to flakiness (crbug.com/668067)
// Now actually test what happens on the next startup after the PRE test above.
-IN_PROC_BROWSER_TEST_F(ContentVerifierPolicyTest,
- DISABLED_PolicyCorruptedOnStartup) {
- // Expect that the extension is still disabled for corruption.
+IN_PROC_BROWSER_TEST_F(ContentVerifierPolicyTest, PolicyCorruptedOnStartup) {
+ // Depdending on timing, the extension may have already been reinstalled
+ // between SetUpInProcessBrowserTestFixture and now (usually not during local
+ // testing on a developer machine, but sometimes on a heavily loaded system
+ // such as the build waterfall / trybots). If the reinstall didn't already
+ // happen, wait for it.
ExtensionPrefs* prefs = ExtensionPrefs::Get(profile());
- int reasons = prefs->GetDisableReasons(id_);
- EXPECT_TRUE(reasons & Extension::DISABLE_CORRUPTED);
-
- // Now expect that it gets reinstalled (because a job should have been kicked
- // off by the installed extension loading code).
ExtensionRegistry* registry = ExtensionRegistry::Get(profile());
- RegistryObserver registry_observer(registry);
- EXPECT_TRUE(registry_observer.WaitForInstall(id_));
- reasons = prefs->GetDisableReasons(id_);
- EXPECT_FALSE(reasons & Extension::DISABLE_CORRUPTED);
+ int disable_reasons = prefs->GetDisableReasons(id_);
+ if (disable_reasons & Extension::DISABLE_CORRUPTED) {
+ RegistryObserver registry_observer(registry);
+ EXPECT_TRUE(registry_observer.WaitForInstall(id_));
+ disable_reasons = prefs->GetDisableReasons(id_);
+ }
+ EXPECT_FALSE(disable_reasons & Extension::DISABLE_CORRUPTED);
+ EXPECT_TRUE(registry->enabled_extensions().Contains(id_));
}
} // namespace extensions
« 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