| 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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 // assertion errors. | 153 // assertion errors. |
| 154 if (suppress_error_dialogs) { | 154 if (suppress_error_dialogs) { |
| 155 platform.SuppressErrorReporting(); | 155 platform.SuppressErrorReporting(); |
| 156 } | 156 } |
| 157 | 157 |
| 158 net::HttpCache::Mode cache_mode = net::HttpCache::NORMAL; | 158 net::HttpCache::Mode cache_mode = net::HttpCache::NORMAL; |
| 159 | 159 |
| 160 if (parsed_command_line.HasSwitch(test_shell::kEnableFileCookies)) | 160 if (parsed_command_line.HasSwitch(test_shell::kEnableFileCookies)) |
| 161 net::CookieMonster::EnableFileScheme(); | 161 net::CookieMonster::EnableFileScheme(); |
| 162 | 162 |
| 163 FilePath cache_path = | 163 base::FilePath cache_path = |
| 164 parsed_command_line.GetSwitchValuePath(test_shell::kCacheDir); | 164 parsed_command_line.GetSwitchValuePath(test_shell::kCacheDir); |
| 165 if (cache_path.empty()) { | 165 if (cache_path.empty()) { |
| 166 PathService::Get(base::DIR_EXE, &cache_path); | 166 PathService::Get(base::DIR_EXE, &cache_path); |
| 167 cache_path = cache_path.AppendASCII("cache"); | 167 cache_path = cache_path.AppendASCII("cache"); |
| 168 } | 168 } |
| 169 | 169 |
| 170 // Initializing with a default context, which means no on-disk cookie DB, | 170 // Initializing with a default context, which means no on-disk cookie DB, |
| 171 // and no support for directory listings. | 171 // and no support for directory listings. |
| 172 SimpleResourceLoaderBridge::Init(cache_path, cache_mode, layout_test_mode); | 172 SimpleResourceLoaderBridge::Init(cache_path, cache_mode, layout_test_mode); |
| 173 | 173 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 TestShell::SetFileTestTimeout(timeout_ms); | 207 TestShell::SetFileTestTimeout(timeout_ms); |
| 208 } | 208 } |
| 209 | 209 |
| 210 // Unless specifically requested otherwise, default to OSMesa for GL. | 210 // Unless specifically requested otherwise, default to OSMesa for GL. |
| 211 if (!parsed_command_line.HasSwitch(switches::kUseGL)) | 211 if (!parsed_command_line.HasSwitch(switches::kUseGL)) |
| 212 gfx::InitializeGLBindings(gfx::kGLImplementationOSMesaGL); | 212 gfx::InitializeGLBindings(gfx::kGLImplementationOSMesaGL); |
| 213 | 213 |
| 214 // Treat the first argument as the initial URL to open. | 214 // Treat the first argument as the initial URL to open. |
| 215 GURL starting_url; | 215 GURL starting_url; |
| 216 | 216 |
| 217 FilePath path; | 217 base::FilePath path; |
| 218 PathService::Get(base::DIR_SOURCE_ROOT, &path); | 218 PathService::Get(base::DIR_SOURCE_ROOT, &path); |
| 219 path = path.AppendASCII("webkit").AppendASCII("data") | 219 path = path.AppendASCII("webkit").AppendASCII("data") |
| 220 .AppendASCII("test_shell").AppendASCII("index.html"); | 220 .AppendASCII("test_shell").AppendASCII("index.html"); |
| 221 starting_url = net::FilePathToFileURL(path); | 221 starting_url = net::FilePathToFileURL(path); |
| 222 | 222 |
| 223 const CommandLine::StringVector& args = parsed_command_line.GetArgs(); | 223 const CommandLine::StringVector& args = parsed_command_line.GetArgs(); |
| 224 if (!args.empty()) { | 224 if (!args.empty()) { |
| 225 GURL url(args[0]); | 225 GURL url(args[0]); |
| 226 if (url.is_valid()) { | 226 if (url.is_valid()) { |
| 227 starting_url = url; | 227 starting_url = url; |
| 228 } else { | 228 } else { |
| 229 // Treat as a relative file path. | 229 // Treat as a relative file path. |
| 230 FilePath path = FilePath(args[0]); | 230 base::FilePath path = base::FilePath(args[0]); |
| 231 file_util::AbsolutePath(&path); | 231 file_util::AbsolutePath(&path); |
| 232 starting_url = net::FilePathToFileURL(path); | 232 starting_url = net::FilePathToFileURL(path); |
| 233 } | 233 } |
| 234 } | 234 } |
| 235 | 235 |
| 236 // Get the JavaScript flags. The test runner might send a quoted string which | 236 // Get the JavaScript flags. The test runner might send a quoted string which |
| 237 // needs to be unquoted before further processing. | 237 // needs to be unquoted before further processing. |
| 238 std::string js_flags = | 238 std::string js_flags = |
| 239 parsed_command_line.GetSwitchValueASCII(test_shell::kJavaScriptFlags); | 239 parsed_command_line.GetSwitchValueASCII(test_shell::kJavaScriptFlags); |
| 240 js_flags = net::HttpUtil::Unquote(js_flags); | 240 js_flags = net::HttpUtil::Unquote(js_flags); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 TestShell::ShutdownTestShell(); | 286 TestShell::ShutdownTestShell(); |
| 287 TestShell::CleanupLogging(); | 287 TestShell::CleanupLogging(); |
| 288 | 288 |
| 289 // Tear down shared StatsTable; prevents unit_tests from leaking it. | 289 // Tear down shared StatsTable; prevents unit_tests from leaking it. |
| 290 base::StatsTable::set_current(NULL); | 290 base::StatsTable::set_current(NULL); |
| 291 delete table; | 291 delete table; |
| 292 RemoveSharedMemoryFile(stats_filename); | 292 RemoveSharedMemoryFile(stats_filename); |
| 293 | 293 |
| 294 return 0; | 294 return 0; |
| 295 } | 295 } |
| OLD | NEW |