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/cocoa/passwords/base_passwords_controller_test.h" | 5 #include "chrome/browser/ui/cocoa/passwords/base_passwords_controller_test.h" |
6 | 6 |
7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
8 #include "chrome/browser/password_manager/password_store_factory.h" | 8 #include "chrome/browser/password_manager/password_store_factory.h" |
9 #include "components/password_manager/core/browser/mock_password_store.h" | 9 #include "components/password_manager/core/browser/mock_password_store.h" |
10 #include "components/password_manager/core/browser/password_manager_test_utils.h
" | 10 #include "components/password_manager/core/browser/password_manager_test_utils.h
" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 } | 50 } |
51 return model_.get(); | 51 return model_.get(); |
52 } | 52 } |
53 | 53 |
54 void ManagePasswordsControllerTest::SetUpSavePendingState(bool empty_username) { | 54 void ManagePasswordsControllerTest::SetUpSavePendingState(bool empty_username) { |
55 autofill::PasswordForm form; | 55 autofill::PasswordForm form; |
56 if (!empty_username) { | 56 if (!empty_username) { |
57 form.username_value = base::ASCIIToUTF16("username"); | 57 form.username_value = base::ASCIIToUTF16("username"); |
58 } | 58 } |
59 EXPECT_CALL(*ui_controller_, GetPendingPassword()).WillOnce(ReturnRef(form)); | 59 EXPECT_CALL(*ui_controller_, GetPendingPassword()).WillOnce(ReturnRef(form)); |
60 std::vector<const autofill::PasswordForm*> forms; | |
61 EXPECT_CALL(*ui_controller_, GetCurrentForms()).WillOnce(ReturnRef(forms)); | |
62 GURL origin(kSiteOrigin); | 60 GURL origin(kSiteOrigin); |
63 EXPECT_CALL(*ui_controller_, GetOrigin()).WillOnce(ReturnRef(origin)); | 61 EXPECT_CALL(*ui_controller_, GetOrigin()).WillOnce(ReturnRef(origin)); |
64 EXPECT_CALL(*ui_controller_, GetState()) | 62 EXPECT_CALL(*ui_controller_, GetState()) |
65 .WillOnce(Return(password_manager::ui::PENDING_PASSWORD_STATE)); | 63 .WillOnce(Return(password_manager::ui::PENDING_PASSWORD_STATE)); |
66 GetModelAndCreateIfNull(); | 64 GetModelAndCreateIfNull(); |
67 ASSERT_TRUE(testing::Mock::VerifyAndClearExpectations(ui_controller_.get())); | 65 ASSERT_TRUE(testing::Mock::VerifyAndClearExpectations(ui_controller_.get())); |
68 } | 66 } |
69 | 67 |
70 void ManagePasswordsControllerTest::SetUpUpdatePendingState( | 68 void ManagePasswordsControllerTest::SetUpUpdatePendingState( |
71 bool multiple_forms) { | 69 bool multiple_forms) { |
72 autofill::PasswordForm form; | 70 autofill::PasswordForm form; |
73 EXPECT_CALL(*ui_controller_, GetPendingPassword()).WillOnce(ReturnRef(form)); | 71 EXPECT_CALL(*ui_controller_, GetPendingPassword()).WillOnce(ReturnRef(form)); |
74 std::vector<const autofill::PasswordForm*> forms; | 72 std::vector<std::unique_ptr<autofill::PasswordForm>> forms; |
75 forms.push_back(&form); | 73 forms.push_back(base::MakeUnique<autofill::PasswordForm>(form)); |
76 if (multiple_forms) { | 74 if (multiple_forms) { |
77 forms.push_back(&form); | 75 forms.push_back(base::MakeUnique<autofill::PasswordForm>(form)); |
78 } | 76 } |
79 EXPECT_CALL(*ui_controller_, GetCurrentForms()).WillOnce(ReturnRef(forms)); | 77 EXPECT_CALL(*ui_controller_, GetCurrentForms()).WillOnce(ReturnRef(forms)); |
80 GURL origin(kSiteOrigin); | 78 GURL origin(kSiteOrigin); |
81 EXPECT_CALL(*ui_controller_, GetOrigin()).WillOnce(ReturnRef(origin)); | 79 EXPECT_CALL(*ui_controller_, GetOrigin()).WillOnce(ReturnRef(origin)); |
82 EXPECT_CALL(*ui_controller_, GetState()) | 80 EXPECT_CALL(*ui_controller_, GetState()) |
83 .WillOnce(Return(password_manager::ui::PENDING_PASSWORD_UPDATE_STATE)); | 81 .WillOnce(Return(password_manager::ui::PENDING_PASSWORD_UPDATE_STATE)); |
84 GetModelAndCreateIfNull(); | 82 GetModelAndCreateIfNull(); |
85 ASSERT_TRUE(testing::Mock::VerifyAndClearExpectations(ui_controller_.get())); | 83 ASSERT_TRUE(testing::Mock::VerifyAndClearExpectations(ui_controller_.get())); |
86 } | 84 } |
87 | 85 |
(...skipping 28 matching lines...) Expand all Loading... |
116 @synthesize dismissed = _dismissed; | 114 @synthesize dismissed = _dismissed; |
117 | 115 |
118 - (void)viewShouldDismiss { | 116 - (void)viewShouldDismiss { |
119 _dismissed = YES; | 117 _dismissed = YES; |
120 } | 118 } |
121 | 119 |
122 - (void)refreshBubble { | 120 - (void)refreshBubble { |
123 } | 121 } |
124 | 122 |
125 @end | 123 @end |
OLD | NEW |