OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/shell/common/shell_switches.h" | 5 #include "content/shell/common/shell_switches.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/strings/string_split.h" | 8 #include "base/strings/string_split.h" |
| 9 #include "content/shell/common/layout_test/layout_test_switches.h" |
9 | 10 |
10 namespace switches { | 11 namespace switches { |
11 | 12 |
12 // Allow access to external pages during layout tests. | |
13 const char kAllowExternalPages[] = "allow-external-pages"; | |
14 | |
15 // Check whether all system dependencies for running layout tests are met. | |
16 const char kCheckLayoutTestSysDeps[] = "check-layout-test-sys-deps"; | |
17 | |
18 // Tells Content Shell that it's running as a content_browsertest. | 13 // Tells Content Shell that it's running as a content_browsertest. |
19 const char kContentBrowserTest[] = "browser-test"; | 14 const char kContentBrowserTest[] = "browser-test"; |
20 | 15 |
21 // Makes Content Shell use the given path for its data directory. | 16 // Makes Content Shell use the given path for its data directory. |
22 const char kContentShellDataPath[] = "data-path"; | 17 const char kContentShellDataPath[] = "data-path"; |
23 | 18 |
24 // The directory breakpad should store minidumps in. | 19 // The directory breakpad should store minidumps in. |
25 const char kCrashDumpsDir[] = "crash-dumps-dir"; | 20 const char kCrashDumpsDir[] = "crash-dumps-dir"; |
26 | 21 |
27 // When specified to "enable-leak-detection" command-line option, | |
28 // causes the leak detector to cause immediate crash when found leak. | |
29 const char kCrashOnFailure[] = "crash-on-failure"; | |
30 | |
31 // Enable accelerated 2D canvas. | |
32 const char kEnableAccelerated2DCanvas[] = "enable-accelerated-2d-canvas"; | |
33 | |
34 // Enable font antialiasing for pixel tests. | |
35 const char kEnableFontAntialiasing[] = "enable-font-antialiasing"; | |
36 | |
37 // Always use the complex text path for layout tests. | |
38 const char kAlwaysUseComplexText[] = "always-use-complex-text"; | |
39 | |
40 // Enables the leak detection of loading webpages. This allows us to check | |
41 // whether or not reloading a webpage releases web-related objects correctly. | |
42 const char kEnableLeakDetection[] = "enable-leak-detection"; | |
43 | |
44 // Encode binary layout test results (images, audio) using base64. | |
45 const char kEncodeBinary[] = "encode-binary"; | |
46 | |
47 // Exposes the window.internals object to JavaScript for interactive development | |
48 // and debugging of layout tests that rely on it. | |
49 const char kExposeInternalsForTesting[] = "expose-internals-for-testing"; | |
50 | |
51 // Enable site isolation (--site-per-process style isolation) for a subset of | 22 // Enable site isolation (--site-per-process style isolation) for a subset of |
52 // sites. The argument is a wildcard pattern which will be matched against the | 23 // sites. The argument is a wildcard pattern which will be matched against the |
53 // site URL to determine which sites to isolate. This can be used to isolate | 24 // site URL to determine which sites to isolate. This can be used to isolate |
54 // just one top-level domain, or just one scheme. Example usages: | 25 // just one top-level domain, or just one scheme. Example usages: |
55 // --isolate-sites-for-testing=*.com | 26 // --isolate-sites-for-testing=*.com |
56 // --isolate-sites-for-testing=https://* | 27 // --isolate-sites-for-testing=https://* |
57 const char kIsolateSitesForTesting[] = "isolate-sites-for-testing"; | 28 const char kIsolateSitesForTesting[] = "isolate-sites-for-testing"; |
58 | 29 |
59 // Registers additional font files on Windows (for fonts outside the usual | 30 // Registers additional font files on Windows (for fonts outside the usual |
60 // %WINDIR%\Fonts location). Multiple files can be used by separating them | 31 // %WINDIR%\Fonts location). Multiple files can be used by separating them |
61 // with a semicolon (;). | 32 // with a semicolon (;). |
62 const char kRegisterFontFiles[] = "register-font-files"; | 33 const char kRegisterFontFiles[] = "register-font-files"; |
63 | 34 |
64 // Request the render trees of pages to be dumped as text once they have | |
65 // finished loading. | |
66 const char kRunLayoutTest[] = "run-layout-test"; | |
67 | |
68 // This makes us disable some web-platform runtime features so that we test | |
69 // content_shell as if it was a stable release. It is only followed when | |
70 // kRunLayoutTest is set. For the features' level, see | |
71 // http://dev.chromium.org/blink/runtime-enabled-features. | |
72 const char kStableReleaseMode[] = "stable-release-mode"; | |
73 | |
74 // Size for the content_shell's host window (i.e. "800x600"). | 35 // Size for the content_shell's host window (i.e. "800x600"). |
75 const char kContentShellHostWindowSize[] = "content-shell-host-window-size"; | 36 const char kContentShellHostWindowSize[] = "content-shell-host-window-size"; |
76 | 37 |
77 std::vector<std::string> GetSideloadFontFiles() { | 38 std::vector<std::string> GetSideloadFontFiles() { |
78 std::vector<std::string> files; | 39 std::vector<std::string> files; |
79 const base::CommandLine& command_line = | 40 const base::CommandLine& command_line = |
80 *base::CommandLine::ForCurrentProcess(); | 41 *base::CommandLine::ForCurrentProcess(); |
81 if (command_line.HasSwitch(switches::kRegisterFontFiles)) { | 42 if (command_line.HasSwitch(switches::kRegisterFontFiles)) { |
82 files = base::SplitString( | 43 files = base::SplitString( |
83 command_line.GetSwitchValueASCII(switches::kRegisterFontFiles), | 44 command_line.GetSwitchValueASCII(switches::kRegisterFontFiles), |
84 ";", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); | 45 ";", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); |
85 } | 46 } |
86 return files; | 47 return files; |
87 } | 48 } |
88 | 49 |
| 50 bool IsRunLayoutTestSwitchPresent() { |
| 51 return base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 52 switches::kRunLayoutTest); |
| 53 } |
| 54 |
89 } // namespace switches | 55 } // namespace switches |
OLD | NEW |