Commit c92098d6 authored by danakj's avatar danakj Committed by Commit Bot

Remove the web_test_support_browser component.

Put the code there directly into content/shell/browser/web_test.

R=avi@chromium.org

Bug: 866140
Change-Id: I28024f4fbe56a6086819a15b874130a53bb25425
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2280387
Commit-Queue: danakj <danakj@chromium.org>
Reviewed-by: default avatarAvi Drissman <avi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#785844}
parent 13e4dfc9
// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CONTENT_PUBLIC_TEST_WEB_TEST_SUPPORT_BROWSER_H_
#define CONTENT_PUBLIC_TEST_WEB_TEST_SUPPORT_BROWSER_H_
namespace content {
// Turn the browser process into web test mode.
void EnableBrowserWebTestMode();
// Sets the scan duration to reflect the given setting.
enum class BluetoothTestScanDurationSetting {
kImmediateTimeout, // Set the scan duration to 0 seconds.
kNeverTimeout, // Set the scan duration to base::TimeDelta::Max() seconds.
};
void SetTestBluetoothScanDuration(BluetoothTestScanDurationSetting setting);
} // namespace content
#endif // CONTENT_PUBLIC_TEST_WEB_TEST_SUPPORT_BROWSER_H_
...@@ -182,7 +182,6 @@ if (support_web_tests) { ...@@ -182,7 +182,6 @@ if (support_web_tests) {
"//content/test:blink_test_browser_support", "//content/test:blink_test_browser_support",
"//content/test:mojo_web_test_bindings", "//content/test:mojo_web_test_bindings",
"//content/test:test_support", "//content/test:test_support",
"//content/test:web_test_support_browser",
"//device/bluetooth:fake_bluetooth", "//device/bluetooth:fake_bluetooth",
"//device/bluetooth:mocks", "//device/bluetooth:mocks",
"//device/bluetooth/public/mojom:fake_bluetooth_interfaces", "//device/bluetooth/public/mojom:fake_bluetooth_interfaces",
......
...@@ -7,8 +7,8 @@ ...@@ -7,8 +7,8 @@
#include <string> #include <string>
#include <utility> #include <utility>
#include "content/browser/bluetooth/bluetooth_device_chooser_controller.h"
#include "content/public/browser/bluetooth_chooser.h" #include "content/public/browser/bluetooth_chooser.h"
#include "content/public/test/web_test_support_browser.h"
#include "content/shell/common/web_test/fake_bluetooth_chooser.mojom.h" #include "content/shell/common/web_test/fake_bluetooth_chooser.mojom.h"
namespace content { namespace content {
...@@ -17,12 +17,14 @@ FakeBluetoothChooser::FakeBluetoothChooser( ...@@ -17,12 +17,14 @@ FakeBluetoothChooser::FakeBluetoothChooser(
mojo::PendingReceiver<mojom::FakeBluetoothChooser> receiver, mojo::PendingReceiver<mojom::FakeBluetoothChooser> receiver,
mojo::PendingAssociatedRemote<mojom::FakeBluetoothChooserClient> client) mojo::PendingAssociatedRemote<mojom::FakeBluetoothChooserClient> client)
: receiver_(this, std::move(receiver)), client_(std::move(client)) { : receiver_(this, std::move(receiver)), client_(std::move(client)) {
SetTestBluetoothScanDuration(BluetoothTestScanDurationSetting::kNeverTimeout); BluetoothDeviceChooserController::SetTestScanDurationForTesting(
BluetoothDeviceChooserController::TestScanDurationSetting::NEVER_TIMEOUT);
} }
FakeBluetoothChooser::~FakeBluetoothChooser() { FakeBluetoothChooser::~FakeBluetoothChooser() {
SetTestBluetoothScanDuration( BluetoothDeviceChooserController::SetTestScanDurationForTesting(
BluetoothTestScanDurationSetting::kImmediateTimeout); BluetoothDeviceChooserController::TestScanDurationSetting::
IMMEDIATE_TIMEOUT);
client_->OnEvent(mojom::FakeBluetoothChooserEvent::New( client_->OnEvent(mojom::FakeBluetoothChooserEvent::New(
mojom::ChooserEventType::CHOOSER_CLOSED, /*origin=*/base::nullopt, mojom::ChooserEventType::CHOOSER_CLOSED, /*origin=*/base::nullopt,
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
#include <string> #include <string>
#include <utility> #include <utility>
#include "content/public/test/web_test_support_browser.h" #include "content/browser/bluetooth/bluetooth_device_chooser_controller.h"
#include "content/shell/browser/web_test/web_test_bluetooth_adapter_provider.h" #include "content/shell/browser/web_test/web_test_bluetooth_adapter_provider.h"
#include "content/shell/common/web_test/web_test_bluetooth_fake_adapter_setter.mojom.h" #include "content/shell/common/web_test/web_test_bluetooth_fake_adapter_setter.mojom.h"
#include "device/bluetooth/bluetooth_adapter_factory_wrapper.h" #include "device/bluetooth/bluetooth_adapter_factory_wrapper.h"
...@@ -33,8 +33,9 @@ void WebTestBluetoothFakeAdapterSetterImpl::Create( ...@@ -33,8 +33,9 @@ void WebTestBluetoothFakeAdapterSetterImpl::Create(
void WebTestBluetoothFakeAdapterSetterImpl::Set(const std::string& adapter_name, void WebTestBluetoothFakeAdapterSetterImpl::Set(const std::string& adapter_name,
SetCallback callback) { SetCallback callback) {
SetTestBluetoothScanDuration( BluetoothDeviceChooserController::SetTestScanDurationForTesting(
BluetoothTestScanDurationSetting::kImmediateTimeout); BluetoothDeviceChooserController::TestScanDurationSetting::
IMMEDIATE_TIMEOUT);
device::BluetoothAdapterFactoryWrapper::Get().SetBluetoothAdapterForTesting( device::BluetoothAdapterFactoryWrapper::Get().SetBluetoothAdapterForTesting(
WebTestBluetoothAdapterProvider::GetBluetoothAdapter(adapter_name)); WebTestBluetoothAdapterProvider::GetBluetoothAdapter(adapter_name));
......
...@@ -7,6 +7,10 @@ ...@@ -7,6 +7,10 @@
#include <AppKit/AppKit.h> #include <AppKit/AppKit.h>
#include <Foundation/Foundation.h> #include <Foundation/Foundation.h>
#include "content/browser/frame_host/popup_menu_helper_mac.h"
#include "content/browser/sandbox_parameters_mac.h"
#include "net/test/test_data_directory.h"
namespace content { namespace content {
namespace { namespace {
...@@ -42,6 +46,12 @@ void SetDefaultsToWebTestValues(void) { ...@@ -42,6 +46,12 @@ void SetDefaultsToWebTestValues(void) {
void WebTestBrowserPlatformInitialize() { void WebTestBrowserPlatformInitialize() {
SetDefaultsToWebTestValues(); SetDefaultsToWebTestValues();
PopupMenuHelper::DontShowPopupMenuForTesting();
// Expand the network service sandbox to allow reading the test TLS
// certificates.
SetNetworkTestCertsDirectoryForTesting(net::GetTestCertsDirectory());
} }
} // namespace content } // namespace content
...@@ -24,11 +24,11 @@ ...@@ -24,11 +24,11 @@
#include "cc/base/switches.h" #include "cc/base/switches.h"
#include "components/network_session_configurator/common/network_switches.h" #include "components/network_session_configurator/common/network_switches.h"
#include "components/viz/common/switches.h" #include "components/viz/common/switches.h"
#include "content/browser/renderer_host/render_widget_host_impl.h"
#include "content/public/browser/browser_main_runner.h" #include "content/public/browser/browser_main_runner.h"
#include "content/public/common/content_switches.h" #include "content/public/common/content_switches.h"
#include "content/public/common/url_constants.h" #include "content/public/common/url_constants.h"
#include "content/public/test/ppapi_test_utils.h" #include "content/public/test/ppapi_test_utils.h"
#include "content/public/test/web_test_support_browser.h"
#include "content/shell/browser/shell.h" #include "content/shell/browser/shell.h"
#include "content/shell/browser/web_test/test_info_extractor.h" #include "content/shell/browser/web_test/test_info_extractor.h"
#include "content/shell/browser/web_test/web_test_browser_main_platform_support.h" #include "content/shell/browser/web_test/web_test_browser_main_platform_support.h"
...@@ -212,7 +212,7 @@ void WebTestBrowserMainRunner::Initialize() { ...@@ -212,7 +212,7 @@ void WebTestBrowserMainRunner::Initialize() {
content::WebTestBrowserPlatformInitialize(); content::WebTestBrowserPlatformInitialize();
#endif #endif
content::EnableBrowserWebTestMode(); RenderWidgetHostImpl::DisableResizeAckCheckForTesting();
} }
void WebTestBrowserMainRunner::RunBrowserMain( void WebTestBrowserMainRunner::RunBrowserMain(
......
...@@ -801,26 +801,6 @@ if (is_android) { ...@@ -801,26 +801,6 @@ if (is_android) {
} }
} }
static_library("web_test_support_browser") {
testonly = true
# See comment at the top of //content/BUILD.gn for why this is disabled in
# component builds.
if (is_component_build) {
check_includes = false
}
sources = [
"../public/test/web_test_support_browser.h",
"web_test_support_browser.cc",
]
deps = [
"//content/browser:for_content_tests", # For non-component builds.
"//content/public/browser", # For component builds.
"//net:test_support",
]
}
static_library("blink_test_browser_support") { static_library("blink_test_browser_support") {
testonly = true testonly = true
......
// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "content/public/test/web_test_support_browser.h"
#include "build/build_config.h"
#include "content/browser/bluetooth/bluetooth_device_chooser_controller.h"
#include "content/browser/renderer_host/render_widget_host_impl.h"
#if defined(OS_MACOSX)
#include "content/browser/frame_host/popup_menu_helper_mac.h"
#include "content/browser/sandbox_parameters_mac.h"
#include "net/test/test_data_directory.h"
#endif
namespace content {
void EnableBrowserWebTestMode() {
#if defined(OS_MACOSX)
PopupMenuHelper::DontShowPopupMenuForTesting();
// Expand the network service sandbox to allow reading the test TLS
// certificates.
SetNetworkTestCertsDirectoryForTesting(net::GetTestCertsDirectory());
#endif
RenderWidgetHostImpl::DisableResizeAckCheckForTesting();
}
void SetTestBluetoothScanDuration(BluetoothTestScanDurationSetting setting) {
switch (setting) {
case BluetoothTestScanDurationSetting::kImmediateTimeout:
BluetoothDeviceChooserController::SetTestScanDurationForTesting(
BluetoothDeviceChooserController::TestScanDurationSetting::
IMMEDIATE_TIMEOUT);
break;
case BluetoothTestScanDurationSetting::kNeverTimeout:
BluetoothDeviceChooserController::SetTestScanDurationForTesting(
BluetoothDeviceChooserController::TestScanDurationSetting::
NEVER_TIMEOUT);
break;
}
}
} // namespace content
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