OLD | NEW |
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" |
11 #include "components/password_manager/sync/browser/sync_username_test_base.h" | 11 #include "components/password_manager/sync/browser/sync_username_test_base.h" |
12 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
13 | 13 |
14 using autofill::PasswordForm; | 14 using autofill::PasswordForm; |
15 | 15 |
16 namespace password_manager { | 16 namespace password_manager { |
17 namespace sync_util { | 17 namespace sync_util { |
18 | 18 |
19 typedef SyncUsernameTestBase PasswordSyncUtilTest; | 19 typedef SyncUsernameTestBase PasswordSyncUtilTest; |
20 | 20 |
21 TEST_F(PasswordSyncUtilTest, GetSyncUsernameIfSyncingPasswords) { | 21 TEST_F(PasswordSyncUtilTest, GetSyncUsernameIfSyncingPasswords) { |
22 const struct TestCase { | 22 const struct TestCase { |
23 enum { SYNCING_PASSWORDS, NOT_SYNCING_PASSWORDS } password_sync; | 23 enum { SYNCING_PASSWORDS, NOT_SYNCING_PASSWORDS } password_sync; |
24 std::string fake_sync_username; | 24 std::string fake_sync_username; |
25 std::string expected_result; | 25 std::string expected_result; |
26 const syncer::SyncService* sync_service; | 26 const sync_driver::SyncService* sync_service; |
27 const SigninManagerBase* signin_manager; | 27 const SigninManagerBase* signin_manager; |
28 } kTestCases[] = { | 28 } kTestCases[] = { |
29 {TestCase::NOT_SYNCING_PASSWORDS, "a@example.org", std::string(), | 29 {TestCase::NOT_SYNCING_PASSWORDS, "a@example.org", std::string(), |
30 sync_service(), signin_manager()}, | 30 sync_service(), signin_manager()}, |
31 | 31 |
32 {TestCase::SYNCING_PASSWORDS, "a@example.org", "a@example.org", | 32 {TestCase::SYNCING_PASSWORDS, "a@example.org", "a@example.org", |
33 sync_service(), signin_manager()}, | 33 sync_service(), signin_manager()}, |
34 | 34 |
35 // If sync_service is not available, we assume passwords are synced, even | 35 // If sync_service is not available, we assume passwords are synced, even |
36 // if they are not. | 36 // if they are not. |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 SetSyncingPasswords(true); | 75 SetSyncingPasswords(true); |
76 FakeSigninAs(kTestCases[i].fake_sync_username); | 76 FakeSigninAs(kTestCases[i].fake_sync_username); |
77 EXPECT_EQ(kTestCases[i].expected_result, | 77 EXPECT_EQ(kTestCases[i].expected_result, |
78 IsSyncAccountCredential(kTestCases[i].form, sync_service(), | 78 IsSyncAccountCredential(kTestCases[i].form, sync_service(), |
79 signin_manager())); | 79 signin_manager())); |
80 } | 80 } |
81 } | 81 } |
82 | 82 |
83 } // namespace sync_util | 83 } // namespace sync_util |
84 } // namespace password_manager | 84 } // namespace password_manager |
OLD | NEW |