| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/strings/utf_string_conversions.h" | 5 #include "base/strings/utf_string_conversions.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/browser.h" | 8 #include "chrome/browser/ui/browser.h" |
| 9 #include "chrome/browser/ui/passwords/manage_passwords_ui_controller.h" | 9 #include "chrome/browser/ui/passwords/manage_passwords_ui_controller.h" |
| 10 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 10 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| (...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 399 form.username_value = base::ASCIIToUTF16("peter@pan.test"); | 399 form.username_value = base::ASCIIToUTF16("peter@pan.test"); |
| 400 form.password_value = base::ASCIIToUTF16("I can fly!"); | 400 form.password_value = base::ASCIIToUTF16("I can fly!"); |
| 401 | 401 |
| 402 // Successful login alone will not prompt: | 402 // Successful login alone will not prompt: |
| 403 client()->NotifySuccessfulLoginWithExistingPassword(form); | 403 client()->NotifySuccessfulLoginWithExistingPassword(form); |
| 404 ASSERT_FALSE(controller()->current_autosignin_prompt()); | 404 ASSERT_FALSE(controller()->current_autosignin_prompt()); |
| 405 | 405 |
| 406 // Blocked automatic sign-in will not prompt: | 406 // Blocked automatic sign-in will not prompt: |
| 407 scoped_ptr<autofill::PasswordForm> blocked_form( | 407 scoped_ptr<autofill::PasswordForm> blocked_form( |
| 408 new autofill::PasswordForm(form)); | 408 new autofill::PasswordForm(form)); |
| 409 client()->NotifyUserAutoSigninBlockedOnFirstRun(std::move(blocked_form)); | 409 client()->NotifyUserCouldBeAutoSignedIn(std::move(blocked_form)); |
| 410 ASSERT_FALSE(controller()->current_autosignin_prompt()); | 410 ASSERT_FALSE(controller()->current_autosignin_prompt()); |
| 411 | 411 |
| 412 // Successful login with a distinct form after block will not prompt: | 412 // Successful login with a distinct form after block will not prompt: |
| 413 blocked_form.reset(new autofill::PasswordForm(form)); | 413 blocked_form.reset(new autofill::PasswordForm(form)); |
| 414 client()->NotifyUserAutoSigninBlockedOnFirstRun(std::move(blocked_form)); | 414 client()->NotifyUserCouldBeAutoSignedIn(std::move(blocked_form)); |
| 415 form.username_value = base::ASCIIToUTF16("notpeter@pan.test"); | 415 form.username_value = base::ASCIIToUTF16("notpeter@pan.test"); |
| 416 client()->NotifySuccessfulLoginWithExistingPassword(form); | 416 client()->NotifySuccessfulLoginWithExistingPassword(form); |
| 417 ASSERT_FALSE(controller()->current_autosignin_prompt()); | 417 ASSERT_FALSE(controller()->current_autosignin_prompt()); |
| 418 | 418 |
| 419 // Successful login with the same form after block will not prompt if auto | 419 // Successful login with the same form after block will not prompt if auto |
| 420 // sign-in is off: | 420 // sign-in is off: |
| 421 browser()->profile()->GetPrefs()->SetBoolean( | 421 browser()->profile()->GetPrefs()->SetBoolean( |
| 422 password_manager::prefs::kCredentialsEnableAutosignin, false); | 422 password_manager::prefs::kCredentialsEnableAutosignin, false); |
| 423 blocked_form.reset(new autofill::PasswordForm(form)); | 423 blocked_form.reset(new autofill::PasswordForm(form)); |
| 424 client()->NotifyUserAutoSigninBlockedOnFirstRun(std::move(blocked_form)); | 424 client()->NotifyUserCouldBeAutoSignedIn(std::move(blocked_form)); |
| 425 client()->NotifySuccessfulLoginWithExistingPassword(form); | 425 client()->NotifySuccessfulLoginWithExistingPassword(form); |
| 426 ASSERT_FALSE(controller()->current_autosignin_prompt()); | 426 ASSERT_FALSE(controller()->current_autosignin_prompt()); |
| 427 browser()->profile()->GetPrefs()->SetBoolean( | 427 browser()->profile()->GetPrefs()->SetBoolean( |
| 428 password_manager::prefs::kCredentialsEnableAutosignin, true); | 428 password_manager::prefs::kCredentialsEnableAutosignin, true); |
| 429 | 429 |
| 430 // Successful login with the same form after block will prompt: | 430 // Successful login with the same form after block will prompt: |
| 431 blocked_form.reset(new autofill::PasswordForm(form)); | 431 blocked_form.reset(new autofill::PasswordForm(form)); |
| 432 client()->NotifyUserAutoSigninBlockedOnFirstRun(std::move(blocked_form)); | 432 client()->NotifyUserCouldBeAutoSignedIn(std::move(blocked_form)); |
| 433 client()->NotifySuccessfulLoginWithExistingPassword(form); | 433 client()->NotifySuccessfulLoginWithExistingPassword(form); |
| 434 ASSERT_TRUE(controller()->current_autosignin_prompt()); | 434 ASSERT_TRUE(controller()->current_autosignin_prompt()); |
| 435 } | 435 } |
| 436 | 436 |
| 437 } // namespace | 437 } // namespace |
| OLD | NEW |