| OLD | NEW |
| 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 <string> | 5 #include <string> |
| 6 #include <utility> | 6 #include <utility> |
| 7 | 7 |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 } | 198 } |
| 199 | 199 |
| 200 IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTestBase, | 200 IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTestBase, |
| 201 NoPromptIfFormReappearedInputOutsideFor) { | 201 NoPromptIfFormReappearedInputOutsideFor) { |
| 202 NavigateToFile("/password/failed_input_outside.html"); | 202 NavigateToFile("/password/failed_input_outside.html"); |
| 203 TestPromptNotShown("form with input outside", WebContents(), | 203 TestPromptNotShown("form with input outside", WebContents(), |
| 204 RenderViewHost()); | 204 RenderViewHost()); |
| 205 } | 205 } |
| 206 | 206 |
| 207 IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTestBase, | 207 IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTestBase, |
| 208 NoPromptIfPasswordFormManagerDestroyed) { |
| 209 NavigateToFile("/password/password_form.html"); |
| 210 // Simulate the Credential Manager API essentially destroying all the |
| 211 // PasswordFormManager instances. |
| 212 ChromePasswordManagerClient::FromWebContents(WebContents()) |
| 213 ->NotifyStorePasswordCalled(); |
| 214 |
| 215 // Fill a form and submit through a <input type="submit"> button. The renderer |
| 216 // should not send "PasswordFormsParsed" messages after the page was loaded. |
| 217 NavigationObserver observer(WebContents()); |
| 218 std::string fill_and_submit = |
| 219 "document.getElementById('username_field').value = 'temp';" |
| 220 "document.getElementById('password_field').value = 'random';" |
| 221 "document.getElementById('input_submit_button').click()"; |
| 222 ASSERT_TRUE(content::ExecuteScript(RenderViewHost(), fill_and_submit)); |
| 223 observer.Wait(); |
| 224 std::unique_ptr<BubbleObserver> prompt_observer( |
| 225 new BubbleObserver(WebContents())); |
| 226 EXPECT_FALSE(prompt_observer->IsShowingSavePrompt()); |
| 227 } |
| 228 |
| 229 IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTestBase, |
| 208 PromptForSubmitWithInPageNavigation) { | 230 PromptForSubmitWithInPageNavigation) { |
| 209 NavigateToFile("/password/password_navigate_before_submit.html"); | 231 NavigateToFile("/password/password_navigate_before_submit.html"); |
| 210 | 232 |
| 211 // Fill a form and submit through a <input type="submit"> button. Nothing | 233 // Fill a form and submit through a <input type="submit"> button. Nothing |
| 212 // special. The form does an in-page navigation before submitting. | 234 // special. The form does an in-page navigation before submitting. |
| 213 NavigationObserver observer(WebContents()); | 235 NavigationObserver observer(WebContents()); |
| 214 std::unique_ptr<BubbleObserver> prompt_observer( | 236 std::unique_ptr<BubbleObserver> prompt_observer( |
| 215 new BubbleObserver(WebContents())); | 237 new BubbleObserver(WebContents())); |
| 216 std::string fill_and_submit = | 238 std::string fill_and_submit = |
| 217 "document.getElementById('username_field').value = 'temp';" | 239 "document.getElementById('username_field').value = 'temp';" |
| (...skipping 2806 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3024 // about all frames, not just the main one. The factories should receive | 3046 // about all frames, not just the main one. The factories should receive |
| 3025 // messages for non-main frames, in particular | 3047 // messages for non-main frames, in particular |
| 3026 // AutofillHostMsg_PasswordFormsParsed. If that were the first time the | 3048 // AutofillHostMsg_PasswordFormsParsed. If that were the first time the |
| 3027 // factories hear about such frames, this would crash. | 3049 // factories hear about such frames, this would crash. |
| 3028 tab_strip_model->AddWebContents(detached_web_contents.release(), -1, | 3050 tab_strip_model->AddWebContents(detached_web_contents.release(), -1, |
| 3029 ::ui::PAGE_TRANSITION_AUTO_TOPLEVEL, | 3051 ::ui::PAGE_TRANSITION_AUTO_TOPLEVEL, |
| 3030 TabStripModel::ADD_ACTIVE); | 3052 TabStripModel::ADD_ACTIVE); |
| 3031 } | 3053 } |
| 3032 | 3054 |
| 3033 } // namespace password_manager | 3055 } // namespace password_manager |
| OLD | NEW |