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/strings/utf_string_conversions.h" | 8 #include "base/strings/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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 } | 58 } |
59 | 59 |
60 void TabModalConfirmDialogTest::SetUpOnMainThread() { | 60 void TabModalConfirmDialogTest::SetUpOnMainThread() { |
61 delegate_ = new MockTabModalConfirmDialogDelegate( | 61 delegate_ = new MockTabModalConfirmDialogDelegate( |
62 browser()->tab_strip_model()->GetActiveWebContents(), this); | 62 browser()->tab_strip_model()->GetActiveWebContents(), this); |
63 dialog_ = TabModalConfirmDialog::Create( | 63 dialog_ = TabModalConfirmDialog::Create( |
64 delegate_, browser()->tab_strip_model()->GetActiveWebContents()); | 64 delegate_, browser()->tab_strip_model()->GetActiveWebContents()); |
65 content::RunAllPendingInMessageLoop(); | 65 content::RunAllPendingInMessageLoop(); |
66 } | 66 } |
67 | 67 |
68 void TabModalConfirmDialogTest::CleanUpOnMainThread() { | 68 void TabModalConfirmDialogTest::TearDownOnMainThread() { |
69 content::RunAllPendingInMessageLoop(); | 69 content::RunAllPendingInMessageLoop(); |
70 } | 70 } |
71 | 71 |
72 void TabModalConfirmDialogTest::OnAccepted() { | 72 void TabModalConfirmDialogTest::OnAccepted() { |
73 ++accepted_count_; | 73 ++accepted_count_; |
74 } | 74 } |
75 | 75 |
76 void TabModalConfirmDialogTest::OnCanceled() { | 76 void TabModalConfirmDialogTest::OnCanceled() { |
77 ++canceled_count_; | 77 ++canceled_count_; |
78 } | 78 } |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 } | 130 } |
131 | 131 |
132 IN_PROC_BROWSER_TEST_F(TabModalConfirmDialogTest, Quit) { | 132 IN_PROC_BROWSER_TEST_F(TabModalConfirmDialogTest, Quit) { |
133 base::MessageLoopForUI::current()->PostTask(FROM_HERE, | 133 base::MessageLoopForUI::current()->PostTask(FROM_HERE, |
134 base::Bind(&chrome::AttemptExit)); | 134 base::Bind(&chrome::AttemptExit)); |
135 content::RunMessageLoop(); | 135 content::RunMessageLoop(); |
136 EXPECT_EQ(0, accepted_count_); | 136 EXPECT_EQ(0, accepted_count_); |
137 EXPECT_EQ(0, canceled_count_); | 137 EXPECT_EQ(0, canceled_count_); |
138 EXPECT_EQ(1, closed_count_); | 138 EXPECT_EQ(1, closed_count_); |
139 } | 139 } |
OLD | NEW |