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

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

Issue 7918001: [Sync] Move ChangeRecord into its own file (change_record.{h,cc}) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments Created 9 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/tracked.h" 7 #include "base/tracked.h"
8 #include "chrome/browser/sync/internal_api/write_transaction.h" 8 #include "chrome/browser/sync/internal_api/write_transaction.h"
9 #include "chrome/browser/sync/protocol/sync.pb.h" 9 #include "chrome/browser/sync/protocol/sync.pb.h"
10 #include "chrome/browser/sync/syncable/directory_manager.h" 10 #include "chrome/browser/sync/syncable/directory_manager.h"
(...skipping 14 matching lines...) Expand all
25 using syncable::ModelType; 25 using syncable::ModelType;
26 using syncable::MutableEntry; 26 using syncable::MutableEntry;
27 using syncable::SERVER_IS_DIR; 27 using syncable::SERVER_IS_DIR;
28 using syncable::SERVER_VERSION; 28 using syncable::SERVER_VERSION;
29 using syncable::SPECIFICS; 29 using syncable::SPECIFICS;
30 using syncable::ScopedDirLookup; 30 using syncable::ScopedDirLookup;
31 using syncable::UNIQUE_SERVER_TAG; 31 using syncable::UNIQUE_SERVER_TAG;
32 using syncable::UNITTEST; 32 using syncable::UNITTEST;
33 using syncable::WriteTransaction; 33 using syncable::WriteTransaction;
34 34
35 /* static */
35 const std::string ProfileSyncServiceTestHelper::GetTagForType( 36 const std::string ProfileSyncServiceTestHelper::GetTagForType(
36 ModelType model_type) { 37 ModelType model_type) {
37 return syncable::ModelTypeToRootTag(model_type); 38 return syncable::ModelTypeToRootTag(model_type);
38 } 39 }
39 40
41 /* static */
40 bool ProfileSyncServiceTestHelper::CreateRoot( 42 bool ProfileSyncServiceTestHelper::CreateRoot(
41 ModelType model_type, UserShare* user_share, 43 ModelType model_type, UserShare* user_share,
42 TestIdFactory* ids) { 44 TestIdFactory* ids) {
43 DirectoryManager* dir_manager = user_share->dir_manager.get(); 45 DirectoryManager* dir_manager = user_share->dir_manager.get();
44 46
45 ScopedDirLookup dir(dir_manager, user_share->name); 47 ScopedDirLookup dir(dir_manager, user_share->name);
46 if (!dir.good()) 48 if (!dir.good())
47 return false; 49 return false;
48 50
49 std::string tag_name = GetTagForType(model_type); 51 std::string tag_name = GetTagForType(model_type);
(...skipping 12 matching lines...) Expand all
62 node.Put(BASE_VERSION, 20); 64 node.Put(BASE_VERSION, 20);
63 node.Put(IS_DEL, false); 65 node.Put(IS_DEL, false);
64 node.Put(syncable::ID, ids->MakeServer(tag_name)); 66 node.Put(syncable::ID, ids->MakeServer(tag_name));
65 sync_pb::EntitySpecifics specifics; 67 sync_pb::EntitySpecifics specifics;
66 syncable::AddDefaultExtensionValue(model_type, &specifics); 68 syncable::AddDefaultExtensionValue(model_type, &specifics);
67 node.Put(SPECIFICS, specifics); 69 node.Put(SPECIFICS, specifics);
68 70
69 return true; 71 return true;
70 } 72 }
71 73
74 /* static */
75 sync_api::ImmutableChangeRecordList
76 ProfileSyncServiceTestHelper::MakeSingletonChangeRecordList(
77 int64 node_id, sync_api::ChangeRecord::Action action) {
78 sync_api::ChangeRecord record;
79 record.action = action;
80 record.id = node_id;
81 sync_api::ChangeRecordList records(1, record);
82 return sync_api::ImmutableChangeRecordList(&records);
83 }
84
72 AbstractProfileSyncServiceTest::AbstractProfileSyncServiceTest() 85 AbstractProfileSyncServiceTest::AbstractProfileSyncServiceTest()
73 : ui_thread_(BrowserThread::UI, &ui_loop_), 86 : ui_thread_(BrowserThread::UI, &ui_loop_),
74 db_thread_(BrowserThread::DB), 87 db_thread_(BrowserThread::DB),
75 io_thread_(BrowserThread::IO), 88 io_thread_(BrowserThread::IO),
76 token_service_(new TokenService) {} 89 token_service_(new TokenService) {}
77 90
78 AbstractProfileSyncServiceTest::~AbstractProfileSyncServiceTest() {} 91 AbstractProfileSyncServiceTest::~AbstractProfileSyncServiceTest() {}
79 92
80 void AbstractProfileSyncServiceTest::SetUp() { 93 void AbstractProfileSyncServiceTest::SetUp() {
81 db_thread_.Start(); 94 db_thread_.Start();
(...skipping 30 matching lines...) Expand all
112 } 125 }
113 126
114 CreateRootTask::~CreateRootTask() {} 127 CreateRootTask::~CreateRootTask() {}
115 void CreateRootTask::Run() { 128 void CreateRootTask::Run() {
116 success_ = test_->CreateRoot(model_type_); 129 success_ = test_->CreateRoot(model_type_);
117 } 130 }
118 131
119 bool CreateRootTask::success() { 132 bool CreateRootTask::success() {
120 return success_; 133 return success_;
121 } 134 }
OLDNEW
« no previous file with comments | « chrome/browser/sync/abstract_profile_sync_service_test.h ('k') | chrome/browser/sync/glue/autofill_change_processor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698