| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #ifndef CHROME_BROWSER_SYNC_TEST_PROFILE_SYNC_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_SYNC_TEST_PROFILE_SYNC_SERVICE_H_ |
| 6 #define CHROME_BROWSER_SYNC_TEST_PROFILE_SYNC_SERVICE_H_ | 6 #define CHROME_BROWSER_SYNC_TEST_PROFILE_SYNC_SERVICE_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 namespace browser_sync { | 30 namespace browser_sync { |
| 31 | 31 |
| 32 class SyncBackendHostForProfileSyncTest : public SyncBackendHost { | 32 class SyncBackendHostForProfileSyncTest : public SyncBackendHost { |
| 33 public: | 33 public: |
| 34 // |synchronous_init| causes initialization to block until the syncapi has | 34 // |synchronous_init| causes initialization to block until the syncapi has |
| 35 // completed setting itself up and called us back. | 35 // completed setting itself up and called us back. |
| 36 SyncBackendHostForProfileSyncTest( | 36 SyncBackendHostForProfileSyncTest( |
| 37 Profile* profile, | 37 Profile* profile, |
| 38 const base::WeakPtr<SyncPrefs>& sync_prefs, | 38 const base::WeakPtr<SyncPrefs>& sync_prefs, |
| 39 const base::WeakPtr<InvalidatorStorage>& invalidator_storage, | 39 const base::WeakPtr<InvalidatorStorage>& invalidator_storage, |
| 40 bool set_initial_sync_ended_on_init, | |
| 41 bool synchronous_init, | 40 bool synchronous_init, |
| 42 bool fail_initial_download, | 41 bool fail_all_downloads, |
| 43 bool use_real_database); | 42 bool use_real_database); |
| 44 virtual ~SyncBackendHostForProfileSyncTest(); | 43 virtual ~SyncBackendHostForProfileSyncTest(); |
| 45 | 44 |
| 46 MOCK_METHOD1(RequestNudge, void(const tracked_objects::Location&)); | 45 MOCK_METHOD1(RequestNudge, void(const tracked_objects::Location&)); |
| 47 | 46 |
| 48 // Called when a nudge comes in. | |
| 49 void SimulateSyncCycleCompletedInitialSyncEnded( | |
| 50 const tracked_objects::Location&); | |
| 51 | |
| 52 virtual void StartConfiguration(const base::Closure& callback) OVERRIDE; | 47 virtual void StartConfiguration(const base::Closure& callback) OVERRIDE; |
| 53 | 48 |
| 54 static void SetHistoryServiceExpectations(ProfileMock* profile); | 49 static void SetHistoryServiceExpectations(ProfileMock* profile); |
| 55 | 50 |
| 56 protected: | 51 protected: |
| 57 virtual void InitCore(const DoInitializeOptions& options) OVERRIDE; | 52 virtual void InitCore(const DoInitializeOptions& options) OVERRIDE; |
| 58 | 53 |
| 59 private: | 54 private: |
| 60 bool synchronous_init_; | 55 bool synchronous_init_; |
| 61 bool fail_initial_download_; | 56 bool fail_all_downloads_; |
| 62 bool use_real_database_; | 57 bool use_real_database_; |
| 63 }; | 58 }; |
| 64 | 59 |
| 65 } // namespace browser_sync | 60 } // namespace browser_sync |
| 66 | 61 |
| 67 class TestProfileSyncService : public ProfileSyncService { | 62 class TestProfileSyncService : public ProfileSyncService { |
| 68 public: | 63 public: |
| 69 // |callback| can be used to populate nodes before the OnBackendInitialized | 64 // |callback| can be used to populate nodes before the OnBackendInitialized |
| 70 // callback fires. | 65 // callback fires. |
| 71 // TODO(tim): Remove |synchronous_backend_initialization|, and add ability to | 66 // TODO(tim): Remove |synchronous_backend_initialization|, and add ability to |
| (...skipping 15 matching lines...) Expand all Loading... |
| 87 | 82 |
| 88 virtual void Observe(int type, | 83 virtual void Observe(int type, |
| 89 const content::NotificationSource& source, | 84 const content::NotificationSource& source, |
| 90 const content::NotificationDetails& details) OVERRIDE; | 85 const content::NotificationDetails& details) OVERRIDE; |
| 91 | 86 |
| 92 // If this is called, configuring data types will require a syncer | 87 // If this is called, configuring data types will require a syncer |
| 93 // nudge. | 88 // nudge. |
| 94 void dont_set_initial_sync_ended_on_init(); | 89 void dont_set_initial_sync_ended_on_init(); |
| 95 void set_synchronous_sync_configuration(); | 90 void set_synchronous_sync_configuration(); |
| 96 | 91 |
| 97 void fail_initial_download(); | 92 void fail_all_downloads(); |
| 98 void set_use_real_database(); | 93 void set_use_real_database(); |
| 99 | 94 |
| 100 browser_sync::TestIdFactory* id_factory(); | 95 browser_sync::TestIdFactory* id_factory(); |
| 101 | 96 |
| 102 // Override of ProfileSyncService::GetBackendForTest() with a more | 97 // Override of ProfileSyncService::GetBackendForTest() with a more |
| 103 // specific return type (since C++ supports covariant return types) | 98 // specific return type (since C++ supports covariant return types) |
| 104 // that is made public. | 99 // that is made public. |
| 105 virtual browser_sync::SyncBackendHostForProfileSyncTest* | 100 virtual browser_sync::SyncBackendHostForProfileSyncTest* |
| 106 GetBackendForTest() OVERRIDE; | 101 GetBackendForTest() OVERRIDE; |
| 107 | 102 |
| 108 protected: | 103 protected: |
| 109 virtual void CreateBackend() OVERRIDE; | 104 virtual void CreateBackend() OVERRIDE; |
| 110 | 105 |
| 111 private: | 106 private: |
| 112 browser_sync::TestIdFactory id_factory_; | 107 browser_sync::TestIdFactory id_factory_; |
| 113 | 108 |
| 114 bool synchronous_backend_initialization_; | 109 bool synchronous_backend_initialization_; |
| 115 | 110 |
| 116 // Set to true when a mock data type manager is being used and the configure | 111 // Set to true when a mock data type manager is being used and the configure |
| 117 // step is performed synchronously. | 112 // step is performed synchronously. |
| 118 bool synchronous_sync_configuration_; | 113 bool synchronous_sync_configuration_; |
| 119 bool set_expect_resume_expectations_; | 114 bool set_expect_resume_expectations_; |
| 120 | 115 |
| 121 base::Closure callback_; | 116 base::Closure callback_; |
| 122 bool set_initial_sync_ended_on_init_; | 117 bool set_initial_sync_ended_on_init_; |
| 123 | 118 |
| 124 bool fail_initial_download_; | 119 bool fail_all_downloads_; |
| 125 bool use_real_database_; | 120 bool use_real_database_; |
| 126 }; | 121 }; |
| 127 | 122 |
| 128 | |
| 129 | |
| 130 #endif // CHROME_BROWSER_SYNC_TEST_PROFILE_SYNC_SERVICE_H_ | 123 #endif // CHROME_BROWSER_SYNC_TEST_PROFILE_SYNC_SERVICE_H_ |
| OLD | NEW |