OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "base/command_line.h" | 5 #include "base/command_line.h" |
6 #include "chrome/browser/password_manager/chrome_password_manager_client.h" | 6 #include "chrome/browser/password_manager/chrome_password_manager_client.h" |
7 #include "chrome/browser/profiles/profile.h" | 7 #include "chrome/browser/profiles/profile.h" |
8 #include "chrome/browser/ui/autofill/password_generation_popup_observer.h" | 8 #include "chrome/browser/ui/autofill/password_generation_popup_observer.h" |
9 #include "chrome/browser/ui/browser.h" | 9 #include "chrome/browser/ui/browser.h" |
10 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 10 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 } | 125 } |
126 | 126 |
127 bool EditingPopupShowing() { | 127 bool EditingPopupShowing() { |
128 return observer_.popup_showing() && !observer_.password_visible(); | 128 return observer_.popup_showing() && !observer_.password_visible(); |
129 } | 129 } |
130 | 130 |
131 private: | 131 private: |
132 TestPopupObserver observer_; | 132 TestPopupObserver observer_; |
133 }; | 133 }; |
134 | 134 |
135 #if defined(USE_AURA) | 135 // Disabled due to flakiness due to resizes, see http://crbug.com/407998. |
136 // Enabled on these platforms. | |
137 // Disabled due to flakiness, see http://crbug.com/407998 | |
138 #define MAYBE_PopupShownAndPasswordSelected \ | |
139 DISABLED_PopupShownAndPasswordSelected | |
140 #define MAYBE_PopupShownAndDismissed DISABLED_PopupShownAndDismissed | |
141 #define MAYBE_PopupShownAndDismissedByScrolling \ | |
142 DISABLED_PopupShownAndDismissedByScrolling | |
143 #else | |
144 // Popup not enabled for these platforms yet. | |
145 #define MAYBE_PopupShownAndPasswordSelected \ | |
146 DISABLED_PopupShownAndPasswordSelected | |
147 #define MAYBE_PopupShownAndDismissed DISABLED_PopupShownAndDismissed | |
148 #define MAYBE_PopupShownAndDismissedByScrolling \ | |
149 DISABLED_PopupShownAndDismissedByScrolling | |
150 #endif | |
151 | |
152 IN_PROC_BROWSER_TEST_F(PasswordGenerationInteractiveTest, | 136 IN_PROC_BROWSER_TEST_F(PasswordGenerationInteractiveTest, |
153 MAYBE_PopupShownAndPasswordSelected) { | 137 DISABLED_PopupShownAndPasswordSelected) { |
154 FocusPasswordField(); | 138 FocusPasswordField(); |
155 EXPECT_TRUE(GenerationPopupShowing()); | 139 EXPECT_TRUE(GenerationPopupShowing()); |
156 SendKeyToPopup(ui::VKEY_DOWN); | 140 SendKeyToPopup(ui::VKEY_DOWN); |
157 SendKeyToPopup(ui::VKEY_RETURN); | 141 SendKeyToPopup(ui::VKEY_RETURN); |
158 | 142 |
159 // Selecting the password should fill the field and move focus to the | 143 // Selecting the password should fill the field and move focus to the |
160 // submit button. | 144 // submit button. |
161 EXPECT_FALSE(GetFieldValue("password_field").empty()); | 145 EXPECT_FALSE(GetFieldValue("password_field").empty()); |
162 EXPECT_FALSE(GenerationPopupShowing()); | 146 EXPECT_FALSE(GenerationPopupShowing()); |
163 EXPECT_FALSE(EditingPopupShowing()); | 147 EXPECT_FALSE(EditingPopupShowing()); |
164 EXPECT_EQ("input_submit_button", GetFocusedElement()); | 148 EXPECT_EQ("input_submit_button", GetFocusedElement()); |
165 | 149 |
166 // Re-focusing the password field should show the editing popup. | 150 // Re-focusing the password field should show the editing popup. |
167 FocusPasswordField(); | 151 FocusPasswordField(); |
168 EXPECT_TRUE(EditingPopupShowing()); | 152 EXPECT_TRUE(EditingPopupShowing()); |
169 } | 153 } |
170 | 154 |
| 155 // Disabled due to flakiness due to resizes, see http://crbug.com/407998. |
171 IN_PROC_BROWSER_TEST_F(PasswordGenerationInteractiveTest, | 156 IN_PROC_BROWSER_TEST_F(PasswordGenerationInteractiveTest, |
172 MAYBE_PopupShownAndDismissed) { | 157 DISABLED_PopupShownAndDismissed) { |
173 FocusPasswordField(); | 158 FocusPasswordField(); |
174 EXPECT_TRUE(GenerationPopupShowing()); | 159 EXPECT_TRUE(GenerationPopupShowing()); |
175 | 160 |
176 SendKeyToPopup(ui::VKEY_ESCAPE); | 161 SendKeyToPopup(ui::VKEY_ESCAPE); |
177 | 162 |
178 // Popup is dismissed. | 163 // Popup is dismissed. |
179 EXPECT_FALSE(GenerationPopupShowing()); | 164 EXPECT_FALSE(GenerationPopupShowing()); |
180 } | 165 } |
181 | 166 |
| 167 // Disabled due to flakiness due to resizes, see http://crbug.com/407998. |
182 IN_PROC_BROWSER_TEST_F(PasswordGenerationInteractiveTest, | 168 IN_PROC_BROWSER_TEST_F(PasswordGenerationInteractiveTest, |
183 MAYBE_PopupShownAndDismissedByScrolling) { | 169 DISABLED_PopupShownAndDismissedByScrolling) { |
184 FocusPasswordField(); | 170 FocusPasswordField(); |
185 EXPECT_TRUE(GenerationPopupShowing()); | 171 EXPECT_TRUE(GenerationPopupShowing()); |
186 | 172 |
187 ASSERT_TRUE(content::ExecuteScript(GetRenderViewHost(), | 173 ASSERT_TRUE(content::ExecuteScript(GetRenderViewHost(), |
188 "window.scrollTo(100, 0);")); | 174 "window.scrollTo(100, 0);")); |
189 | 175 |
190 EXPECT_FALSE(GenerationPopupShowing()); | 176 EXPECT_FALSE(GenerationPopupShowing()); |
191 } | 177 } |
| 178 |
| 179 // Disabled due to flakiness due to resizes, see http://crbug.com/407998. |
| 180 IN_PROC_BROWSER_TEST_F(PasswordGenerationInteractiveTest, |
| 181 DISABLED_GenerationTriggeredInIFrame) { |
| 182 GURL url = embedded_test_server()->GetURL( |
| 183 "/password/framed_signup_form.html"); |
| 184 ui_test_utils::NavigateToURL(browser(), url); |
| 185 |
| 186 std::string focus_script = |
| 187 "var frame = document.getElementById('signup_iframe');" |
| 188 "var frame_doc = frame.contentDocument;" |
| 189 "frame_doc.getElementById('password_field').focus();"; |
| 190 |
| 191 ASSERT_TRUE(content::ExecuteScript(GetRenderViewHost(), focus_script)); |
| 192 EXPECT_TRUE(GenerationPopupShowing()); |
| 193 } |
OLD | NEW |