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 30 matching lines...) Expand all Loading... |
41 | 41 |
42 // Wait for the command execution to pop up the bubble. | 42 // Wait for the command execution to pop up the bubble. |
43 content::RunAllPendingInMessageLoop(); | 43 content::RunAllPendingInMessageLoop(); |
44 } | 44 } |
45 | 45 |
46 void ManagePasswordsTest::SetupManagingPasswords() { | 46 void ManagePasswordsTest::SetupManagingPasswords() { |
47 base::string16 kTestUsername = base::ASCIIToUTF16("test_username"); | 47 base::string16 kTestUsername = base::ASCIIToUTF16("test_username"); |
48 autofill::PasswordFormMap map; | 48 autofill::PasswordFormMap map; |
49 map.insert(kTestUsername, | 49 map.insert(kTestUsername, |
50 make_scoped_ptr(new autofill::PasswordForm(*test_form()))); | 50 make_scoped_ptr(new autofill::PasswordForm(*test_form()))); |
51 GetController()->OnPasswordAutofilled(map); | 51 GetController()->OnPasswordAutofilled(map, map.begin()->second->origin); |
52 } | 52 } |
53 | 53 |
54 void ManagePasswordsTest::SetupPendingPassword() { | 54 void ManagePasswordsTest::SetupPendingPassword() { |
55 password_manager::StubPasswordManagerClient client; | 55 password_manager::StubPasswordManagerClient client; |
56 password_manager::StubPasswordManagerDriver driver; | 56 password_manager::StubPasswordManagerDriver driver; |
57 scoped_ptr<password_manager::PasswordFormManager> test_form_manager( | 57 scoped_ptr<password_manager::PasswordFormManager> test_form_manager( |
58 new password_manager::PasswordFormManager( | 58 new password_manager::PasswordFormManager( |
59 NULL, &client, driver.AsWeakPtr(), *test_form(), false)); | 59 NULL, &client, driver.AsWeakPtr(), *test_form(), false)); |
60 test_form_manager->SimulateFetchMatchingLoginsFromPasswordStore(); | 60 test_form_manager->SimulateFetchMatchingLoginsFromPasswordStore(); |
61 ScopedVector<autofill::PasswordForm> best_matches; | 61 ScopedVector<autofill::PasswordForm> best_matches; |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 const char* histogram) { | 103 const char* histogram) { |
104 // Ensure that everything has been properly recorded before pulling samples. | 104 // Ensure that everything has been properly recorded before pulling samples. |
105 content::RunAllPendingInMessageLoop(); | 105 content::RunAllPendingInMessageLoop(); |
106 return histogram_tester_.GetHistogramSamplesSinceCreation(histogram).Pass(); | 106 return histogram_tester_.GetHistogramSamplesSinceCreation(histogram).Pass(); |
107 } | 107 } |
108 | 108 |
109 ManagePasswordsUIController* ManagePasswordsTest::GetController() { | 109 ManagePasswordsUIController* ManagePasswordsTest::GetController() { |
110 return ManagePasswordsUIController::FromWebContents( | 110 return ManagePasswordsUIController::FromWebContents( |
111 browser()->tab_strip_model()->GetActiveWebContents()); | 111 browser()->tab_strip_model()->GetActiveWebContents()); |
112 } | 112 } |
OLD | NEW |