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

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

Issue 10699044: [Sync] Move sync/{internal_api,syncable} into syncer namespace (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Sync to head Created 8 years, 5 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
« no previous file with comments | « no previous file | chrome/browser/sync/glue/bookmark_change_processor.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"
11 #include "sync/internal_api/public/write_transaction.h" 11 #include "sync/internal_api/public/write_transaction.h"
12 #include "sync/protocol/sync.pb.h" 12 #include "sync/protocol/sync.pb.h"
13 #include "sync/syncable/entry.h" 13 #include "sync/syncable/entry.h"
14 #include "sync/syncable/mutable_entry.h" 14 #include "sync/syncable/mutable_entry.h"
15 #include "sync/syncable/write_transaction.h" 15 #include "sync/syncable/write_transaction.h"
16 #include "sync/test/engine/test_id_factory.h" 16 #include "sync/test/engine/test_id_factory.h"
17 #include "sync/util/cryptographer.h" 17 #include "sync/util/cryptographer.h"
18 18
19 using syncer::TestIdFactory; 19 using syncer::TestIdFactory;
20 using content::BrowserThread; 20 using content::BrowserThread;
21 using syncer::UserShare; 21 using syncer::UserShare;
22 using syncable::BASE_VERSION; 22 using syncer::syncable::BASE_VERSION;
23 using syncable::CREATE; 23 using syncer::syncable::CREATE;
24 using syncable::IS_DEL; 24 using syncer::syncable::IS_DEL;
25 using syncable::IS_DIR; 25 using syncer::syncable::IS_DIR;
26 using syncable::IS_UNAPPLIED_UPDATE; 26 using syncer::syncable::IS_UNAPPLIED_UPDATE;
27 using syncable::IS_UNSYNCED; 27 using syncer::syncable::IS_UNSYNCED;
28 using syncable::ModelType; 28 using syncer::syncable::ModelType;
29 using syncable::MutableEntry; 29 using syncer::syncable::MutableEntry;
30 using syncable::SERVER_IS_DIR; 30 using syncer::syncable::SERVER_IS_DIR;
31 using syncable::SERVER_VERSION; 31 using syncer::syncable::SERVER_VERSION;
32 using syncable::SPECIFICS; 32 using syncer::syncable::SPECIFICS;
33 using syncable::UNIQUE_SERVER_TAG; 33 using syncer::syncable::UNIQUE_SERVER_TAG;
34 using syncable::UNITTEST; 34 using syncer::syncable::UNITTEST;
35 using 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 syncable::ModelTypeToRootTag(model_type); 40 return syncable::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) { 46 TestIdFactory* ids) {
47 syncable::Directory* directory = user_share->directory.get(); 47 syncer::syncable::Directory* directory = user_share->directory.get();
48 48
49 std::string tag_name = GetTagForType(model_type); 49 std::string tag_name = GetTagForType(model_type);
50 50
51 WriteTransaction wtrans(FROM_HERE, UNITTEST, directory); 51 WriteTransaction wtrans(FROM_HERE, UNITTEST, directory);
52 MutableEntry node(&wtrans, 52 MutableEntry node(&wtrans,
53 CREATE, 53 CREATE,
54 wtrans.root_id(), 54 wtrans.root_id(),
55 tag_name); 55 tag_name);
56 node.Put(UNIQUE_SERVER_TAG, tag_name); 56 node.Put(UNIQUE_SERVER_TAG, tag_name);
57 node.Put(IS_DIR, true); 57 node.Put(IS_DIR, true);
58 node.Put(SERVER_IS_DIR, false); 58 node.Put(SERVER_IS_DIR, false);
59 node.Put(IS_UNSYNCED, false); 59 node.Put(IS_UNSYNCED, false);
60 node.Put(IS_UNAPPLIED_UPDATE, false); 60 node.Put(IS_UNAPPLIED_UPDATE, false);
61 node.Put(SERVER_VERSION, 20); 61 node.Put(SERVER_VERSION, 20);
62 node.Put(BASE_VERSION, 20); 62 node.Put(BASE_VERSION, 20);
63 node.Put(IS_DEL, false); 63 node.Put(IS_DEL, false);
64 node.Put(syncable::ID, ids->MakeServer(tag_name)); 64 node.Put(syncer::syncable::ID, ids->MakeServer(tag_name));
65 sync_pb::EntitySpecifics specifics; 65 sync_pb::EntitySpecifics specifics;
66 syncable::AddDefaultFieldValue(model_type, &specifics); 66 syncable::AddDefaultFieldValue(model_type, &specifics);
67 node.Put(SPECIFICS, specifics); 67 node.Put(SPECIFICS, specifics);
68 68
69 return true; 69 return true;
70 } 70 }
71 71
72 /* static */ 72 /* static */
73 syncer::ImmutableChangeRecordList 73 syncer::ImmutableChangeRecordList
74 ProfileSyncServiceTestHelper::MakeSingletonChangeRecordList( 74 ProfileSyncServiceTestHelper::MakeSingletonChangeRecordList(
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 return callback_; 147 return callback_;
148 } 148 }
149 149
150 bool CreateRootHelper::success() { 150 bool CreateRootHelper::success() {
151 return success_; 151 return success_;
152 } 152 }
153 153
154 void CreateRootHelper::CreateRootCallback() { 154 void CreateRootHelper::CreateRootCallback() {
155 success_ = test_->CreateRoot(model_type_); 155 success_ = test_->CreateRoot(model_type_);
156 } 156 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/sync/glue/bookmark_change_processor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698