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

Unified Diff: chrome/browser/prerender/prerender_browsertest.cc

Issue 2687173002: [Prerender] Ignores resources with unsupported schemes for Offline reqs (Closed)
Patch Set: Created 3 years, 10 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/browser/prerender/prerender_resource_throttle.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/prerender/prerender_browsertest.cc
diff --git a/chrome/browser/prerender/prerender_browsertest.cc b/chrome/browser/prerender/prerender_browsertest.cc
index 5de302c3ffc72c3e1fdb7e5558cd6900babaf808..03f33270100c2e82f58c37cf56cfe6c27dbf6e80 100644
--- a/chrome/browser/prerender/prerender_browsertest.cc
+++ b/chrome/browser/prerender/prerender_browsertest.cc
@@ -2823,6 +2823,39 @@ IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest,
PrerenderTestURL(replacement_path, FINAL_STATUS_UNSUPPORTED_SCHEME, 0);
}
+// Checks that non-http/https/chrome-extension subresource does not cancel the
+// prerender.
+IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest,
+ PrerenderSubresourceUnsupportedSchemeForOffline) {
+ // Set up a page with unsupported subresource.
+ GURL image_url = GURL("invalidscheme://www.google.com/test.jpg");
+ base::StringPairs replacement_text;
+ replacement_text.push_back(
+ std::make_pair("REPLACE_WITH_IMAGE_URL", image_url.spec()));
+ std::string replacement_path;
+ net::test_server::GetFilePathWithReplacements(
+ "/prerender/prerender_with_image.html", replacement_text,
+ &replacement_path);
+ const GURL url = src_server()->GetURL(MakeAbsolute(replacement_path));
+
+ // Navigate to about:blank to get the session storage namespace.
+ ui_test_utils::NavigateToURL(current_browser(), GURL(url::kAboutBlankURL));
+ content::SessionStorageNamespace* storage_namespace =
+ GetActiveWebContents()
+ ->GetController()
+ .GetDefaultSessionStorageNamespace();
+
+ std::unique_ptr<TestPrerender> test_prerender =
+ prerender_contents_factory()->ExpectPrerenderContents(
+ FINAL_STATUS_APP_TERMINATING);
+
+ std::unique_ptr<PrerenderHandle> prerender_handle(
+ GetPrerenderManager()->AddPrerenderForOffline(url, storage_namespace,
+ gfx::Size(640, 480)));
+ ASSERT_EQ(prerender_handle->contents(), test_prerender->contents());
+ test_prerender->WaitForLoads(1);
+}
+
// Ensure that about:blank is permitted for any subresource.
IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest,
PrerenderAllowAboutBlankSubresource) {
« no previous file with comments | « no previous file | chrome/browser/prerender/prerender_resource_throttle.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698