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" |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 OneClickSigninBubbleView* view = ShowOneClickSigninBubble(); | 67 OneClickSigninBubbleView* view = ShowOneClickSigninBubble(); |
68 | 68 |
69 // Simulate pressing the OK button. Set the message loop in the bubble | 69 // Simulate pressing the OK button. Set the message loop in the bubble |
70 // view so that it can be quit once the bubble is hidden. | 70 // view so that it can be quit once the bubble is hidden. |
71 views::ButtonListener* listener = view; | 71 views::ButtonListener* listener = view; |
72 const views::MouseEvent event(ui::ET_MOUSE_PRESSED, 0, 0, 0); | 72 const views::MouseEvent event(ui::ET_MOUSE_PRESSED, 0, 0, 0); |
73 listener->ButtonPressed(view->ok_button_, event); | 73 listener->ButtonPressed(view->ok_button_, event); |
74 | 74 |
75 // View should no longer be showing. The message loop will exit once the | 75 // View should no longer be showing. The message loop will exit once the |
76 // fade animation of the bubble is done. | 76 // fade animation of the bubble is done. |
77 ui_test_utils::RunMessageLoop(); | 77 content::RunMessageLoop(); |
78 EXPECT_TRUE(on_start_sync_called_); | 78 EXPECT_TRUE(on_start_sync_called_); |
79 EXPECT_EQ(OneClickSigninSyncStarter::SYNC_WITH_DEFAULT_SETTINGS, mode_); | 79 EXPECT_EQ(OneClickSigninSyncStarter::SYNC_WITH_DEFAULT_SETTINGS, mode_); |
80 EXPECT_FALSE(OneClickSigninBubbleView::IsShowing()); | 80 EXPECT_FALSE(OneClickSigninBubbleView::IsShowing()); |
81 } | 81 } |
82 | 82 |
83 // Disabled. See http://crbug.com/132348 | 83 // Disabled. See http://crbug.com/132348 |
84 IN_PROC_BROWSER_TEST_F(OneClickSigninBubbleViewBrowserTest, | 84 IN_PROC_BROWSER_TEST_F(OneClickSigninBubbleViewBrowserTest, |
85 DISABLED_UndoButton) { | 85 DISABLED_UndoButton) { |
86 OneClickSigninBubbleView* view = ShowOneClickSigninBubble(); | 86 OneClickSigninBubbleView* view = ShowOneClickSigninBubble(); |
87 | 87 |
88 // Simulate pressing the undo button. Set the message loop in the bubble | 88 // Simulate pressing the undo button. Set the message loop in the bubble |
89 // view so that it can be quit once the bubble is hidden. | 89 // view so that it can be quit once the bubble is hidden. |
90 views::ButtonListener* listener = view; | 90 views::ButtonListener* listener = view; |
91 const views::MouseEvent event(ui::ET_MOUSE_PRESSED, 0, 0, 0); | 91 const views::MouseEvent event(ui::ET_MOUSE_PRESSED, 0, 0, 0); |
92 listener->ButtonPressed(view->undo_button_, event); | 92 listener->ButtonPressed(view->undo_button_, event); |
93 | 93 |
94 // View should no longer be showing. The message loop will exit once the | 94 // View should no longer be showing. The message loop will exit once the |
95 // fade animation of the bubble is done. | 95 // fade animation of the bubble is done. |
96 ui_test_utils::RunMessageLoop(); | 96 content::RunMessageLoop(); |
97 EXPECT_FALSE(on_start_sync_called_); | 97 EXPECT_FALSE(on_start_sync_called_); |
98 EXPECT_FALSE(OneClickSigninBubbleView::IsShowing()); | 98 EXPECT_FALSE(OneClickSigninBubbleView::IsShowing()); |
99 } | 99 } |
100 | 100 |
101 // Disabled. See http://crbug.com/132348 | 101 // Disabled. See http://crbug.com/132348 |
102 IN_PROC_BROWSER_TEST_F(OneClickSigninBubbleViewBrowserTest, | 102 IN_PROC_BROWSER_TEST_F(OneClickSigninBubbleViewBrowserTest, |
103 DISABLED_AdvancedLink) { | 103 DISABLED_AdvancedLink) { |
104 OneClickSigninBubbleView* view = ShowOneClickSigninBubble(); | 104 OneClickSigninBubbleView* view = ShowOneClickSigninBubble(); |
105 | 105 |
106 // Simulate pressing a link in the bubble. This should open a new tab. | 106 // Simulate pressing a link in the bubble. This should open a new tab. |
107 views::LinkListener* listener = view; | 107 views::LinkListener* listener = view; |
108 listener->LinkClicked(view->advanced_link_, 0); | 108 listener->LinkClicked(view->advanced_link_, 0); |
109 | 109 |
110 // View should no longer be showing and a new tab should be opened. | 110 // View should no longer be showing and a new tab should be opened. |
111 ui_test_utils::RunMessageLoop(); | 111 content::RunMessageLoop(); |
112 EXPECT_TRUE(on_start_sync_called_); | 112 EXPECT_TRUE(on_start_sync_called_); |
113 EXPECT_EQ(OneClickSigninSyncStarter::CONFIGURE_SYNC_FIRST, mode_); | 113 EXPECT_EQ(OneClickSigninSyncStarter::CONFIGURE_SYNC_FIRST, mode_); |
114 EXPECT_FALSE(OneClickSigninBubbleView::IsShowing()); | 114 EXPECT_FALSE(OneClickSigninBubbleView::IsShowing()); |
115 } | 115 } |
116 | 116 |
117 // Disabled. See http://crbug.com/132348 | 117 // Disabled. See http://crbug.com/132348 |
118 IN_PROC_BROWSER_TEST_F(OneClickSigninBubbleViewBrowserTest, | 118 IN_PROC_BROWSER_TEST_F(OneClickSigninBubbleViewBrowserTest, |
119 DISABLED_PressEnterKey) { | 119 DISABLED_PressEnterKey) { |
120 OneClickSigninBubbleView* one_click_view = ShowOneClickSigninBubble(); | 120 OneClickSigninBubbleView* one_click_view = ShowOneClickSigninBubble(); |
121 | 121 |
122 // Simulate pressing the Enter key. | 122 // Simulate pressing the Enter key. |
123 views::View* view = one_click_view; | 123 views::View* view = one_click_view; |
124 const ui::Accelerator accelerator(ui::VKEY_RETURN, 0); | 124 const ui::Accelerator accelerator(ui::VKEY_RETURN, 0); |
125 view->AcceleratorPressed(accelerator); | 125 view->AcceleratorPressed(accelerator); |
126 | 126 |
127 // View should no longer be showing. The message loop will exit once the | 127 // View should no longer be showing. The message loop will exit once the |
128 // fade animation of the bubble is done. | 128 // fade animation of the bubble is done. |
129 ui_test_utils::RunMessageLoop(); | 129 content::RunMessageLoop(); |
130 EXPECT_TRUE(on_start_sync_called_); | 130 EXPECT_TRUE(on_start_sync_called_); |
131 EXPECT_EQ(OneClickSigninSyncStarter::SYNC_WITH_DEFAULT_SETTINGS, mode_); | 131 EXPECT_EQ(OneClickSigninSyncStarter::SYNC_WITH_DEFAULT_SETTINGS, mode_); |
132 EXPECT_FALSE(OneClickSigninBubbleView::IsShowing()); | 132 EXPECT_FALSE(OneClickSigninBubbleView::IsShowing()); |
133 } | 133 } |
134 | 134 |
135 // Disabled. See http://crbug.com/132348 | 135 // Disabled. See http://crbug.com/132348 |
136 IN_PROC_BROWSER_TEST_F(OneClickSigninBubbleViewBrowserTest, | 136 IN_PROC_BROWSER_TEST_F(OneClickSigninBubbleViewBrowserTest, |
137 DISABLED_PressEscapeKey) { | 137 DISABLED_PressEscapeKey) { |
138 OneClickSigninBubbleView* one_click_view = ShowOneClickSigninBubble(); | 138 OneClickSigninBubbleView* one_click_view = ShowOneClickSigninBubble(); |
139 | 139 |
140 // Simulate pressing the Escape key. | 140 // Simulate pressing the Escape key. |
141 views::View* view = one_click_view; | 141 views::View* view = one_click_view; |
142 const ui::Accelerator accelerator(ui::VKEY_ESCAPE, 0); | 142 const ui::Accelerator accelerator(ui::VKEY_ESCAPE, 0); |
143 view->AcceleratorPressed(accelerator); | 143 view->AcceleratorPressed(accelerator); |
144 | 144 |
145 // View should no longer be showing. The message loop will exit once the | 145 // View should no longer be showing. The message loop will exit once the |
146 // fade animation of the bubble is done. | 146 // fade animation of the bubble is done. |
147 ui_test_utils::RunMessageLoop(); | 147 content::RunMessageLoop(); |
148 EXPECT_FALSE(on_start_sync_called_); | 148 EXPECT_FALSE(on_start_sync_called_); |
149 EXPECT_FALSE(OneClickSigninBubbleView::IsShowing()); | 149 EXPECT_FALSE(OneClickSigninBubbleView::IsShowing()); |
150 } | 150 } |
OLD | NEW |