Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chrome/browser/ui/passwords/manage_passwords_test.h" | 5 #include "chrome/browser/ui/passwords/manage_passwords_test.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "chrome/app/chrome_command_ids.h" | 9 #include "chrome/app/chrome_command_ids.h" |
| 10 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 63 password_manager::StubPasswordManagerClient client; | 63 password_manager::StubPasswordManagerClient client; |
| 64 password_manager::StubPasswordManagerDriver driver; | 64 password_manager::StubPasswordManagerDriver driver; |
| 65 scoped_ptr<password_manager::PasswordFormManager> test_form_manager( | 65 scoped_ptr<password_manager::PasswordFormManager> test_form_manager( |
| 66 new password_manager::PasswordFormManager( | 66 new password_manager::PasswordFormManager( |
| 67 NULL, &client, driver.AsWeakPtr(), *test_form(), false)); | 67 NULL, &client, driver.AsWeakPtr(), *test_form(), false)); |
| 68 GetController()->OnAutomaticPasswordSave(test_form_manager.Pass()); | 68 GetController()->OnAutomaticPasswordSave(test_form_manager.Pass()); |
| 69 } | 69 } |
| 70 | 70 |
| 71 void ManagePasswordsTest::SetupBlackistedPassword() { | 71 void ManagePasswordsTest::SetupBlackistedPassword() { |
| 72 base::string16 kTestUsername = base::ASCIIToUTF16("test_username"); | 72 base::string16 kTestUsername = base::ASCIIToUTF16("test_username"); |
| 73 test_form()->username_value = kTestUsername; | |
|
vabr (Chromium)
2015/03/17 09:25:57
I'm surprised the username_value needs to be set f
vasilii
2015/03/17 10:49:48
Done.
| |
| 74 test_form()->blacklisted_by_user = true; | |
| 73 autofill::PasswordFormMap map; | 75 autofill::PasswordFormMap map; |
| 74 map[kTestUsername] = test_form(); | 76 map[kTestUsername] = test_form(); |
| 75 GetController()->OnBlacklistBlockedAutofill(map); | 77 GetController()->OnBlacklistBlockedAutofill(map); |
| 76 } | 78 } |
| 77 | 79 |
| 78 void ManagePasswordsTest::SetupChooseCredentials( | 80 void ManagePasswordsTest::SetupChooseCredentials( |
| 79 ScopedVector<autofill::PasswordForm> local_credentials, | 81 ScopedVector<autofill::PasswordForm> local_credentials, |
| 80 ScopedVector<autofill::PasswordForm> federated_credentials, | 82 ScopedVector<autofill::PasswordForm> federated_credentials, |
| 81 const GURL& origin) { | 83 const GURL& origin) { |
| 82 base::string16 kTestUsername = base::ASCIIToUTF16("test_username"); | 84 base::string16 kTestUsername = base::ASCIIToUTF16("test_username"); |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 97 // Ensure that everything has been properly recorded before pulling samples. | 99 // Ensure that everything has been properly recorded before pulling samples. |
| 98 content::RunAllPendingInMessageLoop(); | 100 content::RunAllPendingInMessageLoop(); |
| 99 return histogram_tester_.GetHistogramSamplesSinceCreation(histogram) | 101 return histogram_tester_.GetHistogramSamplesSinceCreation(histogram) |
| 100 .release(); | 102 .release(); |
| 101 } | 103 } |
| 102 | 104 |
| 103 ManagePasswordsUIController* ManagePasswordsTest::GetController() { | 105 ManagePasswordsUIController* ManagePasswordsTest::GetController() { |
| 104 return ManagePasswordsUIController::FromWebContents( | 106 return ManagePasswordsUIController::FromWebContents( |
| 105 browser()->tab_strip_model()->GetActiveWebContents()); | 107 browser()->tab_strip_model()->GetActiveWebContents()); |
| 106 } | 108 } |
| OLD | NEW |