| 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 "chrome/test/in_process_browser_test.h" | 5 #include "chrome/test/in_process_browser_test.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 | 37 |
| 38 // Sometimes Delete fails, so try a few more times. | 38 // Sometimes Delete fails, so try a few more times. |
| 39 for (int i = 0; i < 10; ++i) { | 39 for (int i = 0; i < 10; ++i) { |
| 40 if (file_util::Delete(file, recurse)) | 40 if (file_util::Delete(file, recurse)) |
| 41 return true; | 41 return true; |
| 42 PlatformThread::Sleep(100); | 42 PlatformThread::Sleep(100); |
| 43 } | 43 } |
| 44 return false; | 44 return false; |
| 45 } | 45 } |
| 46 | 46 |
| 47 class ShadowingAtExitManager : public base::AtExitManager { | |
| 48 public: | |
| 49 ShadowingAtExitManager() : base::AtExitManager(true) {} | |
| 50 virtual ~ShadowingAtExitManager() {} | |
| 51 | |
| 52 private: | |
| 53 DISALLOW_COPY_AND_ASSIGN(ShadowingAtExitManager); | |
| 54 }; | |
| 55 | |
| 56 } // namespace | 47 } // namespace |
| 57 | 48 |
| 58 InProcessBrowserTest::InProcessBrowserTest() | 49 InProcessBrowserTest::InProcessBrowserTest() |
| 59 : browser_(NULL), | 50 : browser_(NULL), |
| 60 show_window_(false), | 51 show_window_(false), |
| 61 dom_automation_enabled_(false), | 52 dom_automation_enabled_(false), |
| 62 single_process_(false), | 53 single_process_(false), |
| 63 original_single_process_(false) { | 54 original_single_process_(false) { |
| 64 } | 55 } |
| 65 | 56 |
| 66 void InProcessBrowserTest::SetUp() { | 57 void InProcessBrowserTest::SetUp() { |
| 67 ShadowingAtExitManager at_exit_manager; | |
| 68 | |
| 69 // Cleanup the user data dir. | 58 // Cleanup the user data dir. |
| 70 std::wstring user_data_dir; | 59 std::wstring user_data_dir; |
| 71 PathService::Get(chrome::DIR_USER_DATA, &user_data_dir); | 60 PathService::Get(chrome::DIR_USER_DATA, &user_data_dir); |
| 72 ASSERT_LT(10, static_cast<int>(user_data_dir.size())) << | 61 ASSERT_LT(10, static_cast<int>(user_data_dir.size())) << |
| 73 "The user data directory name passed into this test was too " | 62 "The user data directory name passed into this test was too " |
| 74 "short to delete safely. Please check the user-data-dir " | 63 "short to delete safely. Please check the user-data-dir " |
| 75 "argument and try again."; | 64 "argument and try again."; |
| 76 ASSERT_TRUE(DieFileDie(user_data_dir, true)); | 65 ASSERT_TRUE(DieFileDie(user_data_dir, true)); |
| 77 | 66 |
| 78 // The unit test suite creates a testingbrowser, but we want the real thing. | 67 // The unit test suite creates a testingbrowser, but we want the real thing. |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 MessageLoopForUI::current()->Quit(); | 210 MessageLoopForUI::current()->Quit(); |
| 222 } | 211 } |
| 223 | 212 |
| 224 void InProcessBrowserTest::ConfigureHostMapper( | 213 void InProcessBrowserTest::ConfigureHostMapper( |
| 225 net::RuleBasedHostMapper* host_mapper) { | 214 net::RuleBasedHostMapper* host_mapper) { |
| 226 host_mapper->AllowDirectLookup("*.google.com"); | 215 host_mapper->AllowDirectLookup("*.google.com"); |
| 227 // See http://en.wikipedia.org/wiki/Web_Proxy_Autodiscovery_Protocol | 216 // See http://en.wikipedia.org/wiki/Web_Proxy_Autodiscovery_Protocol |
| 228 // We don't want the test code to use it. | 217 // We don't want the test code to use it. |
| 229 host_mapper->AddSimulatedFailure("wpad"); | 218 host_mapper->AddSimulatedFailure("wpad"); |
| 230 } | 219 } |
| OLD | NEW |