• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.
4 
5 #include "sync/internal_api/test/sync_manager_for_profile_sync_test.h"
6 
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"
10 
11 namespace syncer {
12 
SyncManagerForProfileSyncTest(std::string name,base::Closure init_callback)13 SyncManagerForProfileSyncTest::SyncManagerForProfileSyncTest(
14     std::string name,
15     base::Closure init_callback)
16   : SyncManagerImpl(name),
17     init_callback_(init_callback) {}
18 
~SyncManagerForProfileSyncTest()19 SyncManagerForProfileSyncTest::~SyncManagerForProfileSyncTest() {}
20 
NotifyInitializationSuccess()21 void SyncManagerForProfileSyncTest::NotifyInitializationSuccess() {
22   UserShare* user_share = GetUserShare();
23   syncable::Directory* directory = user_share->directory.get();
24 
25   if (!init_callback_.is_null())
26     init_callback_.Run();
27 
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);
35     }
36   }
37 
38   SyncManagerImpl::NotifyInitializationSuccess();
39 }
40 
41 };
42