| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/base/in_process_browser_test.h" | 5 #include "chrome/test/base/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/mac/scoped_nsautorelease_pool.h" | 10 #include "base/mac/scoped_nsautorelease_pool.h" |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 } | 87 } |
| 88 | 88 |
| 89 InProcessBrowserTest::~InProcessBrowserTest() { | 89 InProcessBrowserTest::~InProcessBrowserTest() { |
| 90 } | 90 } |
| 91 | 91 |
| 92 void InProcessBrowserTest::SetUp() { | 92 void InProcessBrowserTest::SetUp() { |
| 93 // Create a temporary user data directory if required. | 93 // Create a temporary user data directory if required. |
| 94 ASSERT_TRUE(CreateUserDataDirectory()) | 94 ASSERT_TRUE(CreateUserDataDirectory()) |
| 95 << "Could not create user data directory."; | 95 << "Could not create user data directory."; |
| 96 | 96 |
| 97 #if defined(OS_WIN) | 97 #if defined(OS_WIN) || defined(OS_LINUX) |
| 98 // This is not really Windows-specific, the transition is just being done | 98 // This is not really Windows-specific, the transition is just being done |
| 99 // in stages, and Windows is first. See below for more info. | 99 // in stages, and Windows is first. See below for more info. |
| 100 DCHECK(!g_browser_process); | 100 DCHECK(!g_browser_process); |
| 101 #else | 101 #else |
| 102 // TODO(phajdan.jr): Temporary, for http://crbug.com/61062. | 102 // TODO(phajdan.jr): Temporary, for http://crbug.com/61062. |
| 103 // The unit test suite creates a testingbrowser, but we want the real thing. | 103 // The unit test suite creates a testingbrowser, but we want the real thing. |
| 104 // Delete the current one. We'll install the testing one in TearDown. | 104 // Delete the current one. We'll install the testing one in TearDown. |
| 105 delete g_browser_process; | 105 delete g_browser_process; |
| 106 g_browser_process = NULL; | 106 g_browser_process = NULL; |
| 107 #endif | 107 #endif |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 } else { | 218 } else { |
| 219 LOG(ERROR) << "Could not create temporary user data directory \"" | 219 LOG(ERROR) << "Could not create temporary user data directory \"" |
| 220 << temp_user_data_dir_.path().value() << "\"."; | 220 << temp_user_data_dir_.path().value() << "\"."; |
| 221 return false; | 221 return false; |
| 222 } | 222 } |
| 223 } | 223 } |
| 224 return test_launcher_utils::OverrideUserDataDir(user_data_dir); | 224 return test_launcher_utils::OverrideUserDataDir(user_data_dir); |
| 225 } | 225 } |
| 226 | 226 |
| 227 void InProcessBrowserTest::TearDown() { | 227 void InProcessBrowserTest::TearDown() { |
| 228 #if defined(OS_WIN) | 228 #if defined(OS_WIN) || defined(OS_LINUX) |
| 229 // This is not really Windows-specific, the transition is just being done | 229 // This is not really Windows-specific, the transition is just being done |
| 230 // in stages, and Windows is first. See below for more info. | 230 // in stages, and Windows is first. See below for more info. |
| 231 DCHECK(!g_browser_process); | 231 DCHECK(!g_browser_process); |
| 232 #else | 232 #else |
| 233 // TODO(phajdan.jr): Temporary, for http://crbug.com/61062. | 233 // TODO(phajdan.jr): Temporary, for http://crbug.com/61062. |
| 234 // Reinstall testing browser process. | 234 // Reinstall testing browser process. |
| 235 delete g_browser_process; | 235 delete g_browser_process; |
| 236 g_browser_process = new TestingBrowserProcess(); | 236 g_browser_process = new TestingBrowserProcess(); |
| 237 #endif | 237 #endif |
| 238 | 238 |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 359 return; | 359 return; |
| 360 | 360 |
| 361 // Invoke CloseAllBrowsersAndMayExit on a running message loop. | 361 // Invoke CloseAllBrowsersAndMayExit on a running message loop. |
| 362 // CloseAllBrowsersAndMayExit exits the message loop after everything has been | 362 // CloseAllBrowsersAndMayExit exits the message loop after everything has been |
| 363 // shut down properly. | 363 // shut down properly. |
| 364 MessageLoopForUI::current()->PostTask( | 364 MessageLoopForUI::current()->PostTask( |
| 365 FROM_HERE, | 365 FROM_HERE, |
| 366 NewRunnableFunction(&BrowserList::AttemptExit)); | 366 NewRunnableFunction(&BrowserList::AttemptExit)); |
| 367 ui_test_utils::RunMessageLoop(); | 367 ui_test_utils::RunMessageLoop(); |
| 368 } | 368 } |
| OLD | NEW |