| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/mac/scoped_nsautorelease_pool.h" |
| 10 #include "base/path_service.h" | 11 #include "base/path_service.h" |
| 11 #include "base/scoped_nsautorelease_pool.h" | |
| 12 #include "base/string_number_conversions.h" | 12 #include "base/string_number_conversions.h" |
| 13 #include "base/test/test_file_util.h" | 13 #include "base/test/test_file_util.h" |
| 14 #include "chrome/browser/browser.h" | 14 #include "chrome/browser/browser.h" |
| 15 #include "chrome/browser/browser_list.h" | 15 #include "chrome/browser/browser_list.h" |
| 16 #include "chrome/browser/browser_process.h" | 16 #include "chrome/browser/browser_process.h" |
| 17 #include "chrome/browser/browser_shutdown.h" | 17 #include "chrome/browser/browser_shutdown.h" |
| 18 #include "chrome/browser/browser_thread.h" | 18 #include "chrome/browser/browser_thread.h" |
| 19 #include "chrome/browser/browser_window.h" | 19 #include "chrome/browser/browser_window.h" |
| 20 #include "chrome/browser/intranet_redirect_detector.h" | 20 #include "chrome/browser/intranet_redirect_detector.h" |
| 21 #include "chrome/browser/io_thread.h" | 21 #include "chrome/browser/io_thread.h" |
| (...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 signal(SIGTERM, SIG_DFL); | 291 signal(SIGTERM, SIG_DFL); |
| 292 #endif // defined(OS_POSIX) | 292 #endif // defined(OS_POSIX) |
| 293 | 293 |
| 294 // On Mac, without the following autorelease pool, code which is directly | 294 // On Mac, without the following autorelease pool, code which is directly |
| 295 // executed (as opposed to executed inside a message loop) would autorelease | 295 // executed (as opposed to executed inside a message loop) would autorelease |
| 296 // objects into a higher-level pool. This pool is not recycled in-sync with | 296 // objects into a higher-level pool. This pool is not recycled in-sync with |
| 297 // the message loops' pools and causes problems with code relying on | 297 // the message loops' pools and causes problems with code relying on |
| 298 // deallocation via an autorelease pool (such as browser window closure and | 298 // deallocation via an autorelease pool (such as browser window closure and |
| 299 // browser shutdown). To avoid this, the following pool is recycled after each | 299 // browser shutdown). To avoid this, the following pool is recycled after each |
| 300 // time code is directly executed. | 300 // time code is directly executed. |
| 301 base::ScopedNSAutoreleasePool pool; | 301 base::mac::ScopedNSAutoreleasePool pool; |
| 302 | 302 |
| 303 // Pump startup related events. | 303 // Pump startup related events. |
| 304 MessageLoopForUI::current()->RunAllPending(); | 304 MessageLoopForUI::current()->RunAllPending(); |
| 305 | 305 |
| 306 // In the long term it would be great if we could use a TestingProfile | 306 // In the long term it would be great if we could use a TestingProfile |
| 307 // here and only enable services you want tested, but that requires all | 307 // here and only enable services you want tested, but that requires all |
| 308 // consumers of Profile to handle NULL services. | 308 // consumers of Profile to handle NULL services. |
| 309 Profile* profile = ProfileManager::GetDefaultProfile(); | 309 Profile* profile = ProfileManager::GetDefaultProfile(); |
| 310 if (!profile) { | 310 if (!profile) { |
| 311 // We should only be able to get here if the profile already exists and | 311 // We should only be able to get here if the profile already exists and |
| (...skipping 29 matching lines...) Expand all Loading... |
| 341 return; | 341 return; |
| 342 | 342 |
| 343 // Invoke CloseAllBrowsersAndExit on a running message loop. | 343 // Invoke CloseAllBrowsersAndExit on a running message loop. |
| 344 // CloseAllBrowsersAndExit exits the message loop after everything has been | 344 // CloseAllBrowsersAndExit exits the message loop after everything has been |
| 345 // shut down properly. | 345 // shut down properly. |
| 346 MessageLoopForUI::current()->PostTask( | 346 MessageLoopForUI::current()->PostTask( |
| 347 FROM_HERE, | 347 FROM_HERE, |
| 348 NewRunnableFunction(&BrowserList::CloseAllBrowsersAndExit)); | 348 NewRunnableFunction(&BrowserList::CloseAllBrowsersAndExit)); |
| 349 ui_test_utils::RunMessageLoop(); | 349 ui_test_utils::RunMessageLoop(); |
| 350 } | 350 } |
| OLD | NEW |