1 // Copyright 2013 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 "sync/internal_api/test/sync_manager_for_profile_sync_test.h"
7 #include "sync/internal_api/public/test/test_user_share.h"
8 #include "sync/internal_api/public/user_share.h"
9 #include "sync/syncable/directory.h"
13 SyncManagerForProfileSyncTest::SyncManagerForProfileSyncTest(
15 base::Closure init_callback,
16 bool set_initial_sync_ended)
17 : SyncManagerImpl(name),
18 init_callback_(init_callback),
19 set_initial_sync_ended_(set_initial_sync_ended) {}
21 SyncManagerForProfileSyncTest::~SyncManagerForProfileSyncTest() {}
23 void SyncManagerForProfileSyncTest::NotifyInitializationSuccess() {
24 UserShare* user_share = GetUserShare();
25 syncable::Directory* directory = user_share->directory.get();
27 if (!init_callback_.is_null())
30 if (set_initial_sync_ended_) {
31 ModelTypeSet early_download_types;
32 early_download_types.PutAll(ControlTypes());
33 early_download_types.PutAll(PriorityUserTypes());
34 for (ModelTypeSet::Iterator it = early_download_types.First();
35 it.Good(); it.Inc()) {
36 if (!directory->InitialSyncEndedForType(it.Get())) {
37 syncer::TestUserShare::CreateRoot(it.Get(), user_share);
41 VLOG(2) << "Skipping directory init";
44 SyncManagerImpl::NotifyInitializationSuccess();