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/signin/token_service.h"
15 #include "chrome/browser/sync/profile_sync_components_factory_mock.h"
16 #include "content/public/test/test_browser_thread_bundle.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"
21 class ProfileSyncService;
22 class TestProfileSyncService;
28 class ProfileSyncServiceTestHelper {
30 static syncer::ImmutableChangeRecordList MakeSingletonChangeRecordList(
31 int64 node_id, syncer::ChangeRecord::Action action);
33 // Deletions must provide an EntitySpecifics for the deleted data.
34 static syncer::ImmutableChangeRecordList
35 MakeSingletonDeletionChangeRecordList(
37 const sync_pb::EntitySpecifics& specifics);
40 class AbstractProfileSyncServiceTest : public testing::Test {
42 AbstractProfileSyncServiceTest();
43 virtual ~AbstractProfileSyncServiceTest();
45 virtual void SetUp() OVERRIDE;
47 virtual void TearDown() OVERRIDE;
49 bool CreateRoot(syncer::ModelType model_type);
51 static BrowserContextKeyedService* BuildTokenService(
52 content::BrowserContext* profile);
55 content::TestBrowserThreadBundle thread_bundle_;
56 TokenService* token_service_;
57 TestProfileSyncService* sync_service_;
60 class CreateRootHelper {
62 CreateRootHelper(AbstractProfileSyncServiceTest* test,
63 syncer::ModelType model_type);
64 virtual ~CreateRootHelper();
66 const base::Closure& callback() const;
70 void CreateRootCallback();
72 base::Closure callback_;
73 AbstractProfileSyncServiceTest* test_;
74 syncer::ModelType model_type_;
78 #endif // CHROME_BROWSER_SYNC_ABSTRACT_PROFILE_SYNC_SERVICE_TEST_H_