OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/test/base/test_launcher_utils.h" |
| 6 |
5 #include "base/command_line.h" | 7 #include "base/command_line.h" |
6 #include "base/environment.h" | 8 #include "base/environment.h" |
7 #include "base/logging.h" | 9 #include "base/logging.h" |
8 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
9 #include "base/path_service.h" | 11 #include "base/path_service.h" |
10 #include "base/string_number_conversions.h" | 12 #include "base/string_number_conversions.h" |
11 #include "chrome/common/chrome_paths.h" | 13 #include "chrome/common/chrome_paths.h" |
12 #include "chrome/common/chrome_switches.h" | 14 #include "chrome/common/chrome_switches.h" |
13 #include "chrome/test/base/test_launcher_utils.h" | |
14 #include "ui/gfx/gl/gl_switches.h" | 15 #include "ui/gfx/gl/gl_switches.h" |
15 | 16 |
16 namespace { | |
17 | |
18 // A multiplier for slow tests. We generally avoid multiplying | |
19 // test timeouts by any constants. Here it is used as last resort | |
20 // to implement the SLOW_ test prefix. | |
21 static const int kSlowTestTimeoutMultiplier = 5; | |
22 | |
23 } // namespace | |
24 | |
25 namespace test_launcher_utils { | 17 namespace test_launcher_utils { |
26 | 18 |
27 void PrepareBrowserCommandLineForTests(CommandLine* command_line) { | 19 void PrepareBrowserCommandLineForTests(CommandLine* command_line) { |
28 // Turn off tip loading for tests; see http://crbug.com/17725. | 20 // Turn off tip loading for tests; see http://crbug.com/17725. |
29 command_line->AppendSwitch(switches::kDisableWebResources); | 21 command_line->AppendSwitch(switches::kDisableWebResources); |
30 | 22 |
31 // Turn off preconnects because they break the brittle python webserver; | 23 // Turn off preconnects because they break the brittle python webserver; |
32 // see http://crbug.com/60035. | 24 // see http://crbug.com/60035. |
33 command_line->AppendSwitch(switches::kDisablePreconnect); | 25 command_line->AppendSwitch(switches::kDisablePreconnect); |
34 | 26 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 bool OverrideGLImplementation(CommandLine* command_line, | 79 bool OverrideGLImplementation(CommandLine* command_line, |
88 const std::string& implementation_name) { | 80 const std::string& implementation_name) { |
89 if (command_line->HasSwitch(switches::kUseGL)) | 81 if (command_line->HasSwitch(switches::kUseGL)) |
90 return false; | 82 return false; |
91 | 83 |
92 command_line->AppendSwitchASCII(switches::kUseGL, implementation_name); | 84 command_line->AppendSwitchASCII(switches::kUseGL, implementation_name); |
93 | 85 |
94 return true; | 86 return true; |
95 } | 87 } |
96 | 88 |
97 int GetTestTerminationTimeout(const std::string& test_name, | |
98 int default_timeout_ms) { | |
99 int timeout_ms = default_timeout_ms; | |
100 | |
101 // Make it possible for selected tests to request a longer timeout. | |
102 // Generally tests should really avoid doing too much, and splitting | |
103 // a test instead of using SLOW prefix is strongly preferred. | |
104 if (test_name.find("SLOW_") != std::string::npos) | |
105 timeout_ms *= kSlowTestTimeoutMultiplier; | |
106 | |
107 return timeout_ms; | |
108 } | |
109 | |
110 } // namespace test_launcher_utils | 89 } // namespace test_launcher_utils |
OLD | NEW |