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