| 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/ui/browser_dialogs.h" | 9 #include "chrome/browser/ui/browser_dialogs.h" |
| 10 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 } | 59 } |
| 60 | 60 |
| 61 void TabModalConfirmDialogTest::CloseDialog(bool accept) { | 61 void TabModalConfirmDialogTest::CloseDialog(bool accept) { |
| 62 #if defined(TOOLKIT_GTK) | 62 #if defined(TOOLKIT_GTK) |
| 63 if (accept) | 63 if (accept) |
| 64 dialog_->OnAccept(NULL); | 64 dialog_->OnAccept(NULL); |
| 65 else | 65 else |
| 66 dialog_->OnCancel(NULL); | 66 dialog_->OnCancel(NULL); |
| 67 #elif defined(OS_CHROMEOS) && !defined(USE_AURA) | 67 #elif defined(OS_CHROMEOS) && !defined(USE_AURA) |
| 68 // |dialog_| deletes itself in |OnDialogClosed()|, so we need to save its | 68 // |dialog_| deletes itself in |OnDialogClosed()|, so we need to save its |
| 69 // ConstrainedHTMLUIDelegate before that. | 69 // ConstrainedWebDialogDelegate before that. |
| 70 ConstrainedHtmlUIDelegate* constrained_html_ui_delegate = | 70 ConstrainedWebDialogDelegate* constrained_delegate = |
| 71 dialog_->constrained_html_ui_delegate(); | 71 dialog_->constrained_delegate(); |
| 72 dialog_->OnDialogClosed(accept ? "true" : "false"); | 72 dialog_->OnDialogClosed(accept ? "true" : "false"); |
| 73 constrained_html_ui_delegate->OnDialogCloseFromWebUI(); | 73 constrained_delegate->OnDialogCloseFromWebUI(); |
| 74 #else | 74 #else |
| 75 if (accept) | 75 if (accept) |
| 76 dialog_->GetDialogClientView()->AcceptWindow(); | 76 dialog_->GetDialogClientView()->AcceptWindow(); |
| 77 else | 77 else |
| 78 dialog_->GetDialogClientView()->CancelWindow(); | 78 dialog_->GetDialogClientView()->CancelWindow(); |
| 79 #endif | 79 #endif |
| 80 } | 80 } |
| 81 #endif // !defined(OS_MACOSX) | 81 #endif // !defined(OS_MACOSX) |
| 82 | 82 |
| 83 IN_PROC_BROWSER_TEST_F(TabModalConfirmDialogTest, Accept) { | 83 IN_PROC_BROWSER_TEST_F(TabModalConfirmDialogTest, Accept) { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 94 EXPECT_CALL(*delegate_, OnCanceled()); | 94 EXPECT_CALL(*delegate_, OnCanceled()); |
| 95 delegate_->Cancel(); | 95 delegate_->Cancel(); |
| 96 } | 96 } |
| 97 | 97 |
| 98 IN_PROC_BROWSER_TEST_F(TabModalConfirmDialogTest, Quit) { | 98 IN_PROC_BROWSER_TEST_F(TabModalConfirmDialogTest, Quit) { |
| 99 EXPECT_CALL(*delegate_, OnCanceled()); | 99 EXPECT_CALL(*delegate_, OnCanceled()); |
| 100 MessageLoopForUI::current()->PostTask(FROM_HERE, | 100 MessageLoopForUI::current()->PostTask(FROM_HERE, |
| 101 base::Bind(&BrowserList::AttemptExit)); | 101 base::Bind(&BrowserList::AttemptExit)); |
| 102 ui_test_utils::RunMessageLoop(); | 102 ui_test_utils::RunMessageLoop(); |
| 103 } | 103 } |
| OLD | NEW |