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

Side by Side Diff: chrome/browser/ui/cocoa/passwords/base_passwords_controller_test.mm

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: Mac 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/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
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; 60 std::vector<std::unique_ptr<autofill::PasswordForm>> forms;
61 EXPECT_CALL(*ui_controller_, GetCurrentForms()).WillOnce(ReturnRef(forms)); 61 EXPECT_CALL(*ui_controller_, GetCurrentForms()).WillOnce(ReturnRef(forms));
62 GURL origin(kSiteOrigin); 62 GURL origin(kSiteOrigin);
63 EXPECT_CALL(*ui_controller_, GetOrigin()).WillOnce(ReturnRef(origin)); 63 EXPECT_CALL(*ui_controller_, GetOrigin()).WillOnce(ReturnRef(origin));
64 EXPECT_CALL(*ui_controller_, GetState()) 64 EXPECT_CALL(*ui_controller_, GetState())
65 .WillOnce(Return(password_manager::ui::PENDING_PASSWORD_STATE)); 65 .WillOnce(Return(password_manager::ui::PENDING_PASSWORD_STATE));
66 GetModelAndCreateIfNull(); 66 GetModelAndCreateIfNull();
67 ASSERT_TRUE(testing::Mock::VerifyAndClearExpectations(ui_controller_.get())); 67 ASSERT_TRUE(testing::Mock::VerifyAndClearExpectations(ui_controller_.get()));
68 } 68 }
69 69
70 void ManagePasswordsControllerTest::SetUpUpdatePendingState( 70 void ManagePasswordsControllerTest::SetUpUpdatePendingState(
71 bool multiple_forms) { 71 bool multiple_forms) {
72 autofill::PasswordForm form; 72 autofill::PasswordForm form;
73 EXPECT_CALL(*ui_controller_, GetPendingPassword()).WillOnce(ReturnRef(form)); 73 EXPECT_CALL(*ui_controller_, GetPendingPassword()).WillOnce(ReturnRef(form));
74 std::vector<const autofill::PasswordForm*> forms; 74 std::vector<std::unique_ptr<autofill::PasswordForm>> forms;
75 forms.push_back(&form); 75 forms.push_back(base::WrapUnique(new autofill::PasswordForm(form)));
vabr (Chromium) 2016/08/18 18:39:19 nit: Please use base::MakeUnique<autofill::Passwor
vasilii 2016/08/19 09:52:30 Done.
76 if (multiple_forms) { 76 if (multiple_forms) {
77 forms.push_back(&form); 77 forms.push_back(base::WrapUnique(new autofill::PasswordForm(form)));
78 } 78 }
79 EXPECT_CALL(*ui_controller_, GetCurrentForms()).WillOnce(ReturnRef(forms)); 79 EXPECT_CALL(*ui_controller_, GetCurrentForms()).WillOnce(ReturnRef(forms));
80 GURL origin(kSiteOrigin); 80 GURL origin(kSiteOrigin);
81 EXPECT_CALL(*ui_controller_, GetOrigin()).WillOnce(ReturnRef(origin)); 81 EXPECT_CALL(*ui_controller_, GetOrigin()).WillOnce(ReturnRef(origin));
82 EXPECT_CALL(*ui_controller_, GetState()) 82 EXPECT_CALL(*ui_controller_, GetState())
83 .WillOnce(Return(password_manager::ui::PENDING_PASSWORD_UPDATE_STATE)); 83 .WillOnce(Return(password_manager::ui::PENDING_PASSWORD_UPDATE_STATE));
84 GetModelAndCreateIfNull(); 84 GetModelAndCreateIfNull();
85 ASSERT_TRUE(testing::Mock::VerifyAndClearExpectations(ui_controller_.get())); 85 ASSERT_TRUE(testing::Mock::VerifyAndClearExpectations(ui_controller_.get()));
86 } 86 }
87 87
(...skipping 28 matching lines...) Expand all
116 @synthesize dismissed = _dismissed; 116 @synthesize dismissed = _dismissed;
117 117
118 - (void)viewShouldDismiss { 118 - (void)viewShouldDismiss {
119 _dismissed = YES; 119 _dismissed = YES;
120 } 120 }
121 121
122 - (void)refreshBubble { 122 - (void)refreshBubble {
123 } 123 }
124 124
125 @end 125 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698