| 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/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 "chrome/browser/ui/browser.h" | 8 #include "chrome/browser/ui/browser.h" |
| 9 #include "chrome/browser/ui/browser_window.h" | 9 #include "chrome/browser/ui/browser_window.h" |
| 10 #include "chrome/test/base/in_process_browser_test.h" | 10 #include "chrome/test/base/in_process_browser_test.h" |
| 11 #include "chrome/test/base/ui_test_utils.h" | 11 #include "chrome/test/base/ui_test_utils.h" |
| 12 #include "content/public/common/page_transition_types.h" | 12 #include "content/public/common/page_transition_types.h" |
| 13 #include "ui/views/controls/button/text_button.h" | 13 #include "ui/views/controls/button/text_button.h" |
| 14 | 14 |
| 15 class OneClickSigninBubbleViewBrowserTest : public InProcessBrowserTest { | 15 class OneClickSigninBubbleViewBrowserTest : public InProcessBrowserTest { |
| 16 public: | 16 public: |
| 17 OneClickSigninBubbleViewBrowserTest() | 17 OneClickSigninBubbleViewBrowserTest() |
| 18 : on_start_sync_called_(false), | 18 : on_start_sync_called_(false), |
| 19 mode_(OneClickSigninSyncStarter::CONFIGURE_SYNC_FIRST) { | 19 mode_(OneClickSigninSyncStarter::CONFIGURE_SYNC_FIRST) { |
| 20 } | 20 } |
| 21 | 21 |
| 22 OneClickSigninBubbleView* ShowOneClickSigninBubble() { | 22 OneClickSigninBubbleView* ShowOneClickSigninBubble() { |
| 23 browser()->window()->ShowOneClickSigninBubble( | 23 browser()->window()->ShowOneClickSigninBubble( |
| 24 BrowserWindow::ONE_CLICK_SIGNIN_BUBBLE_TYPE_BUBBLE, |
| 24 base::Bind(&OneClickSigninBubbleViewBrowserTest::OnStartSync, this)); | 25 base::Bind(&OneClickSigninBubbleViewBrowserTest::OnStartSync, this)); |
| 25 | 26 |
| 26 content::RunAllPendingInMessageLoop(); | 27 content::RunAllPendingInMessageLoop(); |
| 27 EXPECT_TRUE(OneClickSigninBubbleView::IsShowing()); | 28 EXPECT_TRUE(OneClickSigninBubbleView::IsShowing()); |
| 28 | 29 |
| 29 OneClickSigninBubbleView* view = | 30 OneClickSigninBubbleView* view = |
| 30 OneClickSigninBubbleView::view_for_testing(); | 31 OneClickSigninBubbleView::view_for_testing(); |
| 31 EXPECT_TRUE(view != NULL); | 32 EXPECT_TRUE(view != NULL); |
| 32 | 33 |
| 33 // Simulate pressing a link in the bubble. This should open a new tab. | 34 // Simulate pressing a link in the bubble. This should open a new tab. |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 views::View* view = one_click_view; | 145 views::View* view = one_click_view; |
| 145 const ui::Accelerator accelerator(ui::VKEY_ESCAPE, 0); | 146 const ui::Accelerator accelerator(ui::VKEY_ESCAPE, 0); |
| 146 view->AcceleratorPressed(accelerator); | 147 view->AcceleratorPressed(accelerator); |
| 147 | 148 |
| 148 // View should no longer be showing. The message loop will exit once the | 149 // View should no longer be showing. The message loop will exit once the |
| 149 // fade animation of the bubble is done. | 150 // fade animation of the bubble is done. |
| 150 content::RunMessageLoop(); | 151 content::RunMessageLoop(); |
| 151 EXPECT_FALSE(on_start_sync_called_); | 152 EXPECT_FALSE(on_start_sync_called_); |
| 152 EXPECT_FALSE(OneClickSigninBubbleView::IsShowing()); | 153 EXPECT_FALSE(OneClickSigninBubbleView::IsShowing()); |
| 153 } | 154 } |
| OLD | NEW |