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 #import "chrome/browser/ui/cocoa/passwords/manage_passwords_bubble_blacklist_vie
w_controller.h" | 5 #import "chrome/browser/ui/cocoa/passwords/manage_passwords_bubble_blacklist_vie
w_controller.h" |
6 | 6 |
| 7 #include "base/memory/scoped_ptr.h" |
7 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
8 #include "chrome/browser/ui/cocoa/cocoa_test_helper.h" | 9 #include "chrome/browser/ui/cocoa/cocoa_test_helper.h" |
9 #import "chrome/browser/ui/cocoa/passwords/manage_passwords_bubble_blacklist_vie
w_controller.h" | 10 #import "chrome/browser/ui/cocoa/passwords/manage_passwords_bubble_blacklist_vie
w_controller.h" |
10 #include "chrome/browser/ui/cocoa/passwords/manage_passwords_controller_test.h" | 11 #include "chrome/browser/ui/cocoa/passwords/manage_passwords_controller_test.h" |
11 #include "chrome/browser/ui/passwords/manage_passwords_ui_controller_mock.h" | 12 #include "chrome/browser/ui/passwords/manage_passwords_ui_controller_mock.h" |
12 #include "components/password_manager/core/common/password_manager_ui.h" | 13 #include "components/password_manager/core/common/password_manager_ui.h" |
13 | 14 |
14 // Helper delegate for testing the blacklist view of the password management | 15 // Helper delegate for testing the blacklist view of the password management |
15 // bubble. | 16 // bubble. |
16 @interface ManagePasswordsBubbleBlacklistViewTestDelegate | 17 @interface ManagePasswordsBubbleBlacklistViewTestDelegate |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 TEST_F(ManagePasswordsBubbleBlacklistViewControllerTest, | 69 TEST_F(ManagePasswordsBubbleBlacklistViewControllerTest, |
69 ShouldDismissWhenDoneClicked) { | 70 ShouldDismissWhenDoneClicked) { |
70 NSButton* doneButton = controller().doneButton; | 71 NSButton* doneButton = controller().doneButton; |
71 [doneButton performClick:nil]; | 72 [doneButton performClick:nil]; |
72 EXPECT_TRUE(delegate().dismissed); | 73 EXPECT_TRUE(delegate().dismissed); |
73 } | 74 } |
74 | 75 |
75 TEST_F(ManagePasswordsBubbleBlacklistViewControllerTest, | 76 TEST_F(ManagePasswordsBubbleBlacklistViewControllerTest, |
76 ShouldDismissAndUnblacklistWhenUnblacklistClicked) { | 77 ShouldDismissAndUnblacklistWhenUnblacklistClicked) { |
77 // Unblacklisting requires passwords to exist for the site. | 78 // Unblacklisting requires passwords to exist for the site. |
78 autofill::PasswordForm form; | 79 scoped_ptr<autofill::PasswordForm> form(new autofill::PasswordForm); |
79 form.username_value = base::ASCIIToUTF16("username"); | 80 form->username_value = base::ASCIIToUTF16("username"); |
80 form.password_value = base::ASCIIToUTF16("password"); | 81 form->password_value = base::ASCIIToUTF16("password"); |
81 form.blacklisted_by_user = true; | 82 form->blacklisted_by_user = true; |
82 autofill::PasswordFormMap map; | 83 autofill::PasswordFormMap map; |
83 map[base::ASCIIToUTF16("username")] = &form; | 84 map.insert(base::ASCIIToUTF16("username"), form.Pass()); |
84 ui_controller()->OnBlacklistBlockedAutofill(map); | 85 ui_controller()->OnBlacklistBlockedAutofill(map); |
85 | 86 |
86 EXPECT_EQ(password_manager::ui::BLACKLIST_STATE, ui_controller()->state()); | 87 EXPECT_EQ(password_manager::ui::BLACKLIST_STATE, ui_controller()->state()); |
87 NSButton* undoButton = controller().undoBlacklistButton; | 88 NSButton* undoButton = controller().undoBlacklistButton; |
88 [undoButton performClick:nil]; | 89 [undoButton performClick:nil]; |
89 EXPECT_TRUE(delegate().dismissed); | 90 EXPECT_TRUE(delegate().dismissed); |
90 EXPECT_TRUE(ui_controller()->unblacklist_site()); | 91 EXPECT_TRUE(ui_controller()->unblacklist_site()); |
91 } | 92 } |
92 | 93 |
93 } // namespace | 94 } // namespace |
OLD | NEW |