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 "base/at_exit.h" | 5 #include "base/at_exit.h" |
6 #include "base/basictypes.h" | 6 #include "base/basictypes.h" |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/debug/stack_trace.h" | 8 #include "base/debug/stack_trace.h" |
9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
10 #include "base/environment.h" | 10 #include "base/environment.h" |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 parsed_command_line.HasSwitch(test_shell::kGPFaultErrorBox); | 118 parsed_command_line.HasSwitch(test_shell::kGPFaultErrorBox); |
119 | 119 |
120 bool allow_external_pages = | 120 bool allow_external_pages = |
121 parsed_command_line.HasSwitch(test_shell::kAllowExternalPages); | 121 parsed_command_line.HasSwitch(test_shell::kAllowExternalPages); |
122 | 122 |
123 if (parsed_command_line.HasSwitch(test_shell::kEnableAccel2DCanvas)) | 123 if (parsed_command_line.HasSwitch(test_shell::kEnableAccel2DCanvas)) |
124 TestShell::SetAccelerated2dCanvasEnabled(true); | 124 TestShell::SetAccelerated2dCanvasEnabled(true); |
125 if (parsed_command_line.HasSwitch(test_shell::kEnableAccelCompositing)) | 125 if (parsed_command_line.HasSwitch(test_shell::kEnableAccelCompositing)) |
126 TestShell::SetAcceleratedCompositingEnabled(true); | 126 TestShell::SetAcceleratedCompositingEnabled(true); |
127 | 127 |
128 if (parsed_command_line.HasSwitch(test_shell::kMultipleLoads)) { | |
129 const std::string multiple_loads_str = | |
130 parsed_command_line.GetSwitchValueASCII(test_shell::kMultipleLoads); | |
131 int load_count; | |
132 base::StringToInt(multiple_loads_str, &load_count); | |
133 if (load_count <= 0) { | |
134 #ifndef NDEBUG | |
135 load_count = 2; | |
136 #else | |
137 load_count = 5; | |
138 #endif | |
139 } | |
140 TestShell::SetMultipleLoad(load_count); | |
141 } | |
142 | |
143 bool layout_test_mode = false; | 128 bool layout_test_mode = false; |
144 TestShell::InitLogging(suppress_error_dialogs, | 129 TestShell::InitLogging(suppress_error_dialogs, |
145 layout_test_mode, | 130 layout_test_mode, |
146 enable_gp_fault_error_box); | 131 enable_gp_fault_error_box); |
147 | 132 |
148 // Initialize WebKit for this scope. | 133 // Initialize WebKit for this scope. |
149 TestShellWebKitInit test_shell_webkit_init(layout_test_mode); | 134 TestShellWebKitInit test_shell_webkit_init(layout_test_mode); |
150 | 135 |
151 // Suppress abort message in v8 library in debugging mode (but not | 136 // Suppress abort message in v8 library in debugging mode (but not |
152 // actually under a debugger). V8 calls abort() when it hits | 137 // actually under a debugger). V8 calls abort() when it hits |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 #if defined(OS_WIN) | 176 #if defined(OS_WIN) |
192 TestShellWebTheme::Engine engine; | 177 TestShellWebTheme::Engine engine; |
193 #endif | 178 #endif |
194 if (classic_theme) | 179 if (classic_theme) |
195 platform.SelectUnifiedTheme(); | 180 platform.SelectUnifiedTheme(); |
196 #if defined(OS_WIN) | 181 #if defined(OS_WIN) |
197 if (generic_theme) | 182 if (generic_theme) |
198 test_shell_webkit_init.SetThemeEngine(&engine); | 183 test_shell_webkit_init.SetThemeEngine(&engine); |
199 #endif | 184 #endif |
200 | 185 |
201 if (parsed_command_line.HasSwitch(test_shell::kTestShellTimeOut)) { | |
202 const std::string timeout_str = parsed_command_line.GetSwitchValueASCII( | |
203 test_shell::kTestShellTimeOut); | |
204 int timeout_ms; | |
205 base::StringToInt(timeout_str, &timeout_ms); | |
206 if (timeout_ms > 0) | |
207 TestShell::SetFileTestTimeout(timeout_ms); | |
208 } | |
209 | |
210 // Unless specifically requested otherwise, default to OSMesa for GL. | 186 // Unless specifically requested otherwise, default to OSMesa for GL. |
211 if (!parsed_command_line.HasSwitch(switches::kUseGL)) | 187 if (!parsed_command_line.HasSwitch(switches::kUseGL)) |
212 gfx::InitializeGLBindings(gfx::kGLImplementationOSMesaGL); | 188 gfx::InitializeGLBindings(gfx::kGLImplementationOSMesaGL); |
213 | 189 |
214 // Treat the first argument as the initial URL to open. | 190 // Treat the first argument as the initial URL to open. |
215 GURL starting_url; | 191 GURL starting_url; |
216 | 192 |
217 base::FilePath path; | 193 base::FilePath path; |
218 PathService::Get(base::DIR_SOURCE_ROOT, &path); | 194 PathService::Get(base::DIR_SOURCE_ROOT, &path); |
219 path = path.AppendASCII("webkit").AppendASCII("data") | 195 path = path.AppendASCII("webkit").AppendASCII("data") |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 TestShell::ShutdownTestShell(); | 261 TestShell::ShutdownTestShell(); |
286 TestShell::CleanupLogging(); | 262 TestShell::CleanupLogging(); |
287 | 263 |
288 // Tear down shared StatsTable; prevents unit_tests from leaking it. | 264 // Tear down shared StatsTable; prevents unit_tests from leaking it. |
289 base::StatsTable::set_current(NULL); | 265 base::StatsTable::set_current(NULL); |
290 delete table; | 266 delete table; |
291 RemoveSharedMemoryFile(stats_filename); | 267 RemoveSharedMemoryFile(stats_filename); |
292 | 268 |
293 return 0; | 269 return 0; |
294 } | 270 } |
OLD | NEW |