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 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
411 // browser shutdown). To avoid this, the following pool is recycled after each | 411 // browser shutdown). To avoid this, the following pool is recycled after each |
412 // time code is directly executed. | 412 // time code is directly executed. |
413 autorelease_pool_ = new base::mac::ScopedNSAutoreleasePool; | 413 autorelease_pool_ = new base::mac::ScopedNSAutoreleasePool; |
414 #endif | 414 #endif |
415 | 415 |
416 // Pump any pending events that were created as a result of creating a | 416 // Pump any pending events that were created as a result of creating a |
417 // browser. | 417 // browser. |
418 content::RunAllPendingInMessageLoop(); | 418 content::RunAllPendingInMessageLoop(); |
419 | 419 |
420 SetUpOnMainThread(); | 420 SetUpOnMainThread(); |
| 421 LOG(ERROR) << "InProcessBrowserTest has set up on main thread."; |
421 #if defined(OS_MACOSX) | 422 #if defined(OS_MACOSX) |
422 autorelease_pool_->Recycle(); | 423 autorelease_pool_->Recycle(); |
423 #endif | 424 #endif |
424 | 425 |
425 if (!HasFatalFailure()) | 426 if (!HasFatalFailure()) { |
| 427 LOG(ERROR) << "InProcessBrowserTest is running test on main thread."; |
426 RunTestOnMainThread(); | 428 RunTestOnMainThread(); |
| 429 } |
427 #if defined(OS_MACOSX) | 430 #if defined(OS_MACOSX) |
428 autorelease_pool_->Recycle(); | 431 autorelease_pool_->Recycle(); |
429 #endif | 432 #endif |
430 | 433 |
| 434 LOG(ERROR) << "InProcessBrowserTest is invoking cleanup.."; |
431 // Invoke cleanup and quit even if there are failures. This is similar to | 435 // Invoke cleanup and quit even if there are failures. This is similar to |
432 // gtest in that it invokes TearDown even if Setup fails. | 436 // gtest in that it invokes TearDown even if Setup fails. |
433 CleanUpOnMainThread(); | 437 CleanUpOnMainThread(); |
434 #if defined(OS_MACOSX) | 438 #if defined(OS_MACOSX) |
435 autorelease_pool_->Recycle(); | 439 autorelease_pool_->Recycle(); |
436 #endif | 440 #endif |
437 | 441 |
438 // Sometimes tests leave Quit tasks in the MessageLoop (for shame), so let's | 442 // Sometimes tests leave Quit tasks in the MessageLoop (for shame), so let's |
439 // run all pending messages here to avoid preempting the QuitBrowsers tasks. | 443 // run all pending messages here to avoid preempting the QuitBrowsers tasks. |
440 // TODO(jbates) Once crbug.com/134753 is fixed, this can be removed because it | 444 // TODO(jbates) Once crbug.com/134753 is fixed, this can be removed because it |
(...skipping 30 matching lines...) Expand all Loading... |
471 // On the Mac, this eventually reaches | 475 // On the Mac, this eventually reaches |
472 // -[BrowserWindowController windowWillClose:], which will post a deferred | 476 // -[BrowserWindowController windowWillClose:], which will post a deferred |
473 // -autorelease on itself to ultimately destroy the Browser object. The line | 477 // -autorelease on itself to ultimately destroy the Browser object. The line |
474 // below is necessary to pump these pending messages to ensure all Browsers | 478 // below is necessary to pump these pending messages to ensure all Browsers |
475 // get deleted. | 479 // get deleted. |
476 content::RunAllPendingInMessageLoop(); | 480 content::RunAllPendingInMessageLoop(); |
477 delete autorelease_pool_; | 481 delete autorelease_pool_; |
478 autorelease_pool_ = NULL; | 482 autorelease_pool_ = NULL; |
479 #endif | 483 #endif |
480 } | 484 } |
OLD | NEW |