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/views/passwords/manage_passwords_view_test.h" | 5 #include "chrome/browser/ui/views/passwords/manage_passwords_view_test.h" |
6 | 6 |
7 #include "base/test/statistics_delta_reader.h" | 7 #include "base/test/statistics_delta_reader.h" |
8 #include "chrome/app/chrome_command_ids.h" | 8 #include "chrome/app/chrome_command_ids.h" |
9 #include "chrome/browser/ui/browser.h" | 9 #include "chrome/browser/ui/browser.h" |
10 #include "chrome/browser/ui/browser_command_controller.h" | 10 #include "chrome/browser/ui/browser_command_controller.h" |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 controller()->OnPasswordAutofilled(map); | 63 controller()->OnPasswordAutofilled(map); |
64 controller()->UpdateIconAndBubbleState(view()); | 64 controller()->UpdateIconAndBubbleState(view()); |
65 } | 65 } |
66 | 66 |
67 void ManagePasswordsViewTest::SetupPendingPassword() { | 67 void ManagePasswordsViewTest::SetupPendingPassword() { |
68 password_manager::StubPasswordManagerClient client; | 68 password_manager::StubPasswordManagerClient client; |
69 password_manager::StubPasswordManagerDriver driver; | 69 password_manager::StubPasswordManagerDriver driver; |
70 scoped_ptr<password_manager::PasswordFormManager> test_form_manager( | 70 scoped_ptr<password_manager::PasswordFormManager> test_form_manager( |
71 new password_manager::PasswordFormManager( | 71 new password_manager::PasswordFormManager( |
72 NULL, &client, &driver, *test_form(), false)); | 72 NULL, &client, &driver, *test_form(), false)); |
73 controller()->OnPasswordSubmitted(test_form_manager.release()); | 73 controller()->OnPasswordSubmitted(test_form_manager.Pass()); |
74 | 74 |
75 // Wait for the command execution triggered by the automatic popup to pop up | 75 // Wait for the command execution triggered by the automatic popup to pop up |
76 // the bubble. | 76 // the bubble. |
| 77 content::RunAllPendingInMessageLoop(); |
| 78 controller()->UpdateIconAndBubbleState(view()); |
| 79 } |
| 80 |
| 81 void ManagePasswordsViewTest::SetupAutomaticPassword() { |
| 82 password_manager::StubPasswordManagerClient client; |
| 83 password_manager::StubPasswordManagerDriver driver; |
| 84 scoped_ptr<password_manager::PasswordFormManager> test_form_manager( |
| 85 new password_manager::PasswordFormManager( |
| 86 NULL, &client, &driver, *test_form(), false)); |
| 87 controller()->OnAutomaticPasswordSave(test_form_manager.Pass()); |
| 88 |
| 89 // Wait for the command execution triggered by the automatic popup to pop up |
| 90 // the bubble. |
77 content::RunAllPendingInMessageLoop(); | 91 content::RunAllPendingInMessageLoop(); |
78 controller()->UpdateIconAndBubbleState(view()); | 92 controller()->UpdateIconAndBubbleState(view()); |
79 } | 93 } |
80 | 94 |
81 void ManagePasswordsViewTest::SetupBlackistedPassword() { | 95 void ManagePasswordsViewTest::SetupBlackistedPassword() { |
82 base::string16 kTestUsername = base::ASCIIToUTF16("test_username"); | 96 base::string16 kTestUsername = base::ASCIIToUTF16("test_username"); |
83 autofill::PasswordFormMap map; | 97 autofill::PasswordFormMap map; |
84 map[kTestUsername] = test_form(); | 98 map[kTestUsername] = test_form(); |
85 controller()->OnBlacklistBlockedAutofill(map); | 99 controller()->OnBlacklistBlockedAutofill(map); |
86 controller()->UpdateIconAndBubbleState(view()); | 100 controller()->UpdateIconAndBubbleState(view()); |
87 } | 101 } |
88 | 102 |
89 base::HistogramSamples* ManagePasswordsViewTest::GetSamples( | 103 base::HistogramSamples* ManagePasswordsViewTest::GetSamples( |
90 const char* histogram) { | 104 const char* histogram) { |
91 // Ensure that everything has been properly recorded before pulling samples. | 105 // Ensure that everything has been properly recorded before pulling samples. |
92 content::RunAllPendingInMessageLoop(); | 106 content::RunAllPendingInMessageLoop(); |
93 return statistics_reader_.GetHistogramSamplesSinceCreation( | 107 return statistics_reader_.GetHistogramSamplesSinceCreation( |
94 histogram).release(); | 108 histogram).release(); |
95 } | 109 } |
OLD | NEW |