| 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_path.h" | 6 #include "base/file_path.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 14 matching lines...) Expand all Loading... |
| 25 // can be printed upon termination. This is only enabled in debug builds, so | 25 // can be printed upon termination. This is only enabled in debug builds, so |
| 26 // it only makes sense to run this using a debug build. | 26 // it only makes sense to run this using a debug build. |
| 27 // | 27 // |
| 28 // It will load a URL, visit about:blank, and then perform garbage collection. | 28 // It will load a URL, visit about:blank, and then perform garbage collection. |
| 29 // The number of remaining (potentially leaked) nodes will be printed on exit. | 29 // The number of remaining (potentially leaked) nodes will be printed on exit. |
| 30 class NodeLeakTest : public TestShellTest { | 30 class NodeLeakTest : public TestShellTest { |
| 31 public: | 31 public: |
| 32 virtual void SetUp() { | 32 virtual void SetUp() { |
| 33 const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess(); | 33 const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess(); |
| 34 | 34 |
| 35 FilePath cache_path = FilePath::FromWStringHack( | 35 FilePath cache_path = |
| 36 parsed_command_line.GetSwitchValue(test_shell::kCacheDir)); | 36 parsed_command_line.GetSwitchValuePath(test_shell::kCacheDir); |
| 37 if (cache_path.empty()) { | 37 if (cache_path.empty()) { |
| 38 PathService::Get(base::DIR_EXE, &cache_path); | 38 PathService::Get(base::DIR_EXE, &cache_path); |
| 39 cache_path = cache_path.AppendASCII("cache"); | 39 cache_path = cache_path.AppendASCII("cache"); |
| 40 } | 40 } |
| 41 | 41 |
| 42 if (parsed_command_line.HasSwitch(test_shell::kTestShellTimeOut)) { | 42 if (parsed_command_line.HasSwitch(test_shell::kTestShellTimeOut)) { |
| 43 const std::wstring timeout_str = parsed_command_line.GetSwitchValue( | 43 const std::wstring timeout_str = parsed_command_line.GetSwitchValue( |
| 44 test_shell::kTestShellTimeOut); | 44 test_shell::kTestShellTimeOut); |
| 45 int timeout_ms = | 45 int timeout_ms = |
| 46 static_cast<int>(StringToInt64(WideToUTF16Hack(timeout_str.c_str()))); | 46 static_cast<int>(StringToInt64(WideToUTF16Hack(timeout_str.c_str()))); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 68 test_shell_->LoadURL(GURL(WideToUTF8(test_url))); | 68 test_shell_->LoadURL(GURL(WideToUTF8(test_url))); |
| 69 test_shell_->WaitTestFinished(); | 69 test_shell_->WaitTestFinished(); |
| 70 | 70 |
| 71 // Depends on TestShellTests::TearDown to load blank page and | 71 // Depends on TestShellTests::TearDown to load blank page and |
| 72 // the TestShell destructor to call garbage collection. | 72 // the TestShell destructor to call garbage collection. |
| 73 } | 73 } |
| 74 }; | 74 }; |
| 75 | 75 |
| 76 TEST_F(NodeLeakTest, TestURL) { | 76 TEST_F(NodeLeakTest, TestURL) { |
| 77 const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess(); | 77 const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess(); |
| 78 if (parsed_command_line.HasSwitch(kTestUrlSwitch)) { | 78 if (parsed_command_line.HasSwitch(kTestUrlSwitch)) |
| 79 NavigateToURL(parsed_command_line.GetSwitchValue(kTestUrlSwitch).c_str()); | 79 NavigateToURL(parsed_command_line.GetSwitchValue(kTestUrlSwitch).c_str()); |
| 80 } | |
| 81 } | 80 } |
| 82 | 81 |
| 83 } // namespace | 82 } // namespace |
| OLD | NEW |