Chromium Code Reviews| 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/memory/ptr_util.h" | 5 #include "base/memory/ptr_util.h" |
| 6 #include "base/strings/utf_string_conversions.h" | 6 #include "base/strings/utf_string_conversions.h" |
| 7 #include "chrome/browser/password_manager/chrome_password_manager_client.h" | 7 #include "chrome/browser/password_manager/chrome_password_manager_client.h" |
| 8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
| 9 #include "chrome/browser/ui/browser.h" | 9 #include "chrome/browser/ui/browser.h" |
| 10 #include "chrome/browser/ui/passwords/manage_passwords_ui_controller.h" | 10 #include "chrome/browser/ui/passwords/manage_passwords_ui_controller.h" |
| (...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 463 // Successful login with the same form after block will prompt: | 463 // Successful login with the same form after block will prompt: |
| 464 blocked_form.reset(new autofill::PasswordForm(form)); | 464 blocked_form.reset(new autofill::PasswordForm(form)); |
| 465 client()->NotifyUserCouldBeAutoSignedIn(std::move(blocked_form)); | 465 client()->NotifyUserCouldBeAutoSignedIn(std::move(blocked_form)); |
| 466 client()->NotifySuccessfulLoginWithExistingPassword(form); | 466 client()->NotifySuccessfulLoginWithExistingPassword(form); |
| 467 ASSERT_TRUE(controller()->current_autosignin_prompt()); | 467 ASSERT_TRUE(controller()->current_autosignin_prompt()); |
| 468 } | 468 } |
| 469 | 469 |
| 470 // DialogBrowserTest methods for interactive dialog invocation. | 470 // DialogBrowserTest methods for interactive dialog invocation. |
| 471 void PasswordDialogViewTest::ShowDialog(const std::string& name) { | 471 void PasswordDialogViewTest::ShowDialog(const std::string& name) { |
| 472 GURL origin("https://example.com"); | 472 GURL origin("https://example.com"); |
| 473 EXPECT_EQ("PopupAutoSigninPrompt", name); | |
| 474 std::vector<std::unique_ptr<autofill::PasswordForm>> local_credentials; | 473 std::vector<std::unique_ptr<autofill::PasswordForm>> local_credentials; |
| 475 autofill::PasswordForm form; | 474 autofill::PasswordForm form; |
| 476 form.origin = origin; | 475 form.origin = origin; |
| 477 form.display_name = base::ASCIIToUTF16("Peter"); | 476 form.display_name = base::ASCIIToUTF16("Peter"); |
| 478 form.username_value = base::ASCIIToUTF16("peter@pan.test"); | 477 form.username_value = base::ASCIIToUTF16("peter@pan.test"); |
| 479 form.icon_url = GURL("broken url"); | 478 if (name == "PopupAutoSigninPrompt") { |
| 480 local_credentials.push_back(base::MakeUnique<autofill::PasswordForm>(form)); | 479 form.icon_url = GURL("broken url"); |
| 481 GURL icon_url("https://google.com/icon.png"); | 480 local_credentials.push_back(base::MakeUnique<autofill::PasswordForm>(form)); |
| 482 form.icon_url = icon_url; | 481 GURL icon_url("https://google.com/icon.png"); |
|
Peter Kasting
2017/04/24 22:48:31
Nit: Inline into next line
kylix_rd
2017/04/25 17:14:07
Done.
| |
| 483 form.display_name = base::ASCIIToUTF16("Peter Pan"); | 482 form.icon_url = icon_url; |
| 484 form.federation_origin = url::Origin(GURL("https://google.com/federation")); | 483 form.display_name = base::ASCIIToUTF16("Peter Pan"); |
| 485 local_credentials.push_back(base::MakeUnique<autofill::PasswordForm>(form)); | 484 form.federation_origin = url::Origin(GURL("https://google.com/federation")); |
| 486 SetupChooseCredentials(std::move(local_credentials), origin); | 485 local_credentials.push_back(base::MakeUnique<autofill::PasswordForm>(form)); |
| 487 ASSERT_TRUE(controller()->current_account_chooser()); | 486 SetupChooseCredentials(std::move(local_credentials), origin); |
| 487 ASSERT_TRUE(controller()->current_account_chooser()); | |
| 488 } else if (name == "PopupAccountChooserWithSingleCredentialClickSignIn") { | |
| 489 local_credentials.push_back(base::MakeUnique<autofill::PasswordForm>(form)); | |
| 490 SetupChooseCredentials(std::move(local_credentials), origin); | |
| 491 } else { | |
| 492 ADD_FAILURE() << "Unknown dialog type"; | |
| 493 return; | |
| 494 } | |
| 488 } | 495 } |
| 489 | 496 |
| 490 IN_PROC_BROWSER_TEST_F(PasswordDialogViewTest, | 497 IN_PROC_BROWSER_TEST_F(PasswordDialogViewTest, |
| 491 InvokeDialog_PopupAutoSigninPrompt) { | 498 InvokeDialog_PopupAutoSigninPrompt) { |
| 492 RunDialog(); | 499 RunDialog(); |
| 493 } | 500 } |
| 494 | 501 |
| 502 IN_PROC_BROWSER_TEST_F( | |
| 503 PasswordDialogViewTest, | |
| 504 InvokeDialog_PopupAccountChooserWithSingleCredentialClickSignIn) { | |
| 505 RunDialog(); | |
| 506 } | |
| 507 | |
| 495 } // namespace | 508 } // namespace |
| OLD | NEW |