Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(145)

Side by Side Diff: chrome/browser/ui/views/sync/one_click_signin_bubble_view_unittest.cc

Issue 101573006: Changes MouseEvent constructor to take changed_button_flags. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix test; needs updated expectations as mouse entered wasnt sent before because of env::mouse_butto… Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
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;
153 const ui::MouseEvent event(ui::ET_MOUSE_PRESSED, 153 const ui::MouseEvent event(ui::ET_MOUSE_PRESSED,
154 gfx::Point(), gfx::Point(), 154 gfx::Point(), gfx::Point(),
155 0); 155 0, 0);
156 listener->ButtonPressed(view->ok_button_, event); 156 listener->ButtonPressed(view->ok_button_, event);
157 157
158 // View should no longer be showing. The message loop will exit once the 158 // View should no longer be showing. The message loop will exit once the
159 // fade animation of the bubble is done. 159 // fade animation of the bubble is done.
160 content::RunAllPendingInMessageLoop(); 160 content::RunAllPendingInMessageLoop();
161 EXPECT_FALSE(OneClickSigninBubbleView::IsShowing()); 161 EXPECT_FALSE(OneClickSigninBubbleView::IsShowing());
162 } 162 }
163 163
164 TEST_F(OneClickSigninBubbleViewTest, DialogOkButton) { 164 TEST_F(OneClickSigninBubbleViewTest, DialogOkButton) {
165 OneClickSigninBubbleView* view = ShowOneClickSigninBubble( 165 OneClickSigninBubbleView* view = ShowOneClickSigninBubble(
166 BrowserWindow::ONE_CLICK_SIGNIN_BUBBLE_TYPE_MODAL_DIALOG); 166 BrowserWindow::ONE_CLICK_SIGNIN_BUBBLE_TYPE_MODAL_DIALOG);
167 167
168 // Simulate pressing the OK button. Set the message loop in the bubble 168 // Simulate pressing the OK button. Set the message loop in the bubble
169 // view so that it can be quit once the bubble is hidden. 169 // view so that it can be quit once the bubble is hidden.
170 views::ButtonListener* listener = view; 170 views::ButtonListener* listener = view;
171 const ui::MouseEvent event(ui::ET_MOUSE_PRESSED, 171 const ui::MouseEvent event(ui::ET_MOUSE_PRESSED,
172 gfx::Point(), gfx::Point(), 172 gfx::Point(), gfx::Point(),
173 0); 173 0, 0);
174 listener->ButtonPressed(view->ok_button_, event); 174 listener->ButtonPressed(view->ok_button_, event);
175 175
176 // View should no longer be showing and sync should start 176 // View should no longer be showing and sync should start
177 // The message loop will exit once the fade animation of the dialog is done. 177 // The message loop will exit once the fade animation of the dialog is done.
178 content::RunAllPendingInMessageLoop(); 178 content::RunAllPendingInMessageLoop();
179 EXPECT_FALSE(OneClickSigninBubbleView::IsShowing()); 179 EXPECT_FALSE(OneClickSigninBubbleView::IsShowing());
180 EXPECT_TRUE(on_start_sync_called_); 180 EXPECT_TRUE(on_start_sync_called_);
181 EXPECT_EQ(OneClickSigninSyncStarter::SYNC_WITH_DEFAULT_SETTINGS, mode_); 181 EXPECT_EQ(OneClickSigninSyncStarter::SYNC_WITH_DEFAULT_SETTINGS, mode_);
182 } 182 }
183 183
184 TEST_F(OneClickSigninBubbleViewTest, DialogUndoButton) { 184 TEST_F(OneClickSigninBubbleViewTest, DialogUndoButton) {
185 OneClickSigninBubbleView* view = ShowOneClickSigninBubble( 185 OneClickSigninBubbleView* view = ShowOneClickSigninBubble(
186 BrowserWindow::ONE_CLICK_SIGNIN_BUBBLE_TYPE_MODAL_DIALOG); 186 BrowserWindow::ONE_CLICK_SIGNIN_BUBBLE_TYPE_MODAL_DIALOG);
187 187
188 // Simulate pressing the undo button. Set the message loop in the bubble 188 // Simulate pressing the undo button. Set the message loop in the bubble
189 // view so that it can be quit once the bubble is hidden. 189 // view so that it can be quit once the bubble is hidden.
190 views::ButtonListener* listener = view; 190 views::ButtonListener* listener = view;
191 const ui::MouseEvent event(ui::ET_MOUSE_PRESSED, 191 const ui::MouseEvent event(ui::ET_MOUSE_PRESSED,
192 gfx::Point(), gfx::Point(), 192 gfx::Point(), gfx::Point(),
193 0); 193 0, 0);
194 listener->ButtonPressed(view->undo_button_, event); 194 listener->ButtonPressed(view->undo_button_, event);
195 195
196 // View should no longer be showing. The message loop will exit once the 196 // View should no longer be showing. The message loop will exit once the
197 // fade animation of the bubble is done. 197 // fade animation of the bubble is done.
198 content::RunAllPendingInMessageLoop(); 198 content::RunAllPendingInMessageLoop();
199 EXPECT_FALSE(OneClickSigninBubbleView::IsShowing()); 199 EXPECT_FALSE(OneClickSigninBubbleView::IsShowing());
200 EXPECT_TRUE(on_start_sync_called_); 200 EXPECT_TRUE(on_start_sync_called_);
201 EXPECT_EQ(OneClickSigninSyncStarter::UNDO_SYNC, mode_); 201 EXPECT_EQ(OneClickSigninSyncStarter::UNDO_SYNC, mode_);
202 } 202 }
203 203
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698