Commit 2c68fcee authored by Lukasz Anforowicz's avatar Lukasz Anforowicz Committed by Commit Bot

Fix CrossSiteDocumentBlockingTest.BlockHeaders test for NetworkService.

Before this CL the test was constructing URLLoaderInterceptor too late -
after the RenderFrameHostImpl under test has already been created.  This
CL moves the creation of URLLoaderInterceptor (wrapped in
RequestInterceptor) slightly earlier.  After this CL the test passes
with and without NetworkService.

Bug: 846341
Cq-Include-Trybots: master.tryserver.chromium.linux:linux_mojo
Change-Id: I47fe27b55c341cdf87292a8aede8462921a9cbab
Reviewed-on: https://chromium-review.googlesource.com/1099971
Commit-Queue: Łukasz Anforowicz <lukasza@chromium.org>
Reviewed-by: default avatarNasko Oskov <nasko@chromium.org>
Cr-Commit-Position: refs/heads/master@{#567273}
parent a6447cd0
......@@ -587,10 +587,9 @@ IN_PROC_BROWSER_TEST_F(CrossSiteDocumentBlockingTest,
IN_PROC_BROWSER_TEST_F(CrossSiteDocumentBlockingTest, BlockHeaders) {
embedded_test_server()->StartAcceptingConnections();
GURL foo_url("http://foo.com/title1.html");
EXPECT_TRUE(NavigateToURL(shell(), foo_url));
// Prepare to intercept the network request at the IPC layer.
// This has to be done before the RenderFrameHostImpl is created.
//
// Note: we want to verify that the blocking prevents the data from being sent
// over IPC. Testing later (e.g. via Response/Headers Web APIs) might give a
......@@ -599,6 +598,10 @@ IN_PROC_BROWSER_TEST_F(CrossSiteDocumentBlockingTest, BlockHeaders) {
GURL bar_url("http://bar.com/cross_site_document_blocking/headers-test.json");
RequestInterceptor interceptor(bar_url);
// Navigate to the test page.
GURL foo_url("http://foo.com/title1.html");
EXPECT_TRUE(NavigateToURL(shell(), foo_url));
// Issue the request that will be intercepted
EXPECT_TRUE(ExecuteScript(shell(),
base::StringPrintf("fetch('%s').catch(error => {})",
......
......@@ -34,10 +34,6 @@
# Cross-origin request to file:// URL should be blocked. crbug.com/759230
-BrowserSideNavigationBrowserDisableWebSecurityTest.ValidateBaseUrlForDataUrl
# https://crbug.com/846341: CORB: Preserve test coverage for blocking response
# headers in the NetworkService world.
-CrossSiteDocumentBlockingTest.BlockHeaders
# https://crbug.com/846334: CORB: Need to make sure that prefetch/caching works
-CrossSiteDocumentBlockingTest.PrefetchIsNotImpacted
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment