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

Side by Side Diff: components/password_manager/sync/browser/password_sync_util_unittest.cc

Issue 2233833002: Accept empty username as sync username in IsSyncAccountCredential (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
« no previous file with comments | « components/password_manager/sync/browser/password_sync_util.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/sync/browser/password_sync_util.h" 5 #include "components/password_manager/sync/browser/password_sync_util.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "components/autofill/core/common/password_form.h" 10 #include "components/autofill/core/common/password_form.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 const struct { 59 const struct {
60 PasswordForm form; 60 PasswordForm form;
61 std::string fake_sync_username; 61 std::string fake_sync_username;
62 bool expected_result; 62 bool expected_result;
63 } kTestCases[] = { 63 } kTestCases[] = {
64 {SimpleGaiaForm("sync_user@example.org"), "sync_user@example.org", true}, 64 {SimpleGaiaForm("sync_user@example.org"), "sync_user@example.org", true},
65 {SimpleGaiaForm("non_sync_user@example.org"), "sync_user@example.org", 65 {SimpleGaiaForm("non_sync_user@example.org"), "sync_user@example.org",
66 false}, 66 false},
67 {SimpleNonGaiaForm("sync_user@example.org"), "sync_user@example.org", 67 {SimpleNonGaiaForm("sync_user@example.org"), "sync_user@example.org",
68 false}, 68 false},
69 {SimpleGaiaForm(""), "sync_user@example.org", true},
70 {SimpleNonGaiaForm(""), "sync_user@example.org", false},
69 }; 71 };
70 72
71 for (size_t i = 0; i < arraysize(kTestCases); ++i) { 73 for (size_t i = 0; i < arraysize(kTestCases); ++i) {
72 SCOPED_TRACE(testing::Message() << "i=" << i); 74 SCOPED_TRACE(testing::Message() << "i=" << i);
73 SetSyncingPasswords(true); 75 SetSyncingPasswords(true);
74 FakeSigninAs(kTestCases[i].fake_sync_username); 76 FakeSigninAs(kTestCases[i].fake_sync_username);
75 EXPECT_EQ(kTestCases[i].expected_result, 77 EXPECT_EQ(kTestCases[i].expected_result,
76 IsSyncAccountCredential(kTestCases[i].form, sync_service(), 78 IsSyncAccountCredential(kTestCases[i].form, sync_service(),
77 signin_manager())); 79 signin_manager()));
78 } 80 }
79 } 81 }
80 82
81 } // namespace sync_util 83 } // namespace sync_util
82 } // namespace password_manager 84 } // namespace password_manager
OLDNEW
« no previous file with comments | « components/password_manager/sync/browser/password_sync_util.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698