OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "components/autofill/content/renderer/password_autofill_agent.h" | 5 #include "components/autofill/content/renderer/password_autofill_agent.h" |
6 | 6 |
7 #include "base/macros.h" | 7 #include "base/macros.h" |
8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 1281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1292 TEST_F(PasswordAutofillAgentTest, OnChangeLoggingState_Deactivated) { | 1292 TEST_F(PasswordAutofillAgentTest, OnChangeLoggingState_Deactivated) { |
1293 // Turn the logging on and then off. | 1293 // Turn the logging on and then off. |
1294 password_autofill_agent_->SetLoggingState(true); | 1294 password_autofill_agent_->SetLoggingState(true); |
1295 password_autofill_agent_->SetLoggingState(false); | 1295 password_autofill_agent_->SetLoggingState(false); |
1296 | 1296 |
1297 SendVisiblePasswordForms(); | 1297 SendVisiblePasswordForms(); |
1298 base::RunLoop().RunUntilIdle(); | 1298 base::RunLoop().RunUntilIdle(); |
1299 EXPECT_FALSE(fake_driver_.called_record_save_progress()); | 1299 EXPECT_FALSE(fake_driver_.called_record_save_progress()); |
1300 } | 1300 } |
1301 | 1301 |
1302 // Test that the agent sends an IPC call to get the current activity state of | |
1303 // password saving logging soon after construction. | |
1304 TEST_F(PasswordAutofillAgentTest, SendsLoggingStateUpdatePingOnConstruction) { | |
1305 base::RunLoop().RunUntilIdle(); | |
1306 EXPECT_TRUE(fake_driver_.called_agent_constructed()); | |
1307 } | |
1308 | |
1309 // Tests that one user click on a username field is sufficient to bring up a | 1302 // Tests that one user click on a username field is sufficient to bring up a |
1310 // credential suggestion popup, and the user can autocomplete the password by | 1303 // credential suggestion popup, and the user can autocomplete the password by |
1311 // selecting the credential from the popup. | 1304 // selecting the credential from the popup. |
1312 TEST_F(PasswordAutofillAgentTest, ClickAndSelect) { | 1305 TEST_F(PasswordAutofillAgentTest, ClickAndSelect) { |
1313 // SimulateElementClick() is called so that a user gesture is actually made | 1306 // SimulateElementClick() is called so that a user gesture is actually made |
1314 // and the password can be filled. However, SimulateElementClick() does not | 1307 // and the password can be filled. However, SimulateElementClick() does not |
1315 // actually lead to the AutofillAgent's InputElementClicked() method being | 1308 // actually lead to the AutofillAgent's InputElementClicked() method being |
1316 // called, so SimulateSuggestionChoice has to manually call | 1309 // called, so SimulateSuggestionChoice has to manually call |
1317 // InputElementClicked(). | 1310 // InputElementClicked(). |
1318 ClearUsernameAndPasswordFields(); | 1311 ClearUsernameAndPasswordFields(); |
(...skipping 1142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2461 SimulateElementClick("confirmpassword"); | 2454 SimulateElementClick("confirmpassword"); |
2462 EXPECT_FALSE(GetCalledShowPasswordSuggestions()); | 2455 EXPECT_FALSE(GetCalledShowPasswordSuggestions()); |
2463 | 2456 |
2464 // But when the user clicks on the autofilled password field again it should | 2457 // But when the user clicks on the autofilled password field again it should |
2465 // still produce a suggestion dropdown. | 2458 // still produce a suggestion dropdown. |
2466 SimulateElementClick("password"); | 2459 SimulateElementClick("password"); |
2467 CheckSuggestions("", false); | 2460 CheckSuggestions("", false); |
2468 } | 2461 } |
2469 | 2462 |
2470 } // namespace autofill | 2463 } // namespace autofill |
OLD | NEW |