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

Side by Side Diff: components/password_manager/core/browser/password_reuse_detector_unittest.cc

Issue 2912383004: Fill is_chrome_signin_password field in the password entry pings. (Closed)
Patch Set: address nparker's comments Created 3 years, 6 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "components/password_manager/core/browser/password_reuse_detector.h" 5 #include "components/password_manager/core/browser/password_reuse_detector.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 "https://evil.com", &mockConsumer); 202 "https://evil.com", &mockConsumer);
203 } 203 }
204 204
205 TEST(PasswordReuseDetectorTest, SyncPasswordReuseFound) { 205 TEST(PasswordReuseDetectorTest, SyncPasswordReuseFound) {
206 PasswordReuseDetector reuse_detector(nullptr); 206 PasswordReuseDetector reuse_detector(nullptr);
207 reuse_detector.OnGetPasswordStoreResults(GetForms(GetTestDomainsPasswords())); 207 reuse_detector.OnGetPasswordStoreResults(GetForms(GetTestDomainsPasswords()));
208 MockPasswordReuseDetectorConsumer mockConsumer; 208 MockPasswordReuseDetectorConsumer mockConsumer;
209 209
210 reuse_detector.SaveSyncPasswordHash(ASCIIToUTF16("sync_password")); 210 reuse_detector.SaveSyncPasswordHash(ASCIIToUTF16("sync_password"));
211 211
212 EXPECT_CALL(mockConsumer, OnReuseFound(ASCIIToUTF16("sync_password"), 212 EXPECT_CALL(mockConsumer,
213 "accounts.google.com", 1, 0)); 213 OnReuseFound(ASCIIToUTF16("sync_password"),
214 std::string(kSyncPasswordDomain), 1, 0));
214 reuse_detector.CheckReuse(ASCIIToUTF16("sync_password"), "https://evil.com", 215 reuse_detector.CheckReuse(ASCIIToUTF16("sync_password"), "https://evil.com",
215 &mockConsumer); 216 &mockConsumer);
216 } 217 }
217 218
218 TEST(PasswordReuseDetectorTest, SavedPasswordsReuseSyncPasswordAvailable) { 219 TEST(PasswordReuseDetectorTest, SavedPasswordsReuseSyncPasswordAvailable) {
219 // Check that reuse of saved passwords is detected also if the sync password 220 // Check that reuse of saved passwords is detected also if the sync password
220 // hash is saved. 221 // hash is saved.
221 PasswordReuseDetector reuse_detector(nullptr); 222 PasswordReuseDetector reuse_detector(nullptr);
222 reuse_detector.OnGetPasswordStoreResults(GetForms(GetTestDomainsPasswords())); 223 reuse_detector.OnGetPasswordStoreResults(GetForms(GetTestDomainsPasswords()));
223 MockPasswordReuseDetectorConsumer mockConsumer; 224 MockPasswordReuseDetectorConsumer mockConsumer;
(...skipping 12 matching lines...) Expand all
236 PrefRegistry::NO_REGISTRATION_FLAGS); 237 PrefRegistry::NO_REGISTRATION_FLAGS);
237 ASSERT_FALSE(prefs.HasPrefPath(prefs::kSyncPasswordHash)); 238 ASSERT_FALSE(prefs.HasPrefPath(prefs::kSyncPasswordHash));
238 PasswordReuseDetector reuse_detector(&prefs); 239 PasswordReuseDetector reuse_detector(&prefs);
239 reuse_detector.SaveSyncPasswordHash(ASCIIToUTF16("sync_password")); 240 reuse_detector.SaveSyncPasswordHash(ASCIIToUTF16("sync_password"));
240 EXPECT_TRUE(prefs.HasPrefPath(prefs::kSyncPasswordHash)); 241 EXPECT_TRUE(prefs.HasPrefPath(prefs::kSyncPasswordHash));
241 } 242 }
242 243
243 } // namespace 244 } // namespace
244 245
245 } // namespace password_manager 246 } // namespace password_manager
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698