| 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 "base/prefs/pref_registry_simple.h" | 5 #include "base/prefs/pref_registry_simple.h" |
| 6 #include "base/prefs/testing_pref_service.h" | 6 #include "base/prefs/testing_pref_service.h" |
| 7 #include "components/autofill/core/browser/autofill_test_utils.h" | 7 #include "components/autofill/core/browser/autofill_test_utils.h" |
| 8 #include "components/autofill/core/browser/options_util.h" | 8 #include "components/autofill/core/browser/options_util.h" |
| 9 #include "components/autofill/core/browser/test_personal_data_manager.h" | 9 #include "components/autofill/core/browser/test_personal_data_manager.h" |
| 10 #include "components/autofill/core/common/autofill_pref_names.h" | 10 #include "components/autofill/core/common/autofill_pref_names.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 class SyncServiceMock : public sync_driver::SyncService { | 22 class SyncServiceMock : public sync_driver::SyncService { |
| 23 public: | 23 public: |
| 24 MOCK_CONST_METHOD0(HasSyncSetupCompleted, bool()); | 24 MOCK_CONST_METHOD0(HasSyncSetupCompleted, bool()); |
| 25 MOCK_CONST_METHOD0(IsSyncActive, bool()); | 25 MOCK_CONST_METHOD0(IsSyncActive, bool()); |
| 26 MOCK_CONST_METHOD0(IsSyncAllowed, bool()); | 26 MOCK_CONST_METHOD0(IsSyncAllowed, bool()); |
| 27 MOCK_CONST_METHOD0(GetActiveDataTypes, syncer::ModelTypeSet()); | 27 MOCK_CONST_METHOD0(GetActiveDataTypes, syncer::ModelTypeSet()); |
| 28 MOCK_METHOD1(AddObserver, void(sync_driver::SyncServiceObserver*)); | 28 MOCK_METHOD1(AddObserver, void(sync_driver::SyncServiceObserver*)); |
| 29 MOCK_METHOD1(RemoveObserver, void(sync_driver::SyncServiceObserver*)); | 29 MOCK_METHOD1(RemoveObserver, void(sync_driver::SyncServiceObserver*)); |
| 30 MOCK_CONST_METHOD1(HasObserver, | 30 MOCK_CONST_METHOD1(HasObserver, |
| 31 bool(const sync_driver::SyncServiceObserver*)); | 31 bool(const sync_driver::SyncServiceObserver*)); |
| 32 MOCK_METHOD0(IsSyncEnabledAndLoggedIn, bool()); | 32 MOCK_CONST_METHOD0(CanSyncStart, bool()); |
| 33 MOCK_METHOD0(DisableForUser, void()); | 33 MOCK_METHOD0(DisableForUser, void()); |
| 34 MOCK_METHOD0(RequestStop, void()); | 34 MOCK_METHOD0(RequestStop, void()); |
| 35 MOCK_METHOD0(RequestStart, void()); | 35 MOCK_METHOD0(RequestStart, void()); |
| 36 MOCK_CONST_METHOD0(GetPreferredDataTypes, syncer::ModelTypeSet()); | 36 MOCK_CONST_METHOD0(GetPreferredDataTypes, syncer::ModelTypeSet()); |
| 37 MOCK_METHOD2(OnUserChoseDatatypes, | 37 MOCK_METHOD2(OnUserChoseDatatypes, |
| 38 void(bool sync_everything, syncer::ModelTypeSet chosen_types)); | 38 void(bool sync_everything, syncer::ModelTypeSet chosen_types)); |
| 39 MOCK_METHOD0(SetSyncSetupCompleted, void()); | 39 MOCK_METHOD0(SetSyncSetupCompleted, void()); |
| 40 MOCK_CONST_METHOD0(FirstSetupInProgress, bool()); | 40 MOCK_CONST_METHOD0(FirstSetupInProgress, bool()); |
| 41 MOCK_METHOD1(SetSetupInProgress, void(bool)); | 41 MOCK_METHOD1(SetSetupInProgress, void(bool)); |
| 42 MOCK_CONST_METHOD0(setup_in_progress, bool()); | 42 MOCK_CONST_METHOD0(setup_in_progress, bool()); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 65 ON_CALL(*sync, IsSyncAllowed()).WillByDefault(Return(true)); | 65 ON_CALL(*sync, IsSyncAllowed()).WillByDefault(Return(true)); |
| 66 | 66 |
| 67 syncer::ModelTypeSet type_set; | 67 syncer::ModelTypeSet type_set; |
| 68 if (has_autofill_profile) | 68 if (has_autofill_profile) |
| 69 type_set.Put(syncer::AUTOFILL_PROFILE); | 69 type_set.Put(syncer::AUTOFILL_PROFILE); |
| 70 if (has_autofill_wallet_data) | 70 if (has_autofill_wallet_data) |
| 71 type_set.Put(syncer::AUTOFILL_WALLET_DATA); | 71 type_set.Put(syncer::AUTOFILL_WALLET_DATA); |
| 72 ON_CALL(*sync, GetActiveDataTypes()).WillByDefault(Return(type_set)); | 72 ON_CALL(*sync, GetActiveDataTypes()).WillByDefault(Return(type_set)); |
| 73 ON_CALL(*sync, GetPreferredDataTypes()).WillByDefault(Return(type_set)); | 73 ON_CALL(*sync, GetPreferredDataTypes()).WillByDefault(Return(type_set)); |
| 74 | 74 |
| 75 ON_CALL(*sync, IsSyncEnabledAndLoggedIn()) | 75 ON_CALL(*sync, CanSyncStart()) |
| 76 .WillByDefault(Return(is_enabled_and_logged_in)); | 76 .WillByDefault(Return(is_enabled_and_logged_in)); |
| 77 | 77 |
| 78 return sync; | 78 return sync; |
| 79 } | 79 } |
| 80 | 80 |
| 81 scoped_ptr<TestingPrefServiceSimple> CreatePrefService( | 81 scoped_ptr<TestingPrefServiceSimple> CreatePrefService( |
| 82 bool autofill_enabled, | 82 bool autofill_enabled, |
| 83 bool autofill_wallet_import_enabled, | 83 bool autofill_wallet_import_enabled, |
| 84 bool autofill_wallet_sync_experiment_enabled) { | 84 bool autofill_wallet_sync_experiment_enabled) { |
| 85 scoped_ptr<TestingPrefServiceSimple> prefs(new TestingPrefServiceSimple()); | 85 scoped_ptr<TestingPrefServiceSimple> prefs(new TestingPrefServiceSimple()); |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 scoped_ptr<TestingPrefServiceSimple> prefs = | 193 scoped_ptr<TestingPrefServiceSimple> prefs = |
| 194 CreatePrefService(true, true, true); | 194 CreatePrefService(true, true, true); |
| 195 // Set server data as missing. | 195 // Set server data as missing. |
| 196 scoped_ptr<TestPersonalDataManager> pdm = | 196 scoped_ptr<TestPersonalDataManager> pdm = |
| 197 CreatePersonalDataManager(prefs.get(), false); | 197 CreatePersonalDataManager(prefs.get(), false); |
| 198 | 198 |
| 199 EXPECT_TRUE(WalletIntegrationAvailable(sync.get(), *prefs, *pdm)); | 199 EXPECT_TRUE(WalletIntegrationAvailable(sync.get(), *prefs, *pdm)); |
| 200 } | 200 } |
| 201 | 201 |
| 202 } // namespace autofill | 202 } // namespace autofill |
| OLD | NEW |