Commit 53c54b22 authored by Jun Cai's avatar Jun Cai Committed by Commit Bot

Network Service: Make some checking Origin headers tests early return if network service is enabled

Based on the comment at:
https://bugs.chromium.org/p/chromium/issues/detail?id=862176
This CL makes:
SecurityExploitBrowserTest.InvalidOriginHeaders
ExtensionUnloadBrowserTest.UnloadWithContentScripts
early return if network service is enabled.

Bug: 862176
Cq-Include-Trybots: luci.chromium.try:linux_mojo
Change-Id: I040ac9615a6deed786825d306a9192d14925a5cc
Reviewed-on: https://chromium-review.googlesource.com/1176479Reviewed-by: default avatarJohn Abd-El-Malek <jam@chromium.org>
Commit-Queue: Jun Cai <juncai@chromium.org>
Cr-Commit-Position: refs/heads/master@{#583455}
parent ee7db1c7
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "base/feature_list.h"
#include "chrome/browser/extensions/extension_browsertest.h" #include "chrome/browser/extensions/extension_browsertest.h"
#include "chrome/browser/extensions/extension_service.h" #include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h" #include "chrome/browser/ui/tabs/tab_strip_model.h"
...@@ -10,6 +11,7 @@ ...@@ -10,6 +11,7 @@
#include "content/public/test/browser_test_utils.h" #include "content/public/test/browser_test_utils.h"
#include "net/dns/mock_host_resolver.h" #include "net/dns/mock_host_resolver.h"
#include "net/test/embedded_test_server/embedded_test_server.h" #include "net/test/embedded_test_server/embedded_test_server.h"
#include "services/network/public/cpp/features.h"
#include "ui/base/window_open_disposition.h" #include "ui/base/window_open_disposition.h"
namespace extensions { namespace extensions {
...@@ -47,6 +49,10 @@ IN_PROC_BROWSER_TEST_F(ExtensionUnloadBrowserTest, TestUnload) { ...@@ -47,6 +49,10 @@ IN_PROC_BROWSER_TEST_F(ExtensionUnloadBrowserTest, TestUnload) {
// After an extension is uninstalled, network requests from its content scripts // After an extension is uninstalled, network requests from its content scripts
// should fail but not kill the renderer process. // should fail but not kill the renderer process.
IN_PROC_BROWSER_TEST_F(ExtensionUnloadBrowserTest, UnloadWithContentScripts) { IN_PROC_BROWSER_TEST_F(ExtensionUnloadBrowserTest, UnloadWithContentScripts) {
// https://crbug.com/862176
if (base::FeatureList::IsEnabled(network::features::kNetworkService))
return;
ASSERT_TRUE(embedded_test_server()->Start()); ASSERT_TRUE(embedded_test_server()->Start());
// Load an extension with a content script that has a button to send XHRs. // Load an extension with a content script that has a button to send XHRs.
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#include "base/command_line.h" #include "base/command_line.h"
#include "base/containers/hash_tables.h" #include "base/containers/hash_tables.h"
#include "base/feature_list.h"
#include "base/macros.h" #include "base/macros.h"
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
#include "build/build_config.h" #include "build/build_config.h"
...@@ -453,6 +454,10 @@ void OnHttpHeaderReceived(const std::string& header, ...@@ -453,6 +454,10 @@ void OnHttpHeaderReceived(const std::string& header,
// Renderer processes should not be able to spoof Origin HTTP headers. // Renderer processes should not be able to spoof Origin HTTP headers.
IN_PROC_BROWSER_TEST_F(SecurityExploitBrowserTest, InvalidOriginHeaders) { IN_PROC_BROWSER_TEST_F(SecurityExploitBrowserTest, InvalidOriginHeaders) {
// https://crbug.com/862176
if (base::FeatureList::IsEnabled(network::features::kNetworkService))
return;
// Create a set of IPC messages with various Origin headers. // Create a set of IPC messages with various Origin headers.
network::ResourceRequest chrome_origin_msg( network::ResourceRequest chrome_origin_msg(
CreateXHRRequestWithOrigin("chrome://settings")); CreateXHRRequestWithOrigin("chrome://settings"));
......
...@@ -181,10 +181,6 @@ ...@@ -181,10 +181,6 @@
# about an origin. # about an origin.
-ReportingBrowserTest.TestReportingHeadersProcessed -ReportingBrowserTest.TestReportingHeadersProcessed
# https://crbug.com/862176
# Requires checking Origin headers on requests made after extension unload.
-ExtensionUnloadBrowserTest.UnloadWithContentScripts
# https://crbug.com/721403 # https://crbug.com/721403
-ContextMenuBrowserTest.DataSaverOpenOrigImageInNewTab -ContextMenuBrowserTest.DataSaverOpenOrigImageInNewTab
......
...@@ -37,9 +37,6 @@ ...@@ -37,9 +37,6 @@
# https://crbug.com/827318 # https://crbug.com/827318
-RenderThreadImplBrowserTest.NonResourceDispatchIPCTasksDontGoThroughScheduler -RenderThreadImplBrowserTest.NonResourceDispatchIPCTasksDontGoThroughScheduler
# https://crbug.com/862176
-SecurityExploitBrowserTest.InvalidOriginHeaders
# NOTE: if adding an exclusion for an existing failure (e.g. additional test for # NOTE: if adding an exclusion for an existing failure (e.g. additional test for
# feature X that is already not working), please add it beside the existing # feature X that is already not working), please add it beside the existing
# failures. Otherwise please reach out to network-service-dev@. # failures. Otherwise please reach out to network-service-dev@.
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