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.
5 #ifndef CHROME_BROWSER_SYNC_ABSTRACT_PROFILE_SYNC_SERVICE_TEST_H_
6 #define CHROME_BROWSER_SYNC_ABSTRACT_PROFILE_SYNC_SERVICE_TEST_H_
10 #include "base/callback.h"
11 #include "base/compiler_specific.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "base/message_loop/message_loop.h"
14 #include "chrome/browser/sync/profile_sync_components_factory_mock.h"
15 #include "content/public/test/test_browser_thread_bundle.h"
16 #include "sync/internal_api/public/base/model_type.h"
17 #include "sync/internal_api/public/change_record.h"
18 #include "testing/gtest/include/gtest/gtest.h"
20 class ProfileSyncService
;
21 class TestProfileSyncService
;
27 class ProfileSyncServiceTestHelper
{
29 static syncer::ImmutableChangeRecordList
MakeSingletonChangeRecordList(
30 int64 node_id
, syncer::ChangeRecord::Action action
);
32 // Deletions must provide an EntitySpecifics for the deleted data.
33 static syncer::ImmutableChangeRecordList
34 MakeSingletonDeletionChangeRecordList(
36 const sync_pb::EntitySpecifics
& specifics
);
39 class AbstractProfileSyncServiceTest
: public testing::Test
{
41 AbstractProfileSyncServiceTest();
42 ~AbstractProfileSyncServiceTest() override
;
44 void SetUp() override
;
46 void TearDown() override
;
48 bool CreateRoot(syncer::ModelType model_type
);
51 content::TestBrowserThreadBundle thread_bundle_
;
52 TestProfileSyncService
* sync_service_
;
55 class CreateRootHelper
{
57 CreateRootHelper(AbstractProfileSyncServiceTest
* test
,
58 syncer::ModelType model_type
);
59 virtual ~CreateRootHelper();
61 const base::Closure
& callback() const;
65 void CreateRootCallback();
67 base::Closure callback_
;
68 AbstractProfileSyncServiceTest
* test_
;
69 syncer::ModelType model_type_
;
73 #endif // CHROME_BROWSER_SYNC_ABSTRACT_PROFILE_SYNC_SERVICE_TEST_H_