Use app list item shadow for app list folders.
[chromium-blink-merge.git] / chrome / browser / sync / abstract_profile_sync_service_test.cc
blobc57ccd9f565bca7abf209df1726d8a9ab9e62811
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 #include "chrome/browser/sync/abstract_profile_sync_service_test.h"
7 #include "base/bind.h"
8 #include "base/bind_helpers.h"
9 #include "base/location.h"
10 #include "base/run_loop.h"
11 #include "chrome/browser/sync/test_profile_sync_service.h"
12 #include "content/public/test/test_utils.h"
13 #include "sync/internal_api/public/test/test_user_share.h"
14 #include "sync/internal_api/public/write_transaction.h"
15 #include "sync/protocol/sync.pb.h"
16 #include "sync/util/cryptographer.h"
18 using syncer::ModelType;
19 using syncer::UserShare;
21 /* static */
22 syncer::ImmutableChangeRecordList
23 ProfileSyncServiceTestHelper::MakeSingletonChangeRecordList(
24 int64 node_id, syncer::ChangeRecord::Action action) {
25 syncer::ChangeRecord record;
26 record.action = action;
27 record.id = node_id;
28 syncer::ChangeRecordList records(1, record);
29 return syncer::ImmutableChangeRecordList(&records);
32 /* static */
33 syncer::ImmutableChangeRecordList
34 ProfileSyncServiceTestHelper::MakeSingletonDeletionChangeRecordList(
35 int64 node_id, const sync_pb::EntitySpecifics& specifics) {
36 syncer::ChangeRecord record;
37 record.action = syncer::ChangeRecord::ACTION_DELETE;
38 record.id = node_id;
39 record.specifics = specifics;
40 syncer::ChangeRecordList records(1, record);
41 return syncer::ImmutableChangeRecordList(&records);
44 AbstractProfileSyncServiceTest::AbstractProfileSyncServiceTest()
45 : thread_bundle_(content::TestBrowserThreadBundle::REAL_DB_THREAD |
46 content::TestBrowserThreadBundle::REAL_FILE_THREAD |
47 content::TestBrowserThreadBundle::REAL_IO_THREAD),
48 sync_service_(NULL) {
51 AbstractProfileSyncServiceTest::~AbstractProfileSyncServiceTest() {}
53 void AbstractProfileSyncServiceTest::SetUp() {
56 void AbstractProfileSyncServiceTest::TearDown() {
57 // Pump messages posted by the sync core thread (which may end up
58 // posting on the IO thread).
59 base::RunLoop().RunUntilIdle();
60 content::RunAllPendingInMessageLoop(content::BrowserThread::IO);
61 base::RunLoop().RunUntilIdle();
64 bool AbstractProfileSyncServiceTest::CreateRoot(ModelType model_type) {
65 return syncer::TestUserShare::CreateRoot(model_type,
66 sync_service_->GetUserShare());
69 CreateRootHelper::CreateRootHelper(AbstractProfileSyncServiceTest* test,
70 ModelType model_type)
71 : callback_(base::Bind(&CreateRootHelper::CreateRootCallback,
72 base::Unretained(this))),
73 test_(test),
74 model_type_(model_type),
75 success_(false) {
78 CreateRootHelper::~CreateRootHelper() {
81 const base::Closure& CreateRootHelper::callback() const {
82 return callback_;
85 bool CreateRootHelper::success() {
86 return success_;
89 void CreateRootHelper::CreateRootCallback() {
90 success_ = test_->CreateRoot(model_type_);