| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_SYNC_ABSTRACT_PROFILE_SYNC_SERVICE_TEST_H_ | |
| 6 #define CHROME_BROWSER_SYNC_ABSTRACT_PROFILE_SYNC_SERVICE_TEST_H_ | |
| 7 | |
| 8 #include <stdint.h> | |
| 9 | |
| 10 #include <string> | |
| 11 | |
| 12 #include "base/callback.h" | |
| 13 #include "base/files/scoped_temp_dir.h" | |
| 14 #include "base/macros.h" | |
| 15 #include "base/memory/scoped_ptr.h" | |
| 16 #include "components/browser_sync/browser/profile_sync_test_util.h" | |
| 17 #include "sync/internal_api/public/base/model_type.h" | |
| 18 #include "sync/internal_api/public/change_record.h" | |
| 19 #include "testing/gtest/include/gtest/gtest.h" | |
| 20 | |
| 21 class TestProfileSyncService; | |
| 22 | |
| 23 namespace syncer { | |
| 24 struct UserShare; | |
| 25 } // namespace syncer | |
| 26 | |
| 27 class ProfileSyncServiceTestHelper { | |
| 28 public: | |
| 29 static syncer::ImmutableChangeRecordList MakeSingletonChangeRecordList( | |
| 30 int64_t node_id, | |
| 31 syncer::ChangeRecord::Action action); | |
| 32 | |
| 33 // Deletions must provide an EntitySpecifics for the deleted data. | |
| 34 static syncer::ImmutableChangeRecordList | |
| 35 MakeSingletonDeletionChangeRecordList( | |
| 36 int64_t node_id, | |
| 37 const sync_pb::EntitySpecifics& specifics); | |
| 38 | |
| 39 private: | |
| 40 DISALLOW_COPY_AND_ASSIGN(ProfileSyncServiceTestHelper); | |
| 41 }; | |
| 42 | |
| 43 class AbstractProfileSyncServiceTest : public testing::Test { | |
| 44 public: | |
| 45 AbstractProfileSyncServiceTest(); | |
| 46 ~AbstractProfileSyncServiceTest() override; | |
| 47 | |
| 48 bool CreateRoot(syncer::ModelType model_type); | |
| 49 | |
| 50 protected: | |
| 51 // Creates a TestProfileSyncService instance based on | |
| 52 // |profile_sync_service_bundle_|, with start behavior | |
| 53 // browser_sync::AUTO_START. Passes |callback| down to | |
| 54 // SyncManagerForProfileSyncTest to be used byNotifyInitializationSuccess. | |
| 55 // |sync_client| is passed to the service. | |
| 56 scoped_ptr<TestProfileSyncService> CreateSyncService( | |
| 57 base::Closure callback, | |
| 58 scoped_ptr<sync_driver::SyncClient> sync_client); | |
| 59 | |
| 60 browser_sync::ProfileSyncServiceBundle profile_sync_service_bundle_; | |
| 61 scoped_ptr<TestProfileSyncService> sync_service_; | |
| 62 | |
| 63 private: | |
| 64 base::ScopedTempDir temp_dir_; // To pass to the backend host. | |
| 65 | |
| 66 DISALLOW_COPY_AND_ASSIGN(AbstractProfileSyncServiceTest); | |
| 67 }; | |
| 68 | |
| 69 class CreateRootHelper { | |
| 70 public: | |
| 71 CreateRootHelper(AbstractProfileSyncServiceTest* test, | |
| 72 syncer::ModelType model_type); | |
| 73 virtual ~CreateRootHelper(); | |
| 74 | |
| 75 const base::Closure& callback() const; | |
| 76 bool success(); | |
| 77 | |
| 78 private: | |
| 79 void CreateRootCallback(); | |
| 80 | |
| 81 base::Closure callback_; | |
| 82 AbstractProfileSyncServiceTest* test_; | |
| 83 syncer::ModelType model_type_; | |
| 84 bool success_; | |
| 85 | |
| 86 DISALLOW_COPY_AND_ASSIGN(CreateRootHelper); | |
| 87 }; | |
| 88 | |
| 89 #endif // CHROME_BROWSER_SYNC_ABSTRACT_PROFILE_SYNC_SERVICE_TEST_H_ | |
| OLD | NEW |