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

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

Issue 1315713009: Fix content verification failures on unusual content script paths (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix windows compile error Created 5 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
« no previous file with comments | « no previous file | chrome/test/data/extensions/content_verifier/dot_slash_paths.crx » ('j') | 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 91c6629b242a5f6d80ad2c3db12ce850cdeaafda..a547f1d2b4b5a65c22ba0b043e8b272175f1d93f 100644
--- a/chrome/browser/extensions/content_verifier_browsertest.cc
+++ b/chrome/browser/extensions/content_verifier_browsertest.cc
@@ -325,15 +325,33 @@ IN_PROC_BROWSER_TEST_F(ContentVerifierTest, DotSlashPaths) {
job_observer.ExpectJobResult(id,
base::FilePath(FILE_PATH_LITERAL("page2.js")),
JobObserver::Result::SUCCESS);
+ job_observer.ExpectJobResult(id, base::FilePath(FILE_PATH_LITERAL("cs1.js")),
+ JobObserver::Result::SUCCESS);
+ job_observer.ExpectJobResult(id, base::FilePath(FILE_PATH_LITERAL("cs2.js")),
+ JobObserver::Result::SUCCESS);
+
+ VerifierObserver verifier_observer;
+ ContentVerifier::SetObserverForTests(&verifier_observer);
// Install a test extension we copied from the webstore that has actual
- // signatures, and contains image paths with leading "./".
+ // signatures, and contains paths with a leading "./" in various places.
const Extension* extension = InstallExtensionFromWebstore(
test_data_dir_.AppendASCII("content_verifier/dot_slash_paths.crx"), 1);
ASSERT_TRUE(extension);
ASSERT_EQ(extension->id(), id);
+ // The content scripts might fail verification the first time since the
+ // one-time processing might not be finished yet - if that's the case then
+ // we want to wait until that work is done.
+ if (!ContainsKey(verifier_observer.completed_fetches(), id))
+ verifier_observer.WaitForFetchComplete(id);
+
+ // Now disable/re-enable the extension to cause the content scripts to be
+ // read again.
+ DisableExtension(id);
+ EnableExtension(id);
+
EXPECT_TRUE(job_observer.WaitForExpectedJobs());
ContentVerifyJob::SetObserverForTests(NULL);
« no previous file with comments | « no previous file | chrome/test/data/extensions/content_verifier/dot_slash_paths.crx » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698