Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(150)

Side by Side Diff: chrome/browser/ui/passwords/manage_passwords_bubble_model_unittest.cc

Issue 2253233005: Change ScopedVector to vector<unique_ptr> in the password's UI code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: android+ Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_bubble_model.h" 5 #include "chrome/browser/ui/passwords/manage_passwords_bubble_model.h"
6 6
7 #include <utility> 7 #include <utility>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 model_.reset( 165 model_.reset(
166 new ManagePasswordsBubbleModel(mock_delegate_->AsWeakPtr(), reason)); 166 new ManagePasswordsBubbleModel(mock_delegate_->AsWeakPtr(), reason));
167 ASSERT_TRUE(testing::Mock::VerifyAndClearExpectations(controller())); 167 ASSERT_TRUE(testing::Mock::VerifyAndClearExpectations(controller()));
168 EXPECT_CALL(*controller(), GetWebContents()).WillRepeatedly( 168 EXPECT_CALL(*controller(), GetWebContents()).WillRepeatedly(
169 Return(test_web_contents_.get())); 169 Return(test_web_contents_.get()));
170 } 170 }
171 171
172 void ManagePasswordsBubbleModelTest::PretendPasswordWaiting() { 172 void ManagePasswordsBubbleModelTest::PretendPasswordWaiting() {
173 autofill::PasswordForm form = GetPendingPassword(); 173 autofill::PasswordForm form = GetPendingPassword();
174 EXPECT_CALL(*controller(), GetPendingPassword()).WillOnce(ReturnRef(form)); 174 EXPECT_CALL(*controller(), GetPendingPassword()).WillOnce(ReturnRef(form));
175 std::vector<const autofill::PasswordForm*> forms;
176 EXPECT_CALL(*controller(), GetCurrentForms()).WillOnce(ReturnRef(forms));
177 password_manager::InteractionsStats stats = GetTestStats(); 175 password_manager::InteractionsStats stats = GetTestStats();
178 EXPECT_CALL(*controller(), GetCurrentInteractionStats()) 176 EXPECT_CALL(*controller(), GetCurrentInteractionStats())
179 .WillOnce(Return(&stats)); 177 .WillOnce(Return(&stats));
180 SetUpWithState(password_manager::ui::PENDING_PASSWORD_STATE, 178 SetUpWithState(password_manager::ui::PENDING_PASSWORD_STATE,
181 ManagePasswordsBubbleModel::AUTOMATIC); 179 ManagePasswordsBubbleModel::AUTOMATIC);
182 } 180 }
183 181
184 void ManagePasswordsBubbleModelTest::PretendUpdatePasswordWaiting() { 182 void ManagePasswordsBubbleModelTest::PretendUpdatePasswordWaiting() {
185 autofill::PasswordForm form = GetPendingPassword(); 183 autofill::PasswordForm form = GetPendingPassword();
186 EXPECT_CALL(*controller(), GetPendingPassword()).WillOnce(ReturnRef(form)); 184 EXPECT_CALL(*controller(), GetPendingPassword()).WillOnce(ReturnRef(form));
187 std::vector<const autofill::PasswordForm*> forms; 185 std::vector<std::unique_ptr<autofill::PasswordForm>> forms;
188 EXPECT_CALL(*controller(), GetCurrentForms()).WillOnce(ReturnRef(forms)); 186 EXPECT_CALL(*controller(), GetCurrentForms()).WillOnce(ReturnRef(forms));
189 EXPECT_CALL(*controller(), IsPasswordOverridden()).WillOnce(Return(false)); 187 EXPECT_CALL(*controller(), IsPasswordOverridden()).WillOnce(Return(false));
190 SetUpWithState(password_manager::ui::PENDING_PASSWORD_UPDATE_STATE, 188 SetUpWithState(password_manager::ui::PENDING_PASSWORD_UPDATE_STATE,
191 ManagePasswordsBubbleModel::AUTOMATIC); 189 ManagePasswordsBubbleModel::AUTOMATIC);
192 } 190 }
193 191
194 void ManagePasswordsBubbleModelTest::PretendAutoSigningIn() { 192 void ManagePasswordsBubbleModelTest::PretendAutoSigningIn() {
195 autofill::PasswordForm form = GetPendingPassword(); 193 autofill::PasswordForm form = GetPendingPassword();
196 EXPECT_CALL(*controller(), GetPendingPassword()).WillOnce(ReturnRef(form)); 194 EXPECT_CALL(*controller(), GetPendingPassword()).WillOnce(ReturnRef(form));
197 SetUpWithState(password_manager::ui::AUTO_SIGNIN_STATE, 195 SetUpWithState(password_manager::ui::AUTO_SIGNIN_STATE,
198 ManagePasswordsBubbleModel::AUTOMATIC); 196 ManagePasswordsBubbleModel::AUTOMATIC);
199 } 197 }
200 198
201 void ManagePasswordsBubbleModelTest::PretendManagingPasswords() { 199 void ManagePasswordsBubbleModelTest::PretendManagingPasswords() {
202 autofill::PasswordForm form = GetPendingPassword(); 200 std::vector<std::unique_ptr<autofill::PasswordForm>> forms(1);
203 std::vector<const autofill::PasswordForm*> forms(1, &form); 201 forms[0].reset(new autofill::PasswordForm(GetPendingPassword()));
204 EXPECT_CALL(*controller(), GetCurrentForms()).WillOnce(ReturnRef(forms)); 202 EXPECT_CALL(*controller(), GetCurrentForms()).WillOnce(ReturnRef(forms));
205 SetUpWithState(password_manager::ui::MANAGE_STATE, 203 SetUpWithState(password_manager::ui::MANAGE_STATE,
206 ManagePasswordsBubbleModel::USER_ACTION); 204 ManagePasswordsBubbleModel::USER_ACTION);
207 } 205 }
208 206
209 void ManagePasswordsBubbleModelTest::DestroyModel() { 207 void ManagePasswordsBubbleModelTest::DestroyModel() {
210 EXPECT_CALL(*controller(), OnBubbleHidden()); 208 EXPECT_CALL(*controller(), OnBubbleHidden());
211 model_.reset(); 209 model_.reset();
212 ASSERT_TRUE(testing::Mock::VerifyAndClearExpectations(controller())); 210 ASSERT_TRUE(testing::Mock::VerifyAndClearExpectations(controller()));
213 } 211 }
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after
563 ManageLinkTarget::SETTINGS_PAGE}, 561 ManageLinkTarget::SETTINGS_PAGE},
564 {nullptr, SmartLockStatus::DISABLE, ManageLinkTarget::SETTINGS_PAGE}, 562 {nullptr, SmartLockStatus::DISABLE, ManageLinkTarget::SETTINGS_PAGE},
565 {"Default", SmartLockStatus::DISABLE, ManageLinkTarget::SETTINGS_PAGE}, 563 {"Default", SmartLockStatus::DISABLE, ManageLinkTarget::SETTINGS_PAGE},
566 }; 564 };
567 565
568 } // namespace 566 } // namespace
569 567
570 INSTANTIATE_TEST_CASE_P(Default, 568 INSTANTIATE_TEST_CASE_P(Default,
571 ManagePasswordsBubbleModelManageLinkTest, 569 ManagePasswordsBubbleModelManageLinkTest,
572 ::testing::ValuesIn(kManageLinkTestCases)); 570 ::testing::ValuesIn(kManageLinkTestCases));
OLDNEW
« no previous file with comments | « chrome/browser/ui/passwords/manage_passwords_bubble_model.cc ('k') | chrome/browser/ui/passwords/manage_passwords_state.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698