summaryrefslogtreecommitdiffstats
path: root/content/shell
diff options
context:
space:
mode:
authorlukasza <lukasza@chromium.org>2016-03-10 08:48:43 -0800
committerCommit bot <commit-bot@chromium.org>2016-03-10 16:49:49 +0000
commit381b049a926507ef30b493deb57e12528d0ef3fd (patch)
treec289096af0570f8332ff878fffd8532aa7af7b18 /content/shell
parent5fb40e71b18c6c32dce4451821c7866fe80ea5e9 (diff)
downloadchromium_src-381b049a926507ef30b493deb57e12528d0ef3fd.zip
chromium_src-381b049a926507ef30b493deb57e12528d0ef3fd.tar.gz
chromium_src-381b049a926507ef30b493deb57e12528d0ef3fd.tar.bz2
Move layout-test-specific switches from shell_switches to layout_test_switches.h
This partially addresses a "soft" layering violation pointed out in https://codereview.chromium.org/1755123004/#msg4 ("soft" = honour-based, not DEPS-enforced). BUG=587175 Review URL: https://codereview.chromium.org/1763113002 Cr-Commit-Position: refs/heads/master@{#380420}
Diffstat (limited to 'content/shell')
-rw-r--r--content/shell/BUILD.gn2
-rw-r--r--content/shell/app/shell_main_delegate.cc1
-rw-r--r--content/shell/app/shell_main_delegate_mac.mm3
-rw-r--r--content/shell/browser/layout_test/blink_test_controller.cc2
-rw-r--r--content/shell/browser/layout_test/layout_test_browser_main.cc1
-rw-r--r--content/shell/browser/layout_test/layout_test_content_browser_client.cc25
-rw-r--r--content/shell/browser/shell.cc38
-rw-r--r--content/shell/browser/shell_content_browser_client.cc23
-rw-r--r--content/shell/browser/shell_web_contents_view_delegate_mac.mm3
-rw-r--r--content/shell/browser/shell_web_contents_view_delegate_win.cc3
-rw-r--r--content/shell/common/layout_test/layout_test_switches.cc52
-rw-r--r--content/shell/common/layout_test/layout_test_switches.h29
-rw-r--r--content/shell/common/shell_content_client.cc6
-rw-r--r--content/shell/common/shell_switches.cc46
-rw-r--r--content/shell/common/shell_switches.h17
-rw-r--r--content/shell/renderer/layout_test/blink_test_helpers.cc2
-rw-r--r--content/shell/renderer/layout_test/layout_test_render_process_observer.cc2
-rw-r--r--content/shell/renderer/shell_render_view_observer.cc2
18 files changed, 143 insertions, 114 deletions
diff --git a/content/shell/BUILD.gn b/content/shell/BUILD.gn
index 3606271..2dbf048 100644
--- a/content/shell/BUILD.gn
+++ b/content/shell/BUILD.gn
@@ -145,6 +145,8 @@ static_library("content_shell_lib") {
"browser/shell_web_contents_view_delegate_win.cc",
"common/layout_test/layout_test_messages.cc",
"common/layout_test/layout_test_messages.h",
+ "common/layout_test/layout_test_switches.cc",
+ "common/layout_test/layout_test_switches.h",
"common/leak_detection_result.h",
"common/shell_content_client.cc",
"common/shell_content_client.h",
diff --git a/content/shell/app/shell_main_delegate.cc b/content/shell/app/shell_main_delegate.cc
index 298f673..5a4c73f 100644
--- a/content/shell/app/shell_main_delegate.cc
+++ b/content/shell/app/shell_main_delegate.cc
@@ -26,6 +26,7 @@
#include "content/shell/browser/layout_test/layout_test_content_browser_client.h"
#include "content/shell/browser/shell_browser_main.h"
#include "content/shell/browser/shell_content_browser_client.h"
+#include "content/shell/common/layout_test/layout_test_switches.h"
#include "content/shell/common/shell_switches.h"
#include "content/shell/renderer/layout_test/layout_test_content_renderer_client.h"
#include "content/shell/renderer/shell_content_renderer_client.h"
diff --git a/content/shell/app/shell_main_delegate_mac.mm b/content/shell/app/shell_main_delegate_mac.mm
index bba20a1..298475c 100644
--- a/content/shell/app/shell_main_delegate_mac.mm
+++ b/content/shell/app/shell_main_delegate_mac.mm
@@ -28,8 +28,7 @@ void EnsureCorrectResolutionSettings() {
[[NSMutableDictionary alloc]
initWithContentsOfFile:base::mac::FilePathToNSString(info_plist)]);
- bool running_layout_tests = base::CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kRunLayoutTest);
+ bool running_layout_tests = switches::IsRunLayoutTestSwitchPresent();
bool not_high_resolution_capable =
[info_dict objectForKey:kHighResolutionCapable] &&
[[info_dict objectForKey:kHighResolutionCapable] isEqualToNumber:@(NO)];
diff --git a/content/shell/browser/layout_test/blink_test_controller.cc b/content/shell/browser/layout_test/blink_test_controller.cc
index 3ad8040..15d0f39 100644
--- a/content/shell/browser/layout_test/blink_test_controller.cc
+++ b/content/shell/browser/layout_test/blink_test_controller.cc
@@ -44,8 +44,8 @@
#include "content/shell/browser/shell_browser_context.h"
#include "content/shell/browser/shell_content_browser_client.h"
#include "content/shell/browser/shell_devtools_frontend.h"
+#include "content/shell/common/layout_test/layout_test_switches.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"
#include "ui/gfx/codec/png_codec.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 2984a09..e5b191e 100644
--- a/content/shell/browser/layout_test/layout_test_browser_main.cc
+++ b/content/shell/browser/layout_test/layout_test_browser_main.cc
@@ -24,6 +24,7 @@
#include "content/shell/browser/layout_test/blink_test_controller.h"
#include "content/shell/browser/layout_test/test_info_extractor.h"
#include "content/shell/browser/shell.h"
+#include "content/shell/common/layout_test/layout_test_switches.h"
#include "content/shell/common/shell_switches.h"
#include "content/shell/renderer/layout_test/blink_test_helpers.h"
#include "net/base/filename_util.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 227478d..8626064 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
@@ -18,8 +18,8 @@
#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/layout_test/layout_test_switches.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 {
@@ -89,6 +89,29 @@ void LayoutTestContentBrowserClient::AppendExtraCommandLineSwitches(
command_line->AppendSwitch(switches::kRunLayoutTest);
ShellContentBrowserClient::AppendExtraCommandLineSwitches(command_line,
child_process_id);
+ if (base::CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kAlwaysUseComplexText)) {
+ command_line->AppendSwitch(switches::kAlwaysUseComplexText);
+ }
+ if (base::CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kEnableFontAntialiasing)) {
+ command_line->AppendSwitch(switches::kEnableFontAntialiasing);
+ }
+ if (base::CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kExposeInternalsForTesting)) {
+ command_line->AppendSwitch(switches::kExposeInternalsForTesting);
+ }
+ if (base::CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kStableReleaseMode)) {
+ command_line->AppendSwitch(switches::kStableReleaseMode);
+ }
+ if (base::CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kEnableLeakDetection)) {
+ command_line->AppendSwitchASCII(
+ switches::kEnableLeakDetection,
+ base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
+ switches::kEnableLeakDetection));
+ }
}
BrowserMainParts* LayoutTestContentBrowserClient::CreateBrowserMainParts(
diff --git a/content/shell/browser/shell.cc b/content/shell/browser/shell.cc
index 6792150..ed655f3 100644
--- a/content/shell/browser/shell.cc
+++ b/content/shell/browser/shell.cc
@@ -77,9 +77,7 @@ Shell::Shell(WebContents* web_contents)
url_edit_view_(NULL),
#endif
headless_(false) {
- const base::CommandLine& command_line =
- *base::CommandLine::ForCurrentProcess();
- if (command_line.HasSwitch(switches::kRunLayoutTest))
+ if (switches::IsRunLayoutTestSwitchPresent())
headless_ = true;
windows_.push_back(this);
@@ -122,13 +120,13 @@ Shell* Shell::CreateShell(WebContents* web_contents,
// Note: Do not make RenderFrameHost or RenderViewHost specific state changes
// here, because they will be forgotten after a cross-process navigation. Use
// RenderFrameCreated or RenderViewCreated instead.
- base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
- if (command_line->HasSwitch(switches::kRunLayoutTest)) {
+ if (switches::IsRunLayoutTestSwitchPresent()) {
web_contents->GetMutableRendererPrefs()->use_custom_colors = false;
web_contents->GetRenderViewHost()->SyncRendererPrefs();
}
#if defined(ENABLE_WEBRTC)
+ base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
if (command_line->HasSwitch(switches::kForceWebRtcIPHandlingPolicy)) {
web_contents->GetMutableRendererPrefs()->webrtc_ip_handling_policy =
command_line->GetSwitchValueASCII(
@@ -253,8 +251,7 @@ void Shell::AddNewContents(WebContents* source,
bool user_gesture,
bool* was_blocked) {
CreateShell(new_contents, AdjustWindowSize(initial_rect.size()));
- if (base::CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kRunLayoutTest))
+ if (switches::IsRunLayoutTestSwitchPresent())
NotifyDoneForwarder::CreateForWebContents(new_contents);
}
@@ -355,8 +352,7 @@ void Shell::ToggleFullscreenModeForTab(WebContents* web_contents,
#if defined(OS_ANDROID)
PlatformToggleFullscreenModeForTab(web_contents, enter_fullscreen);
#endif
- if (!base::CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kRunLayoutTest))
+ if (!switches::IsRunLayoutTestSwitchPresent())
return;
if (is_fullscreen_ != enter_fullscreen) {
is_fullscreen_ = enter_fullscreen;
@@ -406,11 +402,9 @@ void Shell::DidNavigateMainFramePostCommit(WebContents* web_contents) {
JavaScriptDialogManager* Shell::GetJavaScriptDialogManager(
WebContents* source) {
if (!dialog_manager_) {
- const base::CommandLine& command_line =
- *base::CommandLine::ForCurrentProcess();
- dialog_manager_.reset(command_line.HasSwitch(switches::kRunLayoutTest)
- ? new LayoutTestJavaScriptDialogManager
- : new ShellJavaScriptDialogManager);
+ dialog_manager_.reset(switches::IsRunLayoutTestSwitchPresent()
+ ? new LayoutTestJavaScriptDialogManager
+ : new ShellJavaScriptDialogManager);
}
return dialog_manager_.get();
}
@@ -418,9 +412,7 @@ JavaScriptDialogManager* Shell::GetJavaScriptDialogManager(
scoped_ptr<BluetoothChooser> Shell::RunBluetoothChooser(
RenderFrameHost* frame,
const BluetoothChooser::EventHandler& event_handler) {
- const base::CommandLine& command_line =
- *base::CommandLine::ForCurrentProcess();
- if (command_line.HasSwitch(switches::kRunLayoutTest)) {
+ if (switches::IsRunLayoutTestSwitchPresent()) {
return BlinkTestController::Get()->RunBluetoothChooser(frame,
event_handler);
}
@@ -432,15 +424,12 @@ bool Shell::AddMessageToConsole(WebContents* source,
const base::string16& message,
int32_t line_no,
const base::string16& source_id) {
- return base::CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kRunLayoutTest);
+ return switches::IsRunLayoutTestSwitchPresent();
}
void Shell::RendererUnresponsive(WebContents* source) {
- if (!base::CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kRunLayoutTest))
- return;
- BlinkTestController::Get()->RendererUnresponsive();
+ if (switches::IsRunLayoutTestSwitchPresent())
+ BlinkTestController::Get()->RendererUnresponsive();
}
void Shell::ActivateContents(WebContents* contents) {
@@ -471,8 +460,7 @@ gfx::Size Shell::GetShellDefaultSize() {
void Shell::RenderViewCreated(RenderViewHost* render_view_host) {
// All RenderViewHosts in layout tests should get Mojo bindings.
- base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
- if (command_line->HasSwitch(switches::kRunLayoutTest))
+ if (switches::IsRunLayoutTestSwitchPresent())
render_view_host->AllowBindings(BINDINGS_POLICY_MOJO);
}
diff --git a/content/shell/browser/shell_content_browser_client.cc b/content/shell/browser/shell_content_browser_client.cc
index 39eb87e..4fe9084 100644
--- a/content/shell/browser/shell_content_browser_client.cc
+++ b/content/shell/browser/shell_content_browser_client.cc
@@ -234,22 +234,6 @@ void ShellContentBrowserClient::AppendExtraCommandLineSwitches(
base::CommandLine* command_line,
int child_process_id) {
if (base::CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kEnableFontAntialiasing)) {
- command_line->AppendSwitch(switches::kEnableFontAntialiasing);
- }
- if (base::CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kAlwaysUseComplexText)) {
- command_line->AppendSwitch(switches::kAlwaysUseComplexText);
- }
- if (base::CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kExposeInternalsForTesting)) {
- command_line->AppendSwitch(switches::kExposeInternalsForTesting);
- }
- if (base::CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kStableReleaseMode)) {
- command_line->AppendSwitch(switches::kStableReleaseMode);
- }
- if (base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kEnableCrashReporter)) {
command_line->AppendSwitch(switches::kEnableCrashReporter);
}
@@ -261,13 +245,6 @@ void ShellContentBrowserClient::AppendExtraCommandLineSwitches(
switches::kCrashDumpsDir));
}
if (base::CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kEnableLeakDetection)) {
- command_line->AppendSwitchASCII(
- switches::kEnableLeakDetection,
- base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
- switches::kEnableLeakDetection));
- }
- if (base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kIsolateSitesForTesting)) {
command_line->AppendSwitchASCII(
switches::kIsolateSitesForTesting,
diff --git a/content/shell/browser/shell_web_contents_view_delegate_mac.mm b/content/shell/browser/shell_web_contents_view_delegate_mac.mm
index 5d8ecdd..8cfc1d7b2 100644
--- a/content/shell/browser/shell_web_contents_view_delegate_mac.mm
+++ b/content/shell/browser/shell_web_contents_view_delegate_mac.mm
@@ -95,8 +95,7 @@ ShellWebContentsViewDelegate::~ShellWebContentsViewDelegate() {
void ShellWebContentsViewDelegate::ShowContextMenu(
RenderFrameHost* render_frame_host,
const ContextMenuParams& params) {
- if (base::CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kRunLayoutTest))
+ if (switches::IsRunLayoutTestSwitchPresent())
return;
params_ = params;
diff --git a/content/shell/browser/shell_web_contents_view_delegate_win.cc b/content/shell/browser/shell_web_contents_view_delegate_win.cc
index d71bf0d..3ae4d2a8 100644
--- a/content/shell/browser/shell_web_contents_view_delegate_win.cc
+++ b/content/shell/browser/shell_web_contents_view_delegate_win.cc
@@ -72,8 +72,7 @@ ShellWebContentsViewDelegate::~ShellWebContentsViewDelegate() {
void ShellWebContentsViewDelegate::ShowContextMenu(
RenderFrameHost* render_frame_host,
const ContextMenuParams& params) {
- if (base::CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kRunLayoutTest))
+ if (switches::IsRunLayoutTestSwitchPresent())
return;
params_ = params;
diff --git a/content/shell/common/layout_test/layout_test_switches.cc b/content/shell/common/layout_test/layout_test_switches.cc
new file mode 100644
index 0000000..46cf864
--- /dev/null
+++ b/content/shell/common/layout_test/layout_test_switches.cc
@@ -0,0 +1,52 @@
+// Copyright 2016 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/shell/common/layout_test/layout_test_switches.h"
+
+#include "base/command_line.h"
+#include "base/strings/string_split.h"
+
+namespace switches {
+
+// Allow access to external pages during layout tests.
+const char kAllowExternalPages[] = "allow-external-pages";
+
+// Check whether all system dependencies for running layout tests are met.
+const char kCheckLayoutTestSysDeps[] = "check-layout-test-sys-deps";
+
+// When specified to "enable-leak-detection" command-line option,
+// causes the leak detector to cause immediate crash when found leak.
+const char kCrashOnFailure[] = "crash-on-failure";
+
+// Enable accelerated 2D canvas.
+const char kEnableAccelerated2DCanvas[] = "enable-accelerated-2d-canvas";
+
+// Enable font antialiasing for pixel tests.
+const char kEnableFontAntialiasing[] = "enable-font-antialiasing";
+
+// Always use the complex text path for layout tests.
+const char kAlwaysUseComplexText[] = "always-use-complex-text";
+
+// Enables the leak detection of loading webpages. This allows us to check
+// whether or not reloading a webpage releases web-related objects correctly.
+const char kEnableLeakDetection[] = "enable-leak-detection";
+
+// Encode binary layout test results (images, audio) using base64.
+const char kEncodeBinary[] = "encode-binary";
+
+// Exposes the window.internals object to JavaScript for interactive development
+// and debugging of layout tests that rely on it.
+const char kExposeInternalsForTesting[] = "expose-internals-for-testing";
+
+// Request the render trees of pages to be dumped as text once they have
+// finished loading.
+const char kRunLayoutTest[] = "run-layout-test";
+
+// This makes us disable some web-platform runtime features so that we test
+// content_shell as if it was a stable release. It is only followed when
+// kRunLayoutTest is set. For the features' level, see
+// http://dev.chromium.org/blink/runtime-enabled-features.
+const char kStableReleaseMode[] = "stable-release-mode";
+
+} // namespace switches
diff --git a/content/shell/common/layout_test/layout_test_switches.h b/content/shell/common/layout_test/layout_test_switches.h
new file mode 100644
index 0000000..fbcef12
--- /dev/null
+++ b/content/shell/common/layout_test/layout_test_switches.h
@@ -0,0 +1,29 @@
+// Copyright 2016 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.
+
+// Defines all the "layout_test" command-line switches.
+
+#ifndef CONTENT_SHELL_COMMON_LAYOUT_TEST_LAYOUT_TEST_SWITCHES_H_
+#define CONTENT_SHELL_COMMON_LAYOUT_TEST_LAYOUT_TEST_SWITCHES_H_
+
+#include <string>
+#include <vector>
+
+namespace switches {
+
+extern const char kAllowExternalPages[];
+extern const char kCheckLayoutTestSysDeps[];
+extern const char kCrashOnFailure[];
+extern const char kEnableAccelerated2DCanvas[];
+extern const char kEnableFontAntialiasing[];
+extern const char kAlwaysUseComplexText[];
+extern const char kEnableLeakDetection[];
+extern const char kEncodeBinary[];
+extern const char kExposeInternalsForTesting[];
+extern const char kRunLayoutTest[];
+extern const char kStableReleaseMode[];
+
+} // namespace switches
+
+#endif // CONTENT_SHELL_COMMON_LAYOUT_TEST_LAYOUT_TEST_SWITCHES_H_
diff --git a/content/shell/common/shell_content_client.cc b/content/shell/common/shell_content_client.cc
index d0940b8..842e0c1 100644
--- a/content/shell/common/shell_content_client.cc
+++ b/content/shell/common/shell_content_client.cc
@@ -36,8 +36,7 @@ std::string ShellContentClient::GetUserAgent() const {
}
base::string16 ShellContentClient::GetLocalizedString(int message_id) const {
- if (base::CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kRunLayoutTest)) {
+ if (switches::IsRunLayoutTestSwitchPresent()) {
switch (message_id) {
case IDS_FORM_OTHER_DATE_LABEL:
return base::ASCIIToUTF16("<<OtherDateLabel>>");
@@ -63,8 +62,7 @@ base::string16 ShellContentClient::GetLocalizedString(int message_id) const {
base::StringPiece ShellContentClient::GetDataResource(
int resource_id,
ui::ScaleFactor scale_factor) const {
- if (base::CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kRunLayoutTest)) {
+ if (switches::IsRunLayoutTestSwitchPresent()) {
switch (resource_id) {
case IDR_BROKENIMAGE:
#if defined(OS_MACOSX)
diff --git a/content/shell/common/shell_switches.cc b/content/shell/common/shell_switches.cc
index a125244..09a3817 100644
--- a/content/shell/common/shell_switches.cc
+++ b/content/shell/common/shell_switches.cc
@@ -6,15 +6,10 @@
#include "base/command_line.h"
#include "base/strings/string_split.h"
+#include "content/shell/common/layout_test/layout_test_switches.h"
namespace switches {
-// Allow access to external pages during layout tests.
-const char kAllowExternalPages[] = "allow-external-pages";
-
-// Check whether all system dependencies for running layout tests are met.
-const char kCheckLayoutTestSysDeps[] = "check-layout-test-sys-deps";
-
// Tells Content Shell that it's running as a content_browsertest.
const char kContentBrowserTest[] = "browser-test";
@@ -24,30 +19,6 @@ const char kContentShellDataPath[] = "data-path";
// The directory breakpad should store minidumps in.
const char kCrashDumpsDir[] = "crash-dumps-dir";
-// When specified to "enable-leak-detection" command-line option,
-// causes the leak detector to cause immediate crash when found leak.
-const char kCrashOnFailure[] = "crash-on-failure";
-
-// Enable accelerated 2D canvas.
-const char kEnableAccelerated2DCanvas[] = "enable-accelerated-2d-canvas";
-
-// Enable font antialiasing for pixel tests.
-const char kEnableFontAntialiasing[] = "enable-font-antialiasing";
-
-// Always use the complex text path for layout tests.
-const char kAlwaysUseComplexText[] = "always-use-complex-text";
-
-// Enables the leak detection of loading webpages. This allows us to check
-// whether or not reloading a webpage releases web-related objects correctly.
-const char kEnableLeakDetection[] = "enable-leak-detection";
-
-// Encode binary layout test results (images, audio) using base64.
-const char kEncodeBinary[] = "encode-binary";
-
-// Exposes the window.internals object to JavaScript for interactive development
-// and debugging of layout tests that rely on it.
-const char kExposeInternalsForTesting[] = "expose-internals-for-testing";
-
// Enable site isolation (--site-per-process style isolation) for a subset of
// sites. The argument is a wildcard pattern which will be matched against the
// site URL to determine which sites to isolate. This can be used to isolate
@@ -61,16 +32,6 @@ const char kIsolateSitesForTesting[] = "isolate-sites-for-testing";
// with a semicolon (;).
const char kRegisterFontFiles[] = "register-font-files";
-// Request the render trees of pages to be dumped as text once they have
-// finished loading.
-const char kRunLayoutTest[] = "run-layout-test";
-
-// This makes us disable some web-platform runtime features so that we test
-// content_shell as if it was a stable release. It is only followed when
-// kRunLayoutTest is set. For the features' level, see
-// http://dev.chromium.org/blink/runtime-enabled-features.
-const char kStableReleaseMode[] = "stable-release-mode";
-
// Size for the content_shell's host window (i.e. "800x600").
const char kContentShellHostWindowSize[] = "content-shell-host-window-size";
@@ -86,4 +47,9 @@ std::vector<std::string> GetSideloadFontFiles() {
return files;
}
+bool IsRunLayoutTestSwitchPresent() {
+ return base::CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kRunLayoutTest);
+}
+
} // namespace switches
diff --git a/content/shell/common/shell_switches.h b/content/shell/common/shell_switches.h
index 4c61a11..5ee6fde 100644
--- a/content/shell/common/shell_switches.h
+++ b/content/shell/common/shell_switches.h
@@ -12,27 +12,22 @@
namespace switches {
-extern const char kAllowExternalPages[];
-extern const char kCheckLayoutTestSysDeps[];
extern const char kContentBrowserTest[];
extern const char kContentShellDataPath[];
extern const char kCrashDumpsDir[];
-extern const char kCrashOnFailure[];
-extern const char kEnableAccelerated2DCanvas[];
-extern const char kEnableFontAntialiasing[];
-extern const char kAlwaysUseComplexText[];
-extern const char kEnableLeakDetection[];
-extern const char kEncodeBinary[];
-extern const char kExposeInternalsForTesting[];
extern const char kIsolateSitesForTesting[];
extern const char kRegisterFontFiles[];
-extern const char kRunLayoutTest[];
-extern const char kStableReleaseMode[];
extern const char kContentShellHostWindowSize[];
// Returns list of extra font files to be made accessible to the renderer.
std::vector<std::string> GetSideloadFontFiles();
+// Tells if content shell is running layout tests.
+// TODO(lukasza): The function below somewhat violates the layering (by
+// enabling shell -> layout_tests dependency) but at least narrows the extent of
+// the dependency to a single switch...
+bool IsRunLayoutTestSwitchPresent();
+
} // namespace switches
#endif // CONTENT_SHELL_COMMON_SHELL_SWITCHES_H_
diff --git a/content/shell/renderer/layout_test/blink_test_helpers.cc b/content/shell/renderer/layout_test/blink_test_helpers.cc
index 029c85b..d686988 100644
--- a/content/shell/renderer/layout_test/blink_test_helpers.cc
+++ b/content/shell/renderer/layout_test/blink_test_helpers.cc
@@ -12,7 +12,7 @@
#include "components/test_runner/test_preferences.h"
#include "content/public/common/content_switches.h"
#include "content/public/common/web_preferences.h"
-#include "content/shell/common/shell_switches.h"
+#include "content/shell/common/layout_test/layout_test_switches.h"
namespace content {
diff --git a/content/shell/renderer/layout_test/layout_test_render_process_observer.cc b/content/shell/renderer/layout_test/layout_test_render_process_observer.cc
index 71d29c4..02f1815 100644
--- a/content/shell/renderer/layout_test/layout_test_render_process_observer.cc
+++ b/content/shell/renderer/layout_test/layout_test_render_process_observer.cc
@@ -10,8 +10,8 @@
#include "content/public/renderer/render_thread.h"
#include "content/public/renderer/render_view.h"
#include "content/public/test/layouttest_support.h"
+#include "content/shell/common/layout_test/layout_test_switches.h"
#include "content/shell/common/shell_messages.h"
-#include "content/shell/common/shell_switches.h"
#include "content/shell/renderer/layout_test/blink_test_runner.h"
#include "third_party/WebKit/public/web/WebKit.h"
#include "third_party/WebKit/public/web/WebRuntimeFeatures.h"
diff --git a/content/shell/renderer/shell_render_view_observer.cc b/content/shell/renderer/shell_render_view_observer.cc
index c24c121..893062c 100644
--- a/content/shell/renderer/shell_render_view_observer.cc
+++ b/content/shell/renderer/shell_render_view_observer.cc
@@ -7,7 +7,7 @@
#include "base/command_line.h"
#include "content/public/renderer/render_view.h"
#include "content/public/renderer/render_view_observer.h"
-#include "content/shell/common/shell_switches.h"
+#include "content/shell/common/layout_test/layout_test_switches.h"
#include "third_party/WebKit/public/web/WebTestingSupport.h"
#include "third_party/WebKit/public/web/WebView.h"