| 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/browser/ui/tab_modal_confirm_dialog_browsertest.h" | 5 #include "chrome/browser/ui/tab_modal_confirm_dialog_browsertest.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
| 9 #include "chrome/browser/lifetime/application_lifetime.h" | 9 #include "chrome/browser/lifetime/application_lifetime.h" |
| 10 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 | 36 |
| 37 TabModalConfirmDialogTest::TabModalConfirmDialogTest() | 37 TabModalConfirmDialogTest::TabModalConfirmDialogTest() |
| 38 : delegate_(NULL), | 38 : delegate_(NULL), |
| 39 dialog_(NULL) {} | 39 dialog_(NULL) {} |
| 40 | 40 |
| 41 void TabModalConfirmDialogTest::SetUpOnMainThread() { | 41 void TabModalConfirmDialogTest::SetUpOnMainThread() { |
| 42 delegate_ = new MockTabModalConfirmDialogDelegate( | 42 delegate_ = new MockTabModalConfirmDialogDelegate( |
| 43 chrome::GetActiveWebContents(browser())); | 43 chrome::GetActiveWebContents(browser())); |
| 44 dialog_ = CreateTestDialog(delegate_, | 44 dialog_ = CreateTestDialog(delegate_, |
| 45 chrome::GetActiveTabContents(browser())); | 45 chrome::GetActiveTabContents(browser())); |
| 46 ui_test_utils::RunAllPendingInMessageLoop(); | 46 content::RunAllPendingInMessageLoop(); |
| 47 } | 47 } |
| 48 | 48 |
| 49 void TabModalConfirmDialogTest::CleanUpOnMainThread() { | 49 void TabModalConfirmDialogTest::CleanUpOnMainThread() { |
| 50 ui_test_utils::RunAllPendingInMessageLoop(); | 50 content::RunAllPendingInMessageLoop(); |
| 51 ::testing::Mock::VerifyAndClearExpectations(delegate_); | 51 ::testing::Mock::VerifyAndClearExpectations(delegate_); |
| 52 } | 52 } |
| 53 | 53 |
| 54 // On Mac OS, these methods need to be compiled as Objective-C++, so they're in | 54 // On Mac OS, these methods need to be compiled as Objective-C++, so they're in |
| 55 // a separate file. | 55 // a separate file. |
| 56 #if !defined(OS_MACOSX) | 56 #if !defined(OS_MACOSX) |
| 57 TabModalConfirmDialog* TabModalConfirmDialogTest::CreateTestDialog( | 57 TabModalConfirmDialog* TabModalConfirmDialogTest::CreateTestDialog( |
| 58 TabModalConfirmDialogDelegate* delegate, TabContents* tab_contents) { | 58 TabModalConfirmDialogDelegate* delegate, TabContents* tab_contents) { |
| 59 return new TabModalConfirmDialog(delegate, tab_contents); | 59 return new TabModalConfirmDialog(delegate, tab_contents); |
| 60 } | 60 } |
| (...skipping 27 matching lines...) Expand all Loading... |
| 88 EXPECT_CALL(*delegate_, OnCanceled()); | 88 EXPECT_CALL(*delegate_, OnCanceled()); |
| 89 delegate_->Cancel(); | 89 delegate_->Cancel(); |
| 90 } | 90 } |
| 91 | 91 |
| 92 IN_PROC_BROWSER_TEST_F(TabModalConfirmDialogTest, Quit) { | 92 IN_PROC_BROWSER_TEST_F(TabModalConfirmDialogTest, Quit) { |
| 93 EXPECT_CALL(*delegate_, OnCanceled()); | 93 EXPECT_CALL(*delegate_, OnCanceled()); |
| 94 MessageLoopForUI::current()->PostTask(FROM_HERE, | 94 MessageLoopForUI::current()->PostTask(FROM_HERE, |
| 95 base::Bind(&browser::AttemptExit)); | 95 base::Bind(&browser::AttemptExit)); |
| 96 content::RunMessageLoop(); | 96 content::RunMessageLoop(); |
| 97 } | 97 } |
| OLD | NEW |