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

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

Issue 1846623002: Remove password-manager-reauthentication flag (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Just rebased Created 4 years, 8 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/password_manager_presenter.h" 5 #include "chrome/browser/ui/passwords/password_manager_presenter.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 30 matching lines...) Expand all
41 : profile_(profile), password_manager_presenter_(this) { 41 : profile_(profile), password_manager_presenter_(this) {
42 password_manager_presenter_.Initialize(); 42 password_manager_presenter_.Initialize();
43 } 43 }
44 ~MockPasswordUIView() override {} 44 ~MockPasswordUIView() override {}
45 Profile* GetProfile() override; 45 Profile* GetProfile() override;
46 #if !defined(OS_ANDROID) 46 #if !defined(OS_ANDROID)
47 gfx::NativeWindow GetNativeWindow() const override; 47 gfx::NativeWindow GetNativeWindow() const override;
48 #endif 48 #endif
49 MOCK_METHOD4(ShowPassword, void( 49 MOCK_METHOD4(ShowPassword, void(
50 size_t, const std::string&, const std::string&, const base::string16&)); 50 size_t, const std::string&, const std::string&, const base::string16&));
51 MOCK_METHOD2(SetPasswordList, 51 MOCK_METHOD1(SetPasswordList,
52 void(const std::vector<scoped_ptr<autofill::PasswordForm>>&, 52 void(const std::vector<scoped_ptr<autofill::PasswordForm>>&));
53 bool));
54 MOCK_METHOD1(SetPasswordExceptionList, 53 MOCK_METHOD1(SetPasswordExceptionList,
55 void(const std::vector<scoped_ptr<autofill::PasswordForm>>&)); 54 void(const std::vector<scoped_ptr<autofill::PasswordForm>>&));
56 PasswordManagerPresenter* GetPasswordManagerPresenter() { 55 PasswordManagerPresenter* GetPasswordManagerPresenter() {
57 return &password_manager_presenter_; 56 return &password_manager_presenter_;
58 } 57 }
59 58
60 private: 59 private:
61 Profile* profile_; 60 Profile* profile_;
62 PasswordManagerPresenter password_manager_presenter_; 61 PasswordManagerPresenter password_manager_presenter_;
63 62
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 } 169 }
171 } 170 }
172 } 171 }
173 } 172 }
174 173
175 namespace { 174 namespace {
176 175
177 TEST_F(PasswordManagerPresenterTest, UIControllerIsCalled) { 176 TEST_F(PasswordManagerPresenterTest, UIControllerIsCalled) {
178 EXPECT_CALL( 177 EXPECT_CALL(
179 *GetUIController(), 178 *GetUIController(),
180 SetPasswordList( 179 SetPasswordList(Property(
181 Property(&std::vector<scoped_ptr<autofill::PasswordForm>>::size, 180 &std::vector<scoped_ptr<autofill::PasswordForm>>::size, Eq(0u))));
182 Eq(0u)),
183 testing::_));
184 EXPECT_CALL( 181 EXPECT_CALL(
185 *GetUIController(), 182 *GetUIController(),
186 SetPasswordExceptionList(Property( 183 SetPasswordExceptionList(Property(
187 &std::vector<scoped_ptr<autofill::PasswordForm>>::size, Eq(0u)))); 184 &std::vector<scoped_ptr<autofill::PasswordForm>>::size, Eq(0u))));
188 UpdateLists(); 185 UpdateLists();
189 GURL pass_origin("http://abc1.com"); 186 GURL pass_origin("http://abc1.com");
190 AddPasswordEntry(pass_origin, "test@gmail.com", "test"); 187 AddPasswordEntry(pass_origin, "test@gmail.com", "test");
191 EXPECT_CALL( 188 EXPECT_CALL(
192 *GetUIController(), 189 *GetUIController(),
193 SetPasswordList( 190 SetPasswordList(Property(
194 Property(&std::vector<scoped_ptr<autofill::PasswordForm>>::size, 191 &std::vector<scoped_ptr<autofill::PasswordForm>>::size, Eq(1u))));
195 Eq(1u)),
196 testing::_));
197 EXPECT_CALL( 192 EXPECT_CALL(
198 *GetUIController(), 193 *GetUIController(),
199 SetPasswordExceptionList(Property( 194 SetPasswordExceptionList(Property(
200 &std::vector<scoped_ptr<autofill::PasswordForm>>::size, Eq(0u)))); 195 &std::vector<scoped_ptr<autofill::PasswordForm>>::size, Eq(0u))));
201 UpdateLists(); 196 UpdateLists();
202 GURL except_origin("http://abc2.com"); 197 GURL except_origin("http://abc2.com");
203 AddPasswordException(except_origin); 198 AddPasswordException(except_origin);
204 EXPECT_CALL( 199 EXPECT_CALL(
205 *GetUIController(), 200 *GetUIController(),
206 SetPasswordList( 201 SetPasswordList(Property(
207 Property(&std::vector<scoped_ptr<autofill::PasswordForm>>::size, 202 &std::vector<scoped_ptr<autofill::PasswordForm>>::size, Eq(1u))));
208 Eq(1u)),
209 testing::_));
210 EXPECT_CALL( 203 EXPECT_CALL(
211 *GetUIController(), 204 *GetUIController(),
212 SetPasswordExceptionList(Property( 205 SetPasswordExceptionList(Property(
213 &std::vector<scoped_ptr<autofill::PasswordForm>>::size, Eq(1u)))); 206 &std::vector<scoped_ptr<autofill::PasswordForm>>::size, Eq(1u))));
214 UpdateLists(); 207 UpdateLists();
215 GURL pass_origin2("http://example.com"); 208 GURL pass_origin2("http://example.com");
216 AddPasswordEntry(pass_origin2, "test@gmail.com", "test"); 209 AddPasswordEntry(pass_origin2, "test@gmail.com", "test");
217 EXPECT_CALL( 210 EXPECT_CALL(
218 *GetUIController(), 211 *GetUIController(),
219 SetPasswordList( 212 SetPasswordList(Property(
220 Property(&std::vector<scoped_ptr<autofill::PasswordForm>>::size, 213 &std::vector<scoped_ptr<autofill::PasswordForm>>::size, Eq(2u))));
221 Eq(2u)),
222 testing::_));
223 EXPECT_CALL( 214 EXPECT_CALL(
224 *GetUIController(), 215 *GetUIController(),
225 SetPasswordExceptionList(Property( 216 SetPasswordExceptionList(Property(
226 &std::vector<scoped_ptr<autofill::PasswordForm>>::size, Eq(1u)))); 217 &std::vector<scoped_ptr<autofill::PasswordForm>>::size, Eq(1u))));
227 UpdateLists(); 218 UpdateLists();
228 } 219 }
229 220
230 TEST_F(PasswordManagerPresenterTest, Sorting_DifferentOrigins) { 221 TEST_F(PasswordManagerPresenterTest, Sorting_DifferentOrigins) {
231 const SortEntry test_cases[] = { 222 const SortEntry test_cases[] = {
232 {"http://example-b.com", "user_a", "pwd", nullptr, 2}, 223 {"http://example-b.com", "user_a", "pwd", nullptr, 2},
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 {"android://hash@com.alpha", "user", "secret", "https://alpha.com", -1}, 273 {"android://hash@com.alpha", "user", "secret", "https://alpha.com", -1},
283 {"android://hash@com.alpha", "user", "secret", nullptr, 2}, 274 {"android://hash@com.alpha", "user", "secret", nullptr, 2},
284 275
285 {"android://hash@com.betta.android", "user", "secret", 276 {"android://hash@com.betta.android", "user", "secret",
286 "https://betta.com", 3}, 277 "https://betta.com", 3},
287 {"android://hash@com.betta.android", "user", "secret", nullptr, 4}}; 278 {"android://hash@com.betta.android", "user", "secret", nullptr, 4}};
288 SortAndCheckPositions(test_cases, arraysize(test_cases), true); 279 SortAndCheckPositions(test_cases, arraysize(test_cases), true);
289 } 280 }
290 281
291 } // namespace 282 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/ui/passwords/password_manager_presenter.cc ('k') | chrome/browser/ui/passwords/password_ui_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698