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 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/metrics/histogram_samples.h" | 8 #include "base/metrics/histogram_samples.h" |
9 #include "base/metrics/statistics_recorder.h" | 9 #include "base/metrics/statistics_recorder.h" |
10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
(...skipping 1081 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1092 nav_observer.Wait(); | 1092 nav_observer.Wait(); |
1093 EXPECT_TRUE(prompt_observer->IsShowingPrompt()); | 1093 EXPECT_TRUE(prompt_observer->IsShowingPrompt()); |
1094 prompt_observer->Accept(); | 1094 prompt_observer->Accept(); |
1095 | 1095 |
1096 // Spin the message loop to make sure the password store had a chance to save | 1096 // Spin the message loop to make sure the password store had a chance to save |
1097 // the password. | 1097 // the password. |
1098 base::RunLoop run_loop; | 1098 base::RunLoop run_loop; |
1099 run_loop.RunUntilIdle(); | 1099 run_loop.RunUntilIdle(); |
1100 EXPECT_FALSE(password_store->IsEmpty()); | 1100 EXPECT_FALSE(password_store->IsEmpty()); |
1101 } | 1101 } |
| 1102 |
| 1103 // In some situations, multiple PasswordFormManager instances from |
| 1104 // PasswordManager::pending_login_managers_ would match (via DoesManage) a form |
| 1105 // to be provisionally saved. One of them might be a complete match, the other |
| 1106 // all-but-action match. Normally, the former should be preferred, but if the |
| 1107 // former has not finished matching, and the latter has, the latter should be |
| 1108 // used (otherwise we'd give up even though we could have saved the password). |
| 1109 IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, |
| 1110 PreferPasswordFormManagerWhichFinishedMatching) { |
| 1111 NavigateToFile("/password/create_form_copy_on_submit.html"); |
| 1112 |
| 1113 NavigationObserver observer(WebContents()); |
| 1114 scoped_ptr<PromptObserver> prompt_observer( |
| 1115 PromptObserver::Create(WebContents())); |
| 1116 std::string submit = |
| 1117 "document.getElementById('username').value = 'overwrite_me';" |
| 1118 "document.getElementById('password').value = 'random';" |
| 1119 "document.getElementById('non-form-button').click();"; |
| 1120 ASSERT_TRUE(content::ExecuteScript(RenderViewHost(), submit)); |
| 1121 observer.Wait(); |
| 1122 |
| 1123 EXPECT_TRUE(prompt_observer->IsShowingPrompt()); |
| 1124 } |
| 1125 |
OLD | NEW |