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

Side by Side Diff: chrome/browser/ui/views/autofill/autofill_dialog_views_unittest.cc

Issue 663643002: requestAutocomplete (desktop): don't get stuck in infinite loop (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: stab at mac Created 6 years, 2 months 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
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/autofill/autofill_dialog_views.h" 5 #include "chrome/browser/ui/views/autofill/autofill_dialog_views.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "chrome/browser/ui/autofill/mock_autofill_dialog_view_delegate.h" 10 #include "chrome/browser/ui/autofill/mock_autofill_dialog_view_delegate.h"
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 } 117 }
118 118
119 TEST_F(AutofillDialogViewsTest, SignInFocus) { 119 TEST_F(AutofillDialogViewsTest, SignInFocus) {
120 SetSectionsFocusable(); 120 SetSectionsFocusable();
121 121
122 views::View* loading_shield = dialog()->GetLoadingShieldForTesting(); 122 views::View* loading_shield = dialog()->GetLoadingShieldForTesting();
123 views::View* sign_in_web_view = dialog()->GetSignInWebViewForTesting(); 123 views::View* sign_in_web_view = dialog()->GetSignInWebViewForTesting();
124 views::View* notification_area = dialog()->GetNotificationAreaForTesting(); 124 views::View* notification_area = dialog()->GetNotificationAreaForTesting();
125 views::View* scrollable_area = dialog()->GetScrollableAreaForTesting(); 125 views::View* scrollable_area = dialog()->GetScrollableAreaForTesting();
126 126
127 dialog()->ShowSignIn(); 127 dialog()->ShowSignIn(wallet::GetAddAccountUrl());
128 128
129 // The sign in view should be the only showing and focusable view. 129 // The sign in view should be the only showing and focusable view.
130 EXPECT_TRUE(sign_in_web_view->IsFocusable()); 130 EXPECT_TRUE(sign_in_web_view->IsFocusable());
131 EXPECT_FALSE(loading_shield->IsFocusable()); 131 EXPECT_FALSE(loading_shield->IsFocusable());
132 EXPECT_FALSE(notification_area->IsFocusable()); 132 EXPECT_FALSE(notification_area->IsFocusable());
133 EXPECT_FALSE(scrollable_area->IsFocusable()); 133 EXPECT_FALSE(scrollable_area->IsFocusable());
134 134
135 EXPECT_CALL(*delegate(), ShouldShowSpinner()).WillRepeatedly(Return(false)); 135 EXPECT_CALL(*delegate(), ShouldShowSpinner()).WillRepeatedly(Return(false));
136 dialog()->HideSignIn(); 136 dialog()->HideSignIn();
137 137
138 // Hide sign in while not loading Wallet items as if the user clicked "Back". 138 // Hide sign in while not loading Wallet items as if the user clicked "Back".
139 EXPECT_TRUE(notification_area->IsFocusable()); 139 EXPECT_TRUE(notification_area->IsFocusable());
140 EXPECT_TRUE(scrollable_area->IsFocusable()); 140 EXPECT_TRUE(scrollable_area->IsFocusable());
141 EXPECT_FALSE(loading_shield->IsFocusable()); 141 EXPECT_FALSE(loading_shield->IsFocusable());
142 EXPECT_FALSE(sign_in_web_view->IsFocusable()); 142 EXPECT_FALSE(sign_in_web_view->IsFocusable());
143 143
144 dialog()->ShowSignIn(); 144 dialog()->ShowSignIn(wallet::GetAddAccountUrl());
145 145
146 EXPECT_TRUE(sign_in_web_view->IsFocusable()); 146 EXPECT_TRUE(sign_in_web_view->IsFocusable());
147 EXPECT_FALSE(loading_shield->IsFocusable()); 147 EXPECT_FALSE(loading_shield->IsFocusable());
148 EXPECT_FALSE(notification_area->IsFocusable()); 148 EXPECT_FALSE(notification_area->IsFocusable());
149 EXPECT_FALSE(scrollable_area->IsFocusable()); 149 EXPECT_FALSE(scrollable_area->IsFocusable());
150 150
151 EXPECT_CALL(*delegate(), ShouldShowSpinner()).WillRepeatedly(Return(true)); 151 EXPECT_CALL(*delegate(), ShouldShowSpinner()).WillRepeatedly(Return(true));
152 dialog()->HideSignIn(); 152 dialog()->HideSignIn();
153 153
154 // Hide sign in while pretending to load Wallet data. 154 // Hide sign in while pretending to load Wallet data.
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 views::FocusManager* focus_manager = dialog()->GetWidget()->GetFocusManager(); 190 views::FocusManager* focus_manager = dialog()->GetWidget()->GetFocusManager();
191 views::View* focused_view = focus_manager->GetFocusedView(); 191 views::View* focused_view = focus_manager->GetFocusedView();
192 ASSERT_STREQ(DecoratedTextfield::kViewClassName, 192 ASSERT_STREQ(DecoratedTextfield::kViewClassName,
193 focused_view->GetClassName()); 193 focused_view->GetClassName());
194 EXPECT_FALSE(dialog()->HandleKeyEvent( 194 EXPECT_FALSE(dialog()->HandleKeyEvent(
195 static_cast<views::Textfield*>(focused_view), 195 static_cast<views::Textfield*>(focused_view),
196 ui::KeyEvent(ui::ET_KEY_PRESSED, ui::VKEY_A, ui::EF_NONE))); 196 ui::KeyEvent(ui::ET_KEY_PRESSED, ui::VKEY_A, ui::EF_NONE)));
197 } 197 }
198 198
199 } // namespace autofill 199 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698