Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / sync / internal_api / test / sync_manager_for_profile_sync_test.cc
blobe552c2f03f10c01848dd3ace8b86bb3ca454a511
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"
11 namespace syncer {
13 SyncManagerForProfileSyncTest::SyncManagerForProfileSyncTest(
14 std::string name,
15 base::Closure init_callback)
16 : SyncManagerImpl(name),
17 init_callback_(init_callback) {}
19 SyncManagerForProfileSyncTest::~SyncManagerForProfileSyncTest() {}
21 void SyncManagerForProfileSyncTest::NotifyInitializationSuccess() {
22 UserShare* user_share = GetUserShare();
23 syncable::Directory* directory = user_share->directory.get();
25 if (!init_callback_.is_null())
26 init_callback_.Run();
28 ModelTypeSet early_download_types;
29 early_download_types.PutAll(ControlTypes());
30 early_download_types.PutAll(PriorityUserTypes());
31 for (ModelTypeSet::Iterator it = early_download_types.First();
32 it.Good(); it.Inc()) {
33 if (!directory->InitialSyncEndedForType(it.Get())) {
34 syncer::TestUserShare::CreateRoot(it.Get(), user_share);
38 SyncManagerImpl::NotifyInitializationSuccess();