Commit 1c6f72af authored by John Abd-El-Malek's avatar John Abd-El-Malek Committed by Commit Bot

Remove network service checks in cross_site_document_blocking_browsertest.cc

Bug: 934009
Change-Id: I7066971f181c889e02aef13c865be51855ec63eb
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1738437
Auto-Submit: John Abd-El-Malek <jam@chromium.org>
Commit-Queue: Łukasz Anforowicz <lukasza@chromium.org>
Reviewed-by: default avatarŁukasz Anforowicz <lukasza@chromium.org>
Cr-Commit-Position: refs/heads/master@{#684468}
parent 3ddffe27
...@@ -95,21 +95,15 @@ void InspectHistograms( ...@@ -95,21 +95,15 @@ void InspectHistograms(
const std::string& resource_name, const std::string& resource_name,
ResourceType resource_type, ResourceType resource_type,
bool special_request_initiator_origin_lock_check_for_appcache = false) { bool special_request_initiator_origin_lock_check_for_appcache = false) {
// //services/network doesn't have access to content::ResourceType and FetchHistogramsFromChildProcesses();
// therefore cannot log some CORB UMAs.
bool is_restricted_uma_expected = false;
if (base::FeatureList::IsEnabled(network::features::kNetworkService)) {
is_restricted_uma_expected = true;
FetchHistogramsFromChildProcesses();
auto expected_lock_compatibility = auto expected_lock_compatibility =
special_request_initiator_origin_lock_check_for_appcache special_request_initiator_origin_lock_check_for_appcache
? network::InitiatorLockCompatibility::kBrowserProcess ? network::InitiatorLockCompatibility::kBrowserProcess
: network::InitiatorLockCompatibility::kCompatibleLock; : network::InitiatorLockCompatibility::kCompatibleLock;
histograms.ExpectUniqueSample( histograms.ExpectUniqueSample(
"NetworkService.URLLoader.RequestInitiatorOriginLockCompatibility", "NetworkService.URLLoader.RequestInitiatorOriginLockCompatibility",
expected_lock_compatibility, 1); expected_lock_compatibility, 1);
}
CorbMimeType expected_mime_type = CorbMimeType::kInvalidMimeType; CorbMimeType expected_mime_type = CorbMimeType::kInvalidMimeType;
if (base::MatchPattern(resource_name, "*.html")) { if (base::MatchPattern(resource_name, "*.html")) {
...@@ -470,14 +464,9 @@ class CrossSiteDocumentBlockingTestBase : public ContentBrowserTest { ...@@ -470,14 +464,9 @@ class CrossSiteDocumentBlockingTestBase : public ContentBrowserTest {
VerifyImgRequest(resource, expectations, VerifyImgRequest(resource, expectations,
GURL("http://foo.com/title1.html")); GURL("http://foo.com/title1.html"));
// Pre-NetworkService CORB implementation doesn't have an equivalent of // Test from a file: origin.
// URLLoaderFactoryParams::is_corb_enabled and therefore there is no way to VerifyImgRequest(resource, expectations,
// turn off CORB only when allow_universal_access_from_file_urls is false. GetTestUrl(nullptr, "title1.html"));
if (base::FeatureList::IsEnabled(network::features::kNetworkService)) {
// Test from a file: origin.
VerifyImgRequest(resource, expectations,
GetTestUrl(nullptr, "title1.html"));
}
} }
void VerifyImgRequest(std::string resource, void VerifyImgRequest(std::string resource,
...@@ -956,13 +945,9 @@ IN_PROC_BROWSER_TEST_P(CrossSiteDocumentBlockingTest, SharedWorker) { ...@@ -956,13 +945,9 @@ IN_PROC_BROWSER_TEST_P(CrossSiteDocumentBlockingTest, SharedWorker) {
)"; )";
EXPECT_TRUE(ExecJs(shell(), JsReplace(kFetchStartTemplate, bar_url))); EXPECT_TRUE(ExecJs(shell(), JsReplace(kFetchStartTemplate, bar_url)));
// Verify the intercepted request (intercepting requests from SharedWorkers is interceptor.WaitForRequestCompletion();
// only possible when NetworkService is enabled). interceptor.Verify(kShouldBeBlockedWithoutSniffing,
if (base::FeatureList::IsEnabled(network::features::kNetworkService)) { "no resource body needed for blocking verification");
interceptor.WaitForRequestCompletion();
interceptor.Verify(kShouldBeBlockedWithoutSniffing,
"no resource body needed for blocking verification");
}
// Wait for fetch result (really needed only without NetworkService, if no // Wait for fetch result (really needed only without NetworkService, if no
// interceptor.WaitForRequestCompletion was called above). // interceptor.WaitForRequestCompletion was called above).
...@@ -1091,11 +1076,6 @@ IN_PROC_BROWSER_TEST_P(CrossSiteDocumentBlockingTest, ...@@ -1091,11 +1076,6 @@ IN_PROC_BROWSER_TEST_P(CrossSiteDocumentBlockingTest,
AppCache_InitiatorEnforcement) { AppCache_InitiatorEnforcement) {
embedded_test_server()->StartAcceptingConnections(); embedded_test_server()->StartAcceptingConnections();
// Verification of |request_initiator| is only done in the NetworkService code
// path.
if (!base::FeatureList::IsEnabled(network::features::kNetworkService))
return;
// No kills are expected unless the fetch requesting process is locked to a // No kills are expected unless the fetch requesting process is locked to a
// specific site URL. Therefore, the test should be skipped unless the full // specific site URL. Therefore, the test should be skipped unless the full
// Site Isolation is enabled. // Site Isolation is enabled.
...@@ -1151,11 +1131,6 @@ IN_PROC_BROWSER_TEST_P(CrossSiteDocumentBlockingTest, ...@@ -1151,11 +1131,6 @@ IN_PROC_BROWSER_TEST_P(CrossSiteDocumentBlockingTest,
AppCache_NoNavigationsEnforcement) { AppCache_NoNavigationsEnforcement) {
embedded_test_server()->StartAcceptingConnections(); embedded_test_server()->StartAcceptingConnections();
// Verification of |request_initiator| is only done in the NetworkService code
// path.
if (!base::FeatureList::IsEnabled(network::features::kNetworkService))
return;
// No kills are expected unless the fetch requesting process is locked to a // No kills are expected unless the fetch requesting process is locked to a
// specific site URL. Therefore, the test should be skipped unless the full // specific site URL. Therefore, the test should be skipped unless the full
// Site Isolation is enabled. // Site Isolation is enabled.
...@@ -1362,17 +1337,11 @@ IN_PROC_BROWSER_TEST_P(CrossSiteDocumentBlockingTest, ...@@ -1362,17 +1337,11 @@ IN_PROC_BROWSER_TEST_P(CrossSiteDocumentBlockingTest,
ExecuteScriptAsync(shell()->web_contents(), script); ExecuteScriptAsync(shell()->web_contents(), script);
interceptor.WaitForRequestCompletion(); interceptor.WaitForRequestCompletion();
if (base::FeatureList::IsEnabled(network::features::kNetworkService)) { // NetworkService enforices |request_initiator_site_lock| for CORB,
// NetworkService enforices |request_initiator_site_lock| for CORB, // which means that legitimate fetches from HTML Imported scripts may get
// which means that legitimate fetches from HTML Imported scripts may get // incorrectly blocked.
// incorrectly blocked. interceptor.Verify(CorbExpectations::kShouldBeBlockedWithoutSniffing,
interceptor.Verify(CorbExpectations::kShouldBeBlockedWithoutSniffing, "no resource body needed for blocking verification");
"no resource body needed for blocking verification");
} else {
// Without |request_initiator_site_lock| no CORB blocking is expected.
interceptor.Verify(CorbExpectations::kShouldBeAllowedWithoutSniffing,
GetTestFileContents("site_isolation", "nosniff.json"));
}
} }
} }
...@@ -1620,8 +1589,7 @@ IN_PROC_BROWSER_TEST_F(CrossSiteDocumentBlockingServiceWorkerTest, ...@@ -1620,8 +1589,7 @@ IN_PROC_BROWSER_TEST_F(CrossSiteDocumentBlockingServiceWorkerTest,
// Make sure that the histograms generated by a service worker registration // Make sure that the histograms generated by a service worker registration
// have been recorded. // have been recorded.
if (base::FeatureList::IsEnabled(network::features::kNetworkService)) FetchHistogramsFromChildProcesses();
FetchHistogramsFromChildProcesses();
// Build a script for XHR-ing a cross-origin, nosniff HTML document. // Build a script for XHR-ing a cross-origin, nosniff HTML document.
GURL cross_origin_url = GURL cross_origin_url =
......
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