| 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/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 8 #include "chrome/app/chrome_command_ids.h" | 9 #include "chrome/app/chrome_command_ids.h" |
| 9 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
| 10 #include "chrome/browser/ui/browser_command_controller.h" | 11 #include "chrome/browser/ui/browser_command_controller.h" |
| 11 #include "chrome/browser/ui/browser_window.h" | 12 #include "chrome/browser/ui/browser_window.h" |
| 12 #include "chrome/browser/ui/passwords/manage_passwords_ui_controller.h" | 13 #include "chrome/browser/ui/passwords/manage_passwords_ui_controller.h" |
| 13 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 14 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 14 #include "chrome/test/base/in_process_browser_test.h" | 15 #include "chrome/test/base/in_process_browser_test.h" |
| 15 #include "chrome/test/base/interactive_test_utils.h" | 16 #include "chrome/test/base/interactive_test_utils.h" |
| 16 #include "components/autofill/core/common/password_form.h" | 17 #include "components/autofill/core/common/password_form.h" |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 } | 74 } |
| 74 | 75 |
| 75 void ManagePasswordsTest::SetupBlackistedPassword() { | 76 void ManagePasswordsTest::SetupBlackistedPassword() { |
| 76 base::string16 kTestUsername = base::ASCIIToUTF16("test_username"); | 77 base::string16 kTestUsername = base::ASCIIToUTF16("test_username"); |
| 77 autofill::PasswordFormMap map; | 78 autofill::PasswordFormMap map; |
| 78 map[kTestUsername] = test_form(); | 79 map[kTestUsername] = test_form(); |
| 79 GetController()->OnBlacklistBlockedAutofill(map); | 80 GetController()->OnBlacklistBlockedAutofill(map); |
| 80 GetController()->UpdateIconAndBubbleState(view()); | 81 GetController()->UpdateIconAndBubbleState(view()); |
| 81 } | 82 } |
| 82 | 83 |
| 84 void ManagePasswordsTest::SetupChooseCredentials( |
| 85 ScopedVector<autofill::PasswordForm> local_credentials, |
| 86 ScopedVector<autofill::PasswordForm> federated_credentials) { |
| 87 base::string16 kTestUsername = base::ASCIIToUTF16("test_username"); |
| 88 autofill::PasswordFormMap map; |
| 89 map[kTestUsername] = test_form(); |
| 90 GetController()->OnChooseCredentials( |
| 91 local_credentials.Pass(), |
| 92 federated_credentials.Pass(), |
| 93 base::Bind(&ManagePasswordsTest::OnChooseCredential, this)); |
| 94 GetController()->UpdateIconAndBubbleState(view()); |
| 95 } |
| 96 |
| 83 base::HistogramSamples* ManagePasswordsTest::GetSamples( | 97 base::HistogramSamples* ManagePasswordsTest::GetSamples( |
| 84 const char* histogram) { | 98 const char* histogram) { |
| 85 // Ensure that everything has been properly recorded before pulling samples. | 99 // Ensure that everything has been properly recorded before pulling samples. |
| 86 content::RunAllPendingInMessageLoop(); | 100 content::RunAllPendingInMessageLoop(); |
| 87 return histogram_tester_.GetHistogramSamplesSinceCreation(histogram) | 101 return histogram_tester_.GetHistogramSamplesSinceCreation(histogram) |
| 88 .release(); | 102 .release(); |
| 89 } | 103 } |
| 90 | 104 |
| 91 ManagePasswordsUIController* ManagePasswordsTest::GetController() { | 105 ManagePasswordsUIController* ManagePasswordsTest::GetController() { |
| 92 return ManagePasswordsUIController::FromWebContents( | 106 return ManagePasswordsUIController::FromWebContents( |
| 93 browser()->tab_strip_model()->GetActiveWebContents()); | 107 browser()->tab_strip_model()->GetActiveWebContents()); |
| 94 } | 108 } |
| OLD | NEW |