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 1101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1112 std::string submit = | 1112 std::string submit = |
1113 "document.getElementById('username').value = 'overwrite_me';" | 1113 "document.getElementById('username').value = 'overwrite_me';" |
1114 "document.getElementById('password').value = 'random';" | 1114 "document.getElementById('password').value = 'random';" |
1115 "document.getElementById('non-form-button').click();"; | 1115 "document.getElementById('non-form-button').click();"; |
1116 ASSERT_TRUE(content::ExecuteScript(RenderViewHost(), submit)); | 1116 ASSERT_TRUE(content::ExecuteScript(RenderViewHost(), submit)); |
1117 observer.Wait(); | 1117 observer.Wait(); |
1118 | 1118 |
1119 EXPECT_TRUE(prompt_observer->IsShowingPrompt()); | 1119 EXPECT_TRUE(prompt_observer->IsShowingPrompt()); |
1120 } | 1120 } |
1121 | 1121 |
1122 IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, | |
1123 NoPromptForPasswordFormWithoutUsernameField) { | |
1124 password_manager::TestPasswordStore* password_store = | |
1125 static_cast<password_manager::TestPasswordStore*>( | |
1126 PasswordStoreFactory::GetForProfile(browser()->profile(), | |
1127 Profile::IMPLICIT_ACCESS).get()); | |
1128 | |
1129 EXPECT_TRUE(password_store->IsEmpty()); | |
1130 | |
1131 NavigateToFile("/password/form_with_only_password_field.html"); | |
1132 | |
1133 NavigationObserver observer(WebContents()); | |
1134 scoped_ptr<PromptObserver> prompt_observer( | |
1135 PromptObserver::Create(WebContents())); | |
1136 std::string submit = | |
1137 "document.getElementById('password').value = 'password';" | |
1138 "document.getElementById('submit-button').click();"; | |
1139 ASSERT_TRUE(content::ExecuteScript(RenderViewHost(), submit)); | |
1140 observer.Wait(); | |
1141 | |
1142 EXPECT_FALSE(prompt_observer->IsShowingPrompt()); | |
vabr (Chromium)
2014/09/15 13:01:45
This might be a misunderstanding caused by "doesn'
Pritam Nikam
2014/09/15 15:02:08
Done.
| |
1143 | |
1144 // Spin the message loop to make sure the password store had a chance to save | |
1145 // the password. | |
1146 base::RunLoop run_loop; | |
1147 run_loop.RunUntilIdle(); | |
1148 EXPECT_FALSE(password_store->IsEmpty()); | |
1149 } | |
OLD | NEW |