diff options
author | jochen <jochen@chromium.org> | 2016-02-17 12:39:45 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-02-17 20:40:33 +0000 |
commit | 5ce1af990b1784f60803490ddc487c12aaa9e990 (patch) | |
tree | 83b925025cca601636957bc5b1ae81e6864b7a28 | |
parent | 89d33db3bfd53fbb3d85bb218ad4db8489a4dc34 (diff) | |
download | chromium_src-5ce1af990b1784f60803490ddc487c12aaa9e990.zip chromium_src-5ce1af990b1784f60803490ddc487c12aaa9e990.tar.gz chromium_src-5ce1af990b1784f60803490ddc487c12aaa9e990.tar.bz2 |
Move some more layout test related classes to the appropriate dir
Also put some DEPS in place to avoid future regressions. Untangling
shell.cc seems to be not worthwhile, so I left it alone.
BUG=none
R=mkwst@chromium.org
Review URL: https://codereview.chromium.org/1698313002
Cr-Commit-Position: refs/heads/master@{#375971}
19 files changed, 84 insertions, 53 deletions
diff --git a/content/content_shell.gypi b/content/content_shell.gypi index c52ce5c..70dc03f 100644 --- a/content/content_shell.gypi +++ b/content/content_shell.gypi @@ -90,8 +90,8 @@ 'shell/app/shell_main_delegate.h', 'shell/app/shell_main_delegate_mac.h', 'shell/app/shell_main_delegate_mac.mm', - 'shell/browser/blink_test_controller.cc', - 'shell/browser/blink_test_controller.h', + 'shell/browser/layout_test/blink_test_controller.cc', + 'shell/browser/layout_test/blink_test_controller.h', 'shell/browser/layout_test/layout_test_android.cc', 'shell/browser/layout_test/layout_test_android.h', 'shell/browser/layout_test/layout_test_bluetooth_adapter_provider.cc', @@ -126,8 +126,8 @@ 'shell/browser/layout_test/layout_test_resource_dispatcher_host_delegate.h', 'shell/browser/layout_test/layout_test_url_request_context_getter.cc', 'shell/browser/layout_test/layout_test_url_request_context_getter.h', - 'shell/browser/notify_done_forwarder.cc', - 'shell/browser/notify_done_forwarder.h', + 'shell/browser/layout_test/notify_done_forwarder.cc', + 'shell/browser/layout_test/notify_done_forwarder.h', 'shell/browser/shell.cc', 'shell/browser/shell.h', 'shell/browser/shell_access_token_store.cc', diff --git a/content/shell/BUILD.gn b/content/shell/BUILD.gn index 4847abd..85b22f2 100644 --- a/content/shell/BUILD.gn +++ b/content/shell/BUILD.gn @@ -42,8 +42,8 @@ static_library("content_shell_lib") { "app/shell_main_delegate.h", "app/shell_main_delegate_mac.h", "app/shell_main_delegate_mac.mm", - "browser/blink_test_controller.cc", - "browser/blink_test_controller.h", + "browser/layout_test/blink_test_controller.cc", + "browser/layout_test/blink_test_controller.h", "browser/layout_test/layout_test_android.cc", "browser/layout_test/layout_test_android.h", "browser/layout_test/layout_test_bluetooth_adapter_provider.cc", @@ -78,8 +78,8 @@ static_library("content_shell_lib") { "browser/layout_test/layout_test_resource_dispatcher_host_delegate.h", "browser/layout_test/layout_test_url_request_context_getter.cc", "browser/layout_test/layout_test_url_request_context_getter.h", - "browser/notify_done_forwarder.cc", - "browser/notify_done_forwarder.h", + "browser/layout_test/notify_done_forwarder.cc", + "browser/layout_test/notify_done_forwarder.h", "browser/shell.cc", "browser/shell.h", "browser/shell_access_token_store.cc", diff --git a/content/shell/browser/DEPS b/content/shell/browser/DEPS new file mode 100644 index 0000000..ba67eb9 --- /dev/null +++ b/content/shell/browser/DEPS @@ -0,0 +1,9 @@ +include_rules = [ + "-content/shell/browser/layout_test", +] + +specific_include_rules = { + "shell\.cc": [ + "+content/shell/browser/layout_test", + ], +} diff --git a/content/shell/browser/blink_test_controller.cc b/content/shell/browser/layout_test/blink_test_controller.cc index 8e35477..59bdc20 100644 --- a/content/shell/browser/blink_test_controller.cc +++ b/content/shell/browser/layout_test/blink_test_controller.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "content/shell/browser/blink_test_controller.h" +#include "content/shell/browser/layout_test/blink_test_controller.h" #include <stddef.h> diff --git a/content/shell/browser/blink_test_controller.h b/content/shell/browser/layout_test/blink_test_controller.h index d030869..72ddca6 100644 --- a/content/shell/browser/blink_test_controller.h +++ b/content/shell/browser/layout_test/blink_test_controller.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CONTENT_SHELL_BROWSER_BLINK_TEST_CONTROLLER_H_ -#define CONTENT_SHELL_BROWSER_BLINK_TEST_CONTROLLER_H_ +#ifndef CONTENT_SHELL_BROWSER_LAYOUT_TEST_BLINK_TEST_CONTROLLER_H_ +#define CONTENT_SHELL_BROWSER_LAYOUT_TEST_BLINK_TEST_CONTROLLER_H_ #include <map> #include <ostream> @@ -257,4 +257,4 @@ class BlinkTestController : public base::NonThreadSafe, } // namespace content -#endif // CONTENT_SHELL_BROWSER_BLINK_TEST_CONTROLLER_H_ +#endif // CONTENT_SHELL_BROWSER_LAYOUT_TEST_BLINK_TEST_CONTROLLER_H_ diff --git a/content/shell/browser/layout_test/layout_test_browser_main.cc b/content/shell/browser/layout_test/layout_test_browser_main.cc index 6ba98c7..90285c1 100644 --- a/content/shell/browser/layout_test/layout_test_browser_main.cc +++ b/content/shell/browser/layout_test/layout_test_browser_main.cc @@ -22,7 +22,7 @@ #include "components/test_runner/test_info_extractor.h" #include "content/public/browser/browser_main_runner.h" #include "content/public/common/url_constants.h" -#include "content/shell/browser/blink_test_controller.h" +#include "content/shell/browser/layout_test/blink_test_controller.h" #include "content/shell/browser/shell.h" #include "content/shell/common/shell_switches.h" #include "content/shell/renderer/layout_test/blink_test_helpers.h" diff --git a/content/shell/browser/layout_test/layout_test_content_browser_client.cc b/content/shell/browser/layout_test/layout_test_content_browser_client.cc index 9039997..227478d 100644 --- a/content/shell/browser/layout_test/layout_test_content_browser_client.cc +++ b/content/shell/browser/layout_test/layout_test_content_browser_client.cc @@ -8,13 +8,18 @@ #include "content/public/browser/browser_thread.h" #include "content/public/browser/navigator_connect_context.h" #include "content/public/browser/render_process_host.h" +#include "content/public/browser/resource_dispatcher_host.h" #include "content/public/browser/storage_partition.h" +#include "content/shell/browser/layout_test/blink_test_controller.h" #include "content/shell/browser/layout_test/layout_test_browser_context.h" +#include "content/shell/browser/layout_test/layout_test_browser_main_parts.h" #include "content/shell/browser/layout_test/layout_test_message_filter.h" #include "content/shell/browser/layout_test/layout_test_navigator_connect_service_factory.h" #include "content/shell/browser/layout_test/layout_test_notification_manager.h" +#include "content/shell/browser/layout_test/layout_test_resource_dispatcher_host_delegate.h" #include "content/shell/browser/shell_browser_context.h" #include "content/shell/common/shell_messages.h" +#include "content/shell/common/shell_switches.h" #include "content/shell/renderer/layout_test/blink_test_helpers.h" namespace content { @@ -65,6 +70,33 @@ void LayoutTestContentBrowserClient::RenderProcessWillLaunch( host->Send(new ShellViewMsg_SetWebKitSourceDir(GetWebKitRootDirFilePath())); } +void LayoutTestContentBrowserClient::OverrideWebkitPrefs( + RenderViewHost* render_view_host, + WebPreferences* prefs) { + BlinkTestController::Get()->OverrideWebkitPrefs(prefs); +} + +void LayoutTestContentBrowserClient::ResourceDispatcherHostCreated() { + set_resource_dispatcher_host_delegate( + make_scoped_ptr(new LayoutTestResourceDispatcherHostDelegate)); + ResourceDispatcherHost::Get()->SetDelegate( + resource_dispatcher_host_delegate()); +} + +void LayoutTestContentBrowserClient::AppendExtraCommandLineSwitches( + base::CommandLine* command_line, + int child_process_id) { + command_line->AppendSwitch(switches::kRunLayoutTest); + ShellContentBrowserClient::AppendExtraCommandLineSwitches(command_line, + child_process_id); +} + +BrowserMainParts* LayoutTestContentBrowserClient::CreateBrowserMainParts( + const MainFunctionParams& parameters) { + set_browser_main_parts(new LayoutTestBrowserMainParts(parameters)); + return shell_browser_main_parts(); +} + PlatformNotificationService* LayoutTestContentBrowserClient::GetPlatformNotificationService() { return layout_test_notification_manager_.get(); diff --git a/content/shell/browser/layout_test/layout_test_content_browser_client.h b/content/shell/browser/layout_test/layout_test_content_browser_client.h index f41794d..2e583149 100644 --- a/content/shell/browser/layout_test/layout_test_content_browser_client.h +++ b/content/shell/browser/layout_test/layout_test_content_browser_client.h @@ -27,6 +27,13 @@ class LayoutTestContentBrowserClient : public ShellContentBrowserClient { // ContentBrowserClient overrides. void RenderProcessWillLaunch(RenderProcessHost* host) override; + void OverrideWebkitPrefs(RenderViewHost* render_view_host, + WebPreferences* prefs) override; + void ResourceDispatcherHostCreated() override; + void AppendExtraCommandLineSwitches(base::CommandLine* command_line, + int child_process_id) override; + BrowserMainParts* CreateBrowserMainParts( + const MainFunctionParams& parameters) override; PlatformNotificationService* GetPlatformNotificationService() override; void GetAdditionalNavigatorConnectServices( diff --git a/content/shell/browser/layout_test/layout_test_devtools_frontend.cc b/content/shell/browser/layout_test/layout_test_devtools_frontend.cc index 8fb7256..7da2af53 100644 --- a/content/shell/browser/layout_test/layout_test_devtools_frontend.cc +++ b/content/shell/browser/layout_test/layout_test_devtools_frontend.cc @@ -9,7 +9,7 @@ #include "base/strings/stringprintf.h" #include "build/build_config.h" #include "content/public/browser/web_contents.h" -#include "content/shell/browser/blink_test_controller.h" +#include "content/shell/browser/layout_test/blink_test_controller.h" #include "content/shell/browser/shell.h" #include "net/base/filename_util.h" diff --git a/content/shell/browser/layout_test/layout_test_download_manager_delegate.cc b/content/shell/browser/layout_test/layout_test_download_manager_delegate.cc index 238f780..9f7b098 100644 --- a/content/shell/browser/layout_test/layout_test_download_manager_delegate.cc +++ b/content/shell/browser/layout_test/layout_test_download_manager_delegate.cc @@ -16,7 +16,7 @@ #include "build/build_config.h" #include "content/public/browser/download_item.h" #include "content/public/browser/download_manager.h" -#include "content/shell/browser/blink_test_controller.h" +#include "content/shell/browser/layout_test/blink_test_controller.h" #include "net/base/filename_util.h" #if defined(OS_WIN) diff --git a/content/shell/browser/layout_test/layout_test_javascript_dialog_manager.cc b/content/shell/browser/layout_test/layout_test_javascript_dialog_manager.cc index f4045bf..e6352b0 100644 --- a/content/shell/browser/layout_test/layout_test_javascript_dialog_manager.cc +++ b/content/shell/browser/layout_test/layout_test_javascript_dialog_manager.cc @@ -8,7 +8,7 @@ #include "base/logging.h" #include "base/strings/utf_string_conversions.h" #include "content/public/browser/web_contents.h" -#include "content/shell/browser/blink_test_controller.h" +#include "content/shell/browser/layout_test/blink_test_controller.h" #include "content/shell/browser/shell_javascript_dialog.h" #include "content/shell/common/shell_switches.h" #include "net/base/net_util.h" diff --git a/content/shell/browser/notify_done_forwarder.cc b/content/shell/browser/layout_test/notify_done_forwarder.cc index 35757b7..2a77f94 100644 --- a/content/shell/browser/notify_done_forwarder.cc +++ b/content/shell/browser/layout_test/notify_done_forwarder.cc @@ -2,9 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "content/shell/browser/notify_done_forwarder.h" +#include "content/shell/browser/layout_test/notify_done_forwarder.h" -#include "content/shell/browser/blink_test_controller.h" +#include "content/shell/browser/layout_test/blink_test_controller.h" #include "content/shell/common/shell_messages.h" namespace content { diff --git a/content/shell/browser/notify_done_forwarder.h b/content/shell/browser/layout_test/notify_done_forwarder.h index a2e46da..fd1b0c1 100644 --- a/content/shell/browser/notify_done_forwarder.h +++ b/content/shell/browser/layout_test/notify_done_forwarder.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CONTENT_SHELL_BROWSER_NOTIFY_DONE_FORWARDER_H_ -#define CONTENT_SHELL_BROWSER_NOTIFY_DONE_FORWARDER_H_ +#ifndef CONTENT_SHELL_BROWSER_LAYOUT_TEST_NOTIFY_DONE_FORWARDER_H_ +#define CONTENT_SHELL_BROWSER_LAYOUT_TEST_NOTIFY_DONE_FORWARDER_H_ #include "base/macros.h" #include "content/public/browser/web_contents_observer.h" @@ -31,4 +31,4 @@ class NotifyDoneForwarder : public WebContentsObserver, } // namespace content -#endif // CONTENT_SHELL_BROWSER_NOTIFY_DONE_FORWARDER_H_ +#endif // CONTENT_SHELL_BROWSER_LAYOUT_TEST_NOTIFY_DONE_FORWARDER_H_ diff --git a/content/shell/browser/shell.cc b/content/shell/browser/shell.cc index 5b5e030..9c7c031 100644 --- a/content/shell/browser/shell.cc +++ b/content/shell/browser/shell.cc @@ -28,11 +28,11 @@ #include "content/public/common/content_switches.h" #include "content/public/common/renderer_preferences.h" #include "content/public/common/webrtc_ip_handling_policy.h" -#include "content/shell/browser/blink_test_controller.h" +#include "content/shell/browser/layout_test/blink_test_controller.h" #include "content/shell/browser/layout_test/layout_test_bluetooth_chooser_factory.h" #include "content/shell/browser/layout_test/layout_test_devtools_frontend.h" #include "content/shell/browser/layout_test/layout_test_javascript_dialog_manager.h" -#include "content/shell/browser/notify_done_forwarder.h" +#include "content/shell/browser/layout_test/notify_done_forwarder.h" #include "content/shell/browser/shell_browser_main_parts.h" #include "content/shell/browser/shell_content_browser_client.h" #include "content/shell/browser/shell_devtools_frontend.h" diff --git a/content/shell/browser/shell_browser_main_parts.cc b/content/shell/browser/shell_browser_main_parts.cc index 520c918..9b17cd5 100644 --- a/content/shell/browser/shell_browser_main_parts.cc +++ b/content/shell/browser/shell_browser_main_parts.cc @@ -19,7 +19,6 @@ #include "content/public/common/content_switches.h" #include "content/public/common/main_function_params.h" #include "content/public/common/url_constants.h" -#include "content/shell/browser/layout_test/layout_test_browser_context.h" #include "content/shell/browser/shell.h" #include "content/shell/browser/shell_browser_context.h" #include "content/shell/browser/shell_devtools_manager_delegate.h" diff --git a/content/shell/browser/shell_content_browser_client.cc b/content/shell/browser/shell_content_browser_client.cc index 63a8b1b..1f317da 100644 --- a/content/shell/browser/shell_content_browser_client.cc +++ b/content/shell/browser/shell_content_browser_client.cc @@ -25,9 +25,6 @@ #include "content/public/common/url_constants.h" #include "content/public/common/web_preferences.h" #include "content/public/test/test_mojo_app.h" -#include "content/shell/browser/blink_test_controller.h" -#include "content/shell/browser/layout_test/layout_test_browser_main_parts.h" -#include "content/shell/browser/layout_test/layout_test_resource_dispatcher_host_delegate.h" #include "content/shell/browser/shell.h" #include "content/shell/browser/shell_access_token_store.h" #include "content/shell/browser/shell_browser_context.h" @@ -150,10 +147,7 @@ ShellContentBrowserClient::~ShellContentBrowserClient() { BrowserMainParts* ShellContentBrowserClient::CreateBrowserMainParts( const MainFunctionParams& parameters) { - shell_browser_main_parts_ = base::CommandLine::ForCurrentProcess()->HasSwitch( - switches::kRunLayoutTest) - ? new LayoutTestBrowserMainParts(parameters) - : new ShellBrowserMainParts(parameters); + shell_browser_main_parts_ = new ShellBrowserMainParts(parameters); return shell_browser_main_parts_; } @@ -240,10 +234,6 @@ void ShellContentBrowserClient::AppendExtraCommandLineSwitches( base::CommandLine* command_line, int child_process_id) { if (base::CommandLine::ForCurrentProcess()->HasSwitch( - switches::kRunLayoutTest)) { - command_line->AppendSwitch(switches::kRunLayoutTest); - } - if (base::CommandLine::ForCurrentProcess()->HasSwitch( switches::kDumpLineBoxTrees)) { command_line->AppendSwitch(switches::kDumpLineBoxTrees); } @@ -297,21 +287,9 @@ void ShellContentBrowserClient::AppendExtraCommandLineSwitches( } } -void ShellContentBrowserClient::OverrideWebkitPrefs( - RenderViewHost* render_view_host, - WebPreferences* prefs) { - if (!base::CommandLine::ForCurrentProcess()->HasSwitch( - switches::kRunLayoutTest)) - return; - BlinkTestController::Get()->OverrideWebkitPrefs(prefs); -} - void ShellContentBrowserClient::ResourceDispatcherHostCreated() { resource_dispatcher_host_delegate_.reset( - base::CommandLine::ForCurrentProcess()->HasSwitch( - switches::kRunLayoutTest) - ? new LayoutTestResourceDispatcherHostDelegate - : new ShellResourceDispatcherHostDelegate); + new ShellResourceDispatcherHostDelegate); ResourceDispatcherHost::Get()->SetDelegate( resource_dispatcher_host_delegate_.get()); } diff --git a/content/shell/browser/shell_content_browser_client.h b/content/shell/browser/shell_content_browser_client.h index 70fe1f5..a9286f3 100644 --- a/content/shell/browser/shell_content_browser_client.h +++ b/content/shell/browser/shell_content_browser_client.h @@ -12,13 +12,13 @@ #include "base/memory/scoped_ptr.h" #include "build/build_config.h" #include "content/public/browser/content_browser_client.h" +#include "content/shell/browser/shell_resource_dispatcher_host_delegate.h" #include "content/shell/browser/shell_speech_recognition_manager_delegate.h" namespace content { class ShellBrowserContext; class ShellBrowserMainParts; -class ShellResourceDispatcherHostDelegate; class ShellContentBrowserClient : public ContentBrowserClient { public: @@ -53,8 +53,6 @@ class ShellContentBrowserClient : public ContentBrowserClient { OutOfProcessMojoApplicationMap* apps) override; void AppendExtraCommandLineSwitches(base::CommandLine* command_line, int child_process_id) override; - void OverrideWebkitPrefs(RenderViewHost* render_view_host, - WebPreferences* prefs) override; void ResourceDispatcherHostCreated() override; AccessTokenStore* CreateAccessTokenStore() override; std::string GetDefaultDownloadName() override; @@ -109,6 +107,16 @@ class ShellContentBrowserClient : public ContentBrowserClient { select_client_certificate_callback_ = select_client_certificate_callback; } + protected: + void set_resource_dispatcher_host_delegate( + scoped_ptr<ShellResourceDispatcherHostDelegate> delegate) { + resource_dispatcher_host_delegate_ = std::move(delegate); + } + + void set_browser_main_parts(ShellBrowserMainParts* parts) { + shell_browser_main_parts_ = parts; + } + private: ShellBrowserContext* ShellBrowserContextForBrowserContext( BrowserContext* content_browser_context); diff --git a/content/shell/browser/shell_devtools_frontend.cc b/content/shell/browser/shell_devtools_frontend.cc index f0b2fe6..02d5966 100644 --- a/content/shell/browser/shell_devtools_frontend.cc +++ b/content/shell/browser/shell_devtools_frontend.cc @@ -20,7 +20,6 @@ #include "content/public/browser/render_view_host.h" #include "content/public/browser/web_contents.h" #include "content/public/common/content_client.h" -#include "content/shell/browser/blink_test_controller.h" #include "content/shell/browser/shell.h" #include "content/shell/browser/shell_browser_context.h" #include "content/shell/browser/shell_browser_main_parts.h" diff --git a/content/shell/browser/shell_javascript_dialog_manager.cc b/content/shell/browser/shell_javascript_dialog_manager.cc index 615ac68..a312e8d 100644 --- a/content/shell/browser/shell_javascript_dialog_manager.cc +++ b/content/shell/browser/shell_javascript_dialog_manager.cc @@ -10,7 +10,6 @@ #include "build/build_config.h" #include "components/url_formatter/url_formatter.h" #include "content/public/browser/web_contents.h" -#include "content/shell/browser/blink_test_controller.h" #include "content/shell/browser/shell_javascript_dialog.h" #include "content/shell/common/shell_switches.h" |