| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/auto_reset.h" | 7 #include "base/auto_reset.h" |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 425 #endif | 425 #endif |
| 426 | 426 |
| 427 if (!HasFatalFailure()) | 427 if (!HasFatalFailure()) |
| 428 RunTestOnMainThread(); | 428 RunTestOnMainThread(); |
| 429 #if defined(OS_MACOSX) | 429 #if defined(OS_MACOSX) |
| 430 autorelease_pool_->Recycle(); | 430 autorelease_pool_->Recycle(); |
| 431 #endif | 431 #endif |
| 432 | 432 |
| 433 // Invoke cleanup and quit even if there are failures. This is similar to | 433 // Invoke cleanup and quit even if there are failures. This is similar to |
| 434 // gtest in that it invokes TearDown even if Setup fails. | 434 // gtest in that it invokes TearDown even if Setup fails. |
| 435 CleanUpOnMainThread(); | 435 TearDownOnMainThread(); |
| 436 #if defined(OS_MACOSX) | 436 #if defined(OS_MACOSX) |
| 437 autorelease_pool_->Recycle(); | 437 autorelease_pool_->Recycle(); |
| 438 #endif | 438 #endif |
| 439 | 439 |
| 440 // Sometimes tests leave Quit tasks in the MessageLoop (for shame), so let's | 440 // Sometimes tests leave Quit tasks in the MessageLoop (for shame), so let's |
| 441 // run all pending messages here to avoid preempting the QuitBrowsers tasks. | 441 // run all pending messages here to avoid preempting the QuitBrowsers tasks. |
| 442 // TODO(jbates) Once crbug.com/134753 is fixed, this can be removed because it | 442 // TODO(jbates) Once crbug.com/134753 is fixed, this can be removed because it |
| 443 // will not be possible to post Quit tasks. | 443 // will not be possible to post Quit tasks. |
| 444 content::RunAllPendingInMessageLoop(); | 444 content::RunAllPendingInMessageLoop(); |
| 445 | 445 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 473 // On the Mac, this eventually reaches | 473 // On the Mac, this eventually reaches |
| 474 // -[BrowserWindowController windowWillClose:], which will post a deferred | 474 // -[BrowserWindowController windowWillClose:], which will post a deferred |
| 475 // -autorelease on itself to ultimately destroy the Browser object. The line | 475 // -autorelease on itself to ultimately destroy the Browser object. The line |
| 476 // below is necessary to pump these pending messages to ensure all Browsers | 476 // below is necessary to pump these pending messages to ensure all Browsers |
| 477 // get deleted. | 477 // get deleted. |
| 478 content::RunAllPendingInMessageLoop(); | 478 content::RunAllPendingInMessageLoop(); |
| 479 delete autorelease_pool_; | 479 delete autorelease_pool_; |
| 480 autorelease_pool_ = NULL; | 480 autorelease_pool_ = NULL; |
| 481 #endif | 481 #endif |
| 482 } | 482 } |
| OLD | NEW |