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

Side by Side Diff: components/password_manager/sync/browser/sync_username_test_base.h

Issue 2388673002: Revert of [Sync] Move //components/sync to the syncer namespace. (patchset #5 id:40001 of https://co (Closed)
Patch Set: Created 4 years, 2 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 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 // A base test fixture for mocking sync and signin infrastructure. Used for 5 // A base test fixture for mocking sync and signin infrastructure. Used for
6 // testing sync-related code. 6 // testing sync-related code.
7 7
8 #ifndef COMPONENTS_PASSWORD_MANAGER_SYNC_BROWSER_SYNC_USERNAME_TEST_BASE_H_ 8 #ifndef COMPONENTS_PASSWORD_MANAGER_SYNC_BROWSER_SYNC_USERNAME_TEST_BASE_H_
9 #define COMPONENTS_PASSWORD_MANAGER_SYNC_BROWSER_SYNC_USERNAME_TEST_BASE_H_ 9 #define COMPONENTS_PASSWORD_MANAGER_SYNC_BROWSER_SYNC_USERNAME_TEST_BASE_H_
10 10
11 #include <string>
12
13 #include "components/autofill/core/common/password_form.h" 11 #include "components/autofill/core/common/password_form.h"
14 #include "components/pref_registry/testing_pref_service_syncable.h" 12 #include "components/pref_registry/testing_pref_service_syncable.h"
15 #include "components/signin/core/browser/account_tracker_service.h" 13 #include "components/signin/core/browser/account_tracker_service.h"
16 #include "components/signin/core/browser/signin_manager_base.h" 14 #include "components/signin/core/browser/signin_manager_base.h"
17 #include "components/signin/core/browser/test_signin_client.h" 15 #include "components/signin/core/browser/test_signin_client.h"
18 #include "components/sync/base/model_type.h" 16 #include "components/sync/base/model_type.h"
19 #include "components/sync/driver/fake_sync_service.h" 17 #include "components/sync/driver/fake_sync_service.h"
20 #include "testing/gtest/include/gtest/gtest.h" 18 #include "testing/gtest/include/gtest/gtest.h"
21 19
22 namespace password_manager { 20 namespace password_manager {
23 21
24 class SyncUsernameTestBase : public testing::Test { 22 class SyncUsernameTestBase : public testing::Test {
25 public: 23 public:
26 SyncUsernameTestBase(); 24 SyncUsernameTestBase();
27 ~SyncUsernameTestBase() override; 25 ~SyncUsernameTestBase() override;
28 26
29 // Instruct the signin manager to sign in with |email| or out. 27 // Instruct the signin manager to sign in with |email| or out.
30 void FakeSigninAs(const std::string& email); 28 void FakeSigninAs(const std::string& email);
31 void FakeSignout(); 29 void FakeSignout();
32 30
33 // Produce a sample PasswordForm. 31 // Produce a sample PasswordForm.
34 static autofill::PasswordForm SimpleGaiaForm(const char* username); 32 static autofill::PasswordForm SimpleGaiaForm(const char* username);
35 static autofill::PasswordForm SimpleNonGaiaForm(const char* username); 33 static autofill::PasswordForm SimpleNonGaiaForm(const char* username);
36 34
37 // Instruct the sync service to pretend whether or not it is syncing 35 // Instruct the sync service to pretend whether or not it is syncing
38 // passwords. 36 // passwords.
39 void SetSyncingPasswords(bool syncing_passwords); 37 void SetSyncingPasswords(bool syncing_passwords);
40 38
41 const syncer::SyncService* sync_service() const { return &sync_service_; } 39 const sync_driver::SyncService* sync_service() const {
40 return &sync_service_;
41 }
42 42
43 const SigninManagerBase* signin_manager() { return &signin_manager_; } 43 const SigninManagerBase* signin_manager() { return &signin_manager_; }
44 44
45 private: 45 private:
46 class LocalFakeSyncService : public syncer::FakeSyncService { 46 class LocalFakeSyncService : public sync_driver::FakeSyncService {
47 public: 47 public:
48 LocalFakeSyncService(); 48 LocalFakeSyncService();
49 ~LocalFakeSyncService() override; 49 ~LocalFakeSyncService() override;
50 50
51 // syncer::SyncService: 51 // sync_driver::SyncService:
52 syncer::ModelTypeSet GetPreferredDataTypes() const override; 52 syncer::ModelTypeSet GetPreferredDataTypes() const override;
53 53
54 void set_syncing_passwords(bool syncing_passwords) { 54 void set_syncing_passwords(bool syncing_passwords) {
55 syncing_passwords_ = syncing_passwords; 55 syncing_passwords_ = syncing_passwords;
56 } 56 }
57 57
58 private: 58 private:
59 bool syncing_passwords_; 59 bool syncing_passwords_;
60 }; 60 };
61 61
62 class FakeSigninManagerBase : public SigninManagerBase { 62 class FakeSigninManagerBase : public SigninManagerBase {
63 public: 63 public:
64 FakeSigninManagerBase(SigninClient* client, 64 FakeSigninManagerBase(SigninClient* client,
65 AccountTrackerService* account_tracker_service) 65 AccountTrackerService* account_tracker_service)
66 : SigninManagerBase(client, account_tracker_service) {} 66 : SigninManagerBase(client, account_tracker_service) {}
67 67
68 using SigninManagerBase::clear_authenticated_user; 68 using SigninManagerBase::clear_authenticated_user;
69 }; 69 };
70 70
71 user_prefs::TestingPrefServiceSyncable prefs_; 71 user_prefs::TestingPrefServiceSyncable prefs_;
72 TestSigninClient signin_client_; 72 TestSigninClient signin_client_;
73 AccountTrackerService account_tracker_; 73 AccountTrackerService account_tracker_;
74 FakeSigninManagerBase signin_manager_; 74 FakeSigninManagerBase signin_manager_;
75 LocalFakeSyncService sync_service_; 75 LocalFakeSyncService sync_service_;
76 }; 76 };
77 77
78 } // namespace password_manager 78 } // namespace password_manager
79 79
80 #endif // COMPONENTS_PASSWORD_MANAGER_SYNC_BROWSER_SYNC_USERNAME_TEST_BASE_H_ 80 #endif // COMPONENTS_PASSWORD_MANAGER_SYNC_BROWSER_SYNC_USERNAME_TEST_BASE_H_
OLDNEW
« no previous file with comments | « components/password_manager/sync/browser/sync_credentials_filter.h ('k') | components/precache/content/precache_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698