| 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/debug/stack_trace.h" | 8 #include "base/debug/stack_trace.h" |
| 9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 } | 88 } |
| 89 | 89 |
| 90 InProcessBrowserTest::~InProcessBrowserTest() { | 90 InProcessBrowserTest::~InProcessBrowserTest() { |
| 91 } | 91 } |
| 92 | 92 |
| 93 void InProcessBrowserTest::SetUp() { | 93 void InProcessBrowserTest::SetUp() { |
| 94 // Create a temporary user data directory if required. | 94 // Create a temporary user data directory if required. |
| 95 ASSERT_TRUE(CreateUserDataDirectory()) | 95 ASSERT_TRUE(CreateUserDataDirectory()) |
| 96 << "Could not create user data directory."; | 96 << "Could not create user data directory."; |
| 97 | 97 |
| 98 DCHECK(!g_browser_process); | 98 // Undo TestingBrowserProcess creation in ChromeTestSuite. |
| 99 // TODO(phajdan.jr): Extract a smaller test suite so we don't need this. |
| 100 DCHECK(g_browser_process); |
| 101 delete g_browser_process; |
| 102 g_browser_process = NULL; |
| 99 | 103 |
| 100 // Allow subclasses the opportunity to make changes to the default user data | 104 // Allow subclasses the opportunity to make changes to the default user data |
| 101 // dir before running any tests. | 105 // dir before running any tests. |
| 102 ASSERT_TRUE(SetUpUserDataDirectory()) | 106 ASSERT_TRUE(SetUpUserDataDirectory()) |
| 103 << "Could not set up user data directory."; | 107 << "Could not set up user data directory."; |
| 104 | 108 |
| 105 // Don't delete the resources when BrowserMain returns. Many ui classes | 109 // Don't delete the resources when BrowserMain returns. Many ui classes |
| 106 // cache SkBitmaps in a static field so that if we delete the resource | 110 // cache SkBitmaps in a static field so that if we delete the resource |
| 107 // bundle we'll crash. | 111 // bundle we'll crash. |
| 108 browser_shutdown::delete_resources_on_shutdown = false; | 112 browser_shutdown::delete_resources_on_shutdown = false; |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 348 return; | 352 return; |
| 349 | 353 |
| 350 // Invoke CloseAllBrowsersAndMayExit on a running message loop. | 354 // Invoke CloseAllBrowsersAndMayExit on a running message loop. |
| 351 // CloseAllBrowsersAndMayExit exits the message loop after everything has been | 355 // CloseAllBrowsersAndMayExit exits the message loop after everything has been |
| 352 // shut down properly. | 356 // shut down properly. |
| 353 MessageLoopForUI::current()->PostTask( | 357 MessageLoopForUI::current()->PostTask( |
| 354 FROM_HERE, | 358 FROM_HERE, |
| 355 NewRunnableFunction(&BrowserList::AttemptExit)); | 359 NewRunnableFunction(&BrowserList::AttemptExit)); |
| 356 ui_test_utils::RunMessageLoop(); | 360 ui_test_utils::RunMessageLoop(); |
| 357 } | 361 } |
| OLD | NEW |