| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "base/file_util.h" | 6 #include "base/file_util.h" |
| 7 #include "base/path_service.h" | 7 #include "base/path_service.h" |
| 8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
| 9 #include "net/http/http_cache.h" | 9 #include "net/http/http_cache.h" |
| 10 #include "net/url_request/url_request_context.h" | 10 #include "net/url_request/url_request_context.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 std::wstring cache_path = | 42 std::wstring cache_path = |
| 43 parsed_command_line.GetSwitchValue(test_shell::kCacheDir); | 43 parsed_command_line.GetSwitchValue(test_shell::kCacheDir); |
| 44 if (cache_path.empty()) { | 44 if (cache_path.empty()) { |
| 45 PathService::Get(base::DIR_EXE, &cache_path); | 45 PathService::Get(base::DIR_EXE, &cache_path); |
| 46 file_util::AppendToPath(&cache_path, L"cache"); | 46 file_util::AppendToPath(&cache_path, L"cache"); |
| 47 } | 47 } |
| 48 | 48 |
| 49 if (parsed_command_line.HasSwitch(test_shell::kTestShellTimeOut)) { | 49 if (parsed_command_line.HasSwitch(test_shell::kTestShellTimeOut)) { |
| 50 const std::wstring timeout_str = parsed_command_line.GetSwitchValue( | 50 const std::wstring timeout_str = parsed_command_line.GetSwitchValue( |
| 51 test_shell::kTestShellTimeOut); | 51 test_shell::kTestShellTimeOut); |
| 52 int timeout_ms = static_cast<int>(StringToInt64(timeout_str.c_str())); | 52 int timeout_ms = |
| 53 static_cast<int>(StringToInt64(WideToUTF16Hack(timeout_str.c_str()))); |
| 53 if (timeout_ms > 0) | 54 if (timeout_ms > 0) |
| 54 TestShell::SetFileTestTimeout(timeout_ms); | 55 TestShell::SetFileTestTimeout(timeout_ms); |
| 55 } | 56 } |
| 56 | 57 |
| 57 // Optionally use playback mode (for instance if running automated tests). | 58 // Optionally use playback mode (for instance if running automated tests). |
| 58 net::HttpCache::Mode mode = | 59 net::HttpCache::Mode mode = |
| 59 parsed_command_line.HasSwitch(test_shell::kPlaybackMode) ? | 60 parsed_command_line.HasSwitch(test_shell::kPlaybackMode) ? |
| 60 net::HttpCache::PLAYBACK : net::HttpCache::NORMAL; | 61 net::HttpCache::PLAYBACK : net::HttpCache::NORMAL; |
| 61 SimpleResourceLoaderBridge::Init( | 62 SimpleResourceLoaderBridge::Init( |
| 62 new TestShellRequestContext(cache_path, mode, false)); | 63 new TestShellRequestContext(cache_path, mode, false)); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 80 }; | 81 }; |
| 81 | 82 |
| 82 TEST_F(NodeLeakTest, TestURL) { | 83 TEST_F(NodeLeakTest, TestURL) { |
| 83 const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess(); | 84 const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess(); |
| 84 if (parsed_command_line.HasSwitch(kTestUrlSwitch)) { | 85 if (parsed_command_line.HasSwitch(kTestUrlSwitch)) { |
| 85 NavigateToURL(parsed_command_line.GetSwitchValue(kTestUrlSwitch).c_str()); | 86 NavigateToURL(parsed_command_line.GetSwitchValue(kTestUrlSwitch).c_str()); |
| 86 } | 87 } |
| 87 } | 88 } |
| 88 | 89 |
| 89 } // namespace | 90 } // namespace |
| OLD | NEW |