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 <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 void ManagePasswordsTest::SetupPendingPassword() { | 56 void ManagePasswordsTest::SetupPendingPassword() { |
57 password_manager::StubPasswordManagerClient client; | 57 password_manager::StubPasswordManagerClient client; |
58 password_manager::StubLogManager log_manager; | 58 password_manager::StubLogManager log_manager; |
59 password_manager::StubPasswordManagerDriver driver; | 59 password_manager::StubPasswordManagerDriver driver; |
60 | 60 |
61 scoped_ptr<password_manager::PasswordFormManager> test_form_manager( | 61 scoped_ptr<password_manager::PasswordFormManager> test_form_manager( |
62 new password_manager::PasswordFormManager( | 62 new password_manager::PasswordFormManager( |
63 nullptr, &client, driver.AsWeakPtr(), *test_form(), false)); | 63 nullptr, &client, driver.AsWeakPtr(), *test_form(), false)); |
64 test_form_manager->SimulateFetchMatchingLoginsFromPasswordStore(); | 64 test_form_manager->SimulateFetchMatchingLoginsFromPasswordStore(); |
65 ScopedVector<autofill::PasswordForm> best_matches; | 65 ScopedVector<autofill::PasswordForm> best_matches; |
66 test_form_manager->OnGetPasswordStoreResults(best_matches.Pass()); | 66 test_form_manager->OnGetPasswordStoreResults(std::move(best_matches)); |
67 GetController()->OnPasswordSubmitted(test_form_manager.Pass()); | 67 GetController()->OnPasswordSubmitted(std::move(test_form_manager)); |
68 } | 68 } |
69 | 69 |
70 void ManagePasswordsTest::SetupAutomaticPassword() { | 70 void ManagePasswordsTest::SetupAutomaticPassword() { |
71 password_manager::StubPasswordManagerClient client; | 71 password_manager::StubPasswordManagerClient client; |
72 password_manager::StubLogManager log_manager; | 72 password_manager::StubLogManager log_manager; |
73 password_manager::StubPasswordManagerDriver driver; | 73 password_manager::StubPasswordManagerDriver driver; |
74 | 74 |
75 scoped_ptr<password_manager::PasswordFormManager> test_form_manager( | 75 scoped_ptr<password_manager::PasswordFormManager> test_form_manager( |
76 new password_manager::PasswordFormManager( | 76 new password_manager::PasswordFormManager( |
77 nullptr, &client, driver.AsWeakPtr(), *test_form(), false)); | 77 nullptr, &client, driver.AsWeakPtr(), *test_form(), false)); |
78 GetController()->OnAutomaticPasswordSave(test_form_manager.Pass()); | 78 GetController()->OnAutomaticPasswordSave(std::move(test_form_manager)); |
79 } | 79 } |
80 | 80 |
81 void ManagePasswordsTest::SetupChooseCredentials( | 81 void ManagePasswordsTest::SetupChooseCredentials( |
82 ScopedVector<autofill::PasswordForm> local_credentials, | 82 ScopedVector<autofill::PasswordForm> local_credentials, |
83 ScopedVector<autofill::PasswordForm> federated_credentials, | 83 ScopedVector<autofill::PasswordForm> federated_credentials, |
84 const GURL& origin) { | 84 const GURL& origin) { |
85 base::string16 kTestUsername = base::ASCIIToUTF16("test_username"); | 85 base::string16 kTestUsername = base::ASCIIToUTF16("test_username"); |
86 autofill::PasswordFormMap map; | 86 autofill::PasswordFormMap map; |
87 map.insert(std::make_pair( | 87 map.insert(std::make_pair( |
88 kTestUsername, | 88 kTestUsername, |
89 make_scoped_ptr(new autofill::PasswordForm(*test_form())))); | 89 make_scoped_ptr(new autofill::PasswordForm(*test_form())))); |
90 GetController()->OnChooseCredentials( | 90 GetController()->OnChooseCredentials( |
91 local_credentials.Pass(), federated_credentials.Pass(), origin, | 91 std::move(local_credentials), std::move(federated_credentials), origin, |
92 base::Bind(&ManagePasswordsTest::OnChooseCredential, this)); | 92 base::Bind(&ManagePasswordsTest::OnChooseCredential, this)); |
93 } | 93 } |
94 | 94 |
95 void ManagePasswordsTest::SetupAutoSignin( | 95 void ManagePasswordsTest::SetupAutoSignin( |
96 ScopedVector<autofill::PasswordForm> local_credentials) { | 96 ScopedVector<autofill::PasswordForm> local_credentials) { |
97 GetController()->OnAutoSignin(local_credentials.Pass()); | 97 GetController()->OnAutoSignin(std::move(local_credentials)); |
98 } | 98 } |
99 | 99 |
100 scoped_ptr<base::HistogramSamples> ManagePasswordsTest::GetSamples( | 100 scoped_ptr<base::HistogramSamples> ManagePasswordsTest::GetSamples( |
101 const char* histogram) { | 101 const char* histogram) { |
102 // Ensure that everything has been properly recorded before pulling samples. | 102 // Ensure that everything has been properly recorded before pulling samples. |
103 content::RunAllPendingInMessageLoop(); | 103 content::RunAllPendingInMessageLoop(); |
104 return histogram_tester_.GetHistogramSamplesSinceCreation(histogram).Pass(); | 104 return histogram_tester_.GetHistogramSamplesSinceCreation(histogram); |
105 } | 105 } |
106 | 106 |
107 PasswordsClientUIDelegate* ManagePasswordsTest::GetController() { | 107 PasswordsClientUIDelegate* ManagePasswordsTest::GetController() { |
108 return PasswordsClientUIDelegateFromWebContents( | 108 return PasswordsClientUIDelegateFromWebContents( |
109 browser()->tab_strip_model()->GetActiveWebContents()); | 109 browser()->tab_strip_model()->GetActiveWebContents()); |
110 } | 110 } |
OLD | NEW |