| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/views/sync/one_click_signin_bubble_view.h" | 5 #include "chrome/browser/ui/views/sync/one_click_signin_bubble_view.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "chrome/browser/ui/sync/one_click_signin_bubble_delegate.h" | 10 #include "chrome/browser/ui/sync/one_click_signin_bubble_delegate.h" |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 } | 132 } |
| 133 | 133 |
| 134 TEST_F(OneClickSigninBubbleViewTest, HideDialog) { | 134 TEST_F(OneClickSigninBubbleViewTest, HideDialog) { |
| 135 ShowOneClickSigninBubble( | 135 ShowOneClickSigninBubble( |
| 136 BrowserWindow::ONE_CLICK_SIGNIN_BUBBLE_TYPE_MODAL_DIALOG); | 136 BrowserWindow::ONE_CLICK_SIGNIN_BUBBLE_TYPE_MODAL_DIALOG); |
| 137 | 137 |
| 138 OneClickSigninBubbleView::Hide(); | 138 OneClickSigninBubbleView::Hide(); |
| 139 content::RunAllPendingInMessageLoop(); | 139 content::RunAllPendingInMessageLoop(); |
| 140 EXPECT_FALSE(OneClickSigninBubbleView::IsShowing()); | 140 EXPECT_FALSE(OneClickSigninBubbleView::IsShowing()); |
| 141 EXPECT_TRUE(on_start_sync_called_); | 141 EXPECT_TRUE(on_start_sync_called_); |
| 142 EXPECT_EQ(OneClickSigninSyncStarter::SYNC_WITH_DEFAULT_SETTINGS, mode_); | 142 EXPECT_EQ(OneClickSigninSyncStarter::UNDO_SYNC, mode_); |
| 143 } | 143 } |
| 144 | 144 |
| 145 TEST_F(OneClickSigninBubbleViewTest, BubbleOkButton) { | 145 TEST_F(OneClickSigninBubbleViewTest, BubbleOkButton) { |
| 146 OneClickSigninBubbleView* view = | 146 OneClickSigninBubbleView* view = |
| 147 ShowOneClickSigninBubble( | 147 ShowOneClickSigninBubble( |
| 148 BrowserWindow::ONE_CLICK_SIGNIN_BUBBLE_TYPE_BUBBLE); | 148 BrowserWindow::ONE_CLICK_SIGNIN_BUBBLE_TYPE_BUBBLE); |
| 149 | 149 |
| 150 // Simulate pressing the OK button. Set the message loop in the bubble | 150 // Simulate pressing the OK button. Set the message loop in the bubble |
| 151 // view so that it can be quit once the bubble is hidden. | 151 // view so that it can be quit once the bubble is hidden. |
| 152 views::ButtonListener* listener = view; | 152 views::ButtonListener* listener = view; |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 319 const ui::Accelerator accelerator(ui::VKEY_ESCAPE, 0); | 319 const ui::Accelerator accelerator(ui::VKEY_ESCAPE, 0); |
| 320 view->AcceleratorPressed(accelerator); | 320 view->AcceleratorPressed(accelerator); |
| 321 | 321 |
| 322 // View should no longer be showing. The message loop will exit once the | 322 // View should no longer be showing. The message loop will exit once the |
| 323 // fade animation of the bubble is done. | 323 // fade animation of the bubble is done. |
| 324 content::RunAllPendingInMessageLoop(); | 324 content::RunAllPendingInMessageLoop(); |
| 325 EXPECT_FALSE(OneClickSigninBubbleView::IsShowing()); | 325 EXPECT_FALSE(OneClickSigninBubbleView::IsShowing()); |
| 326 EXPECT_TRUE(on_start_sync_called_); | 326 EXPECT_TRUE(on_start_sync_called_); |
| 327 EXPECT_EQ(OneClickSigninSyncStarter::UNDO_SYNC, mode_); | 327 EXPECT_EQ(OneClickSigninSyncStarter::UNDO_SYNC, mode_); |
| 328 } | 328 } |
| OLD | NEW |