Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6)

Side by Side Diff: chrome/browser/sync/abstract_profile_sync_service_test.cc

Issue 10911073: NOT FOR COMMIT: Add DeviceInfo type and ChangeProcessor (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixes from review comments Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/sync/abstract_profile_sync_service_test.h" 5 #include "chrome/browser/sync/abstract_profile_sync_service_test.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/location.h" 9 #include "base/location.h"
10 #include "chrome/browser/sync/test_profile_sync_service.h" 10 #include "chrome/browser/sync/test_profile_sync_service.h"
(...skipping 24 matching lines...) Expand all
35 using syncer::syncable::WriteTransaction; 35 using syncer::syncable::WriteTransaction;
36 36
37 /* static */ 37 /* static */
38 const std::string ProfileSyncServiceTestHelper::GetTagForType( 38 const std::string ProfileSyncServiceTestHelper::GetTagForType(
39 ModelType model_type) { 39 ModelType model_type) {
40 return syncer::ModelTypeToRootTag(model_type); 40 return syncer::ModelTypeToRootTag(model_type);
41 } 41 }
42 42
43 /* static */ 43 /* static */
44 bool ProfileSyncServiceTestHelper::CreateRoot(ModelType model_type, 44 bool ProfileSyncServiceTestHelper::CreateRoot(ModelType model_type,
45 UserShare* user_share, 45 UserShare* user_share) {
46 TestIdFactory* ids) {
47 syncer::syncable::Directory* directory = user_share->directory.get(); 46 syncer::syncable::Directory* directory = user_share->directory.get();
48 47
49 std::string tag_name = GetTagForType(model_type); 48 std::string tag_name = GetTagForType(model_type);
50 49
51 WriteTransaction wtrans(FROM_HERE, UNITTEST, directory); 50 WriteTransaction wtrans(FROM_HERE, UNITTEST, directory);
52 MutableEntry node(&wtrans, 51 MutableEntry node(&wtrans,
53 CREATE, 52 CREATE,
54 wtrans.root_id(), 53 wtrans.root_id(),
55 tag_name); 54 tag_name);
56 node.Put(UNIQUE_SERVER_TAG, tag_name); 55 node.Put(UNIQUE_SERVER_TAG, tag_name);
57 node.Put(IS_DIR, true); 56 node.Put(IS_DIR, true);
58 node.Put(SERVER_IS_DIR, false); 57 node.Put(SERVER_IS_DIR, false);
59 node.Put(IS_UNSYNCED, false); 58 node.Put(IS_UNSYNCED, false);
60 node.Put(IS_UNAPPLIED_UPDATE, false); 59 node.Put(IS_UNAPPLIED_UPDATE, false);
61 node.Put(SERVER_VERSION, 20); 60 node.Put(SERVER_VERSION, 20);
62 node.Put(BASE_VERSION, 20); 61 node.Put(BASE_VERSION, 20);
63 node.Put(IS_DEL, false); 62 node.Put(IS_DEL, false);
64 node.Put(syncer::syncable::ID, ids->MakeServer(tag_name)); 63 node.Put(syncer::syncable::ID, TestIdFactory::MakeServer(tag_name));
65 sync_pb::EntitySpecifics specifics; 64 sync_pb::EntitySpecifics specifics;
66 syncer::AddDefaultFieldValue(model_type, &specifics); 65 syncer::AddDefaultFieldValue(model_type, &specifics);
67 node.Put(SPECIFICS, specifics); 66 node.Put(SPECIFICS, specifics);
68 67
69 return true; 68 return true;
70 } 69 }
71 70
72 /* static */ 71 /* static */
73 syncer::ImmutableChangeRecordList 72 syncer::ImmutableChangeRecordList
74 ProfileSyncServiceTestHelper::MakeSingletonChangeRecordList( 73 ProfileSyncServiceTestHelper::MakeSingletonChangeRecordList(
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 ui_loop_.RunAllPending(); 112 ui_loop_.RunAllPending();
114 io_thread_.Stop(); 113 io_thread_.Stop();
115 file_thread_.Stop(); 114 file_thread_.Stop();
116 db_thread_.Stop(); 115 db_thread_.Stop();
117 ui_loop_.RunAllPending(); 116 ui_loop_.RunAllPending();
118 } 117 }
119 118
120 bool AbstractProfileSyncServiceTest::CreateRoot(ModelType model_type) { 119 bool AbstractProfileSyncServiceTest::CreateRoot(ModelType model_type) {
121 return ProfileSyncServiceTestHelper::CreateRoot( 120 return ProfileSyncServiceTestHelper::CreateRoot(
122 model_type, 121 model_type,
123 service_->GetUserShare(), 122 service_->GetUserShare());
124 service_->id_factory());
125 } 123 }
126 124
127 // static 125 // static
128 ProfileKeyedService* AbstractProfileSyncServiceTest::BuildTokenService( 126 ProfileKeyedService* AbstractProfileSyncServiceTest::BuildTokenService(
129 Profile* profile) { 127 Profile* profile) {
130 return new TokenService; 128 return new TokenService;
131 } 129 }
132 130
133 CreateRootHelper::CreateRootHelper(AbstractProfileSyncServiceTest* test, 131 CreateRootHelper::CreateRootHelper(AbstractProfileSyncServiceTest* test,
134 ModelType model_type) 132 ModelType model_type)
(...skipping 12 matching lines...) Expand all
147 return callback_; 145 return callback_;
148 } 146 }
149 147
150 bool CreateRootHelper::success() { 148 bool CreateRootHelper::success() {
151 return success_; 149 return success_;
152 } 150 }
153 151
154 void CreateRootHelper::CreateRootCallback() { 152 void CreateRootHelper::CreateRootCallback() {
155 success_ = test_->CreateRoot(model_type_); 153 success_ = test_->CreateRoot(model_type_);
156 } 154 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698