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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 void ManagePasswordsTest::SetupBlackistedPassword() { | 76 void ManagePasswordsTest::SetupBlackistedPassword() { |
77 base::string16 kTestUsername = base::ASCIIToUTF16("test_username"); | 77 base::string16 kTestUsername = base::ASCIIToUTF16("test_username"); |
78 autofill::PasswordFormMap map; | 78 autofill::PasswordFormMap map; |
79 map[kTestUsername] = test_form(); | 79 map[kTestUsername] = test_form(); |
80 GetController()->OnBlacklistBlockedAutofill(map); | 80 GetController()->OnBlacklistBlockedAutofill(map); |
81 GetController()->UpdateIconAndBubbleState(view()); | 81 GetController()->UpdateIconAndBubbleState(view()); |
82 } | 82 } |
83 | 83 |
84 void ManagePasswordsTest::SetupChooseCredentials( | 84 void ManagePasswordsTest::SetupChooseCredentials( |
85 ScopedVector<autofill::PasswordForm> local_credentials, | 85 ScopedVector<autofill::PasswordForm> local_credentials, |
86 ScopedVector<autofill::PasswordForm> federated_credentials) { | 86 ScopedVector<autofill::PasswordForm> federated_credentials, |
| 87 const GURL& origin) { |
87 base::string16 kTestUsername = base::ASCIIToUTF16("test_username"); | 88 base::string16 kTestUsername = base::ASCIIToUTF16("test_username"); |
88 autofill::PasswordFormMap map; | 89 autofill::PasswordFormMap map; |
89 map[kTestUsername] = test_form(); | 90 map[kTestUsername] = test_form(); |
90 GetController()->OnChooseCredentials( | 91 GetController()->OnChooseCredentials( |
91 local_credentials.Pass(), | 92 local_credentials.Pass(), federated_credentials.Pass(), origin, |
92 federated_credentials.Pass(), | |
93 base::Bind(&ManagePasswordsTest::OnChooseCredential, this)); | 93 base::Bind(&ManagePasswordsTest::OnChooseCredential, this)); |
94 GetController()->UpdateIconAndBubbleState(view()); | 94 GetController()->UpdateIconAndBubbleState(view()); |
95 } | 95 } |
96 | 96 |
97 base::HistogramSamples* ManagePasswordsTest::GetSamples( | 97 base::HistogramSamples* ManagePasswordsTest::GetSamples( |
98 const char* histogram) { | 98 const char* histogram) { |
99 // Ensure that everything has been properly recorded before pulling samples. | 99 // Ensure that everything has been properly recorded before pulling samples. |
100 content::RunAllPendingInMessageLoop(); | 100 content::RunAllPendingInMessageLoop(); |
101 return histogram_tester_.GetHistogramSamplesSinceCreation(histogram) | 101 return histogram_tester_.GetHistogramSamplesSinceCreation(histogram) |
102 .release(); | 102 .release(); |
103 } | 103 } |
104 | 104 |
105 ManagePasswordsUIController* ManagePasswordsTest::GetController() { | 105 ManagePasswordsUIController* ManagePasswordsTest::GetController() { |
106 return ManagePasswordsUIController::FromWebContents( | 106 return ManagePasswordsUIController::FromWebContents( |
107 browser()->tab_strip_model()->GetActiveWebContents()); | 107 browser()->tab_strip_model()->GetActiveWebContents()); |
108 } | 108 } |
OLD | NEW |