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

Unified Diff: chrome/browser/sync/abstract_profile_sync_service_test.cc

Issue 10958007: sync: Refactor CreateRoot() test helper function (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Found more stuff to clean up 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/sync/abstract_profile_sync_service_test.cc
diff --git a/chrome/browser/sync/abstract_profile_sync_service_test.cc b/chrome/browser/sync/abstract_profile_sync_service_test.cc
index f12c501ef151a72a6690c06b2c947d98b34c75ad..079eadcb15dcc24996b3b824598e964ba766664c 100644
--- a/chrome/browser/sync/abstract_profile_sync_service_test.cc
+++ b/chrome/browser/sync/abstract_profile_sync_service_test.cc
@@ -8,66 +8,14 @@
#include "base/bind_helpers.h"
#include "base/location.h"
#include "chrome/browser/sync/test_profile_sync_service.h"
+#include "sync/internal_api/public/test/test_user_share.h"
#include "sync/internal_api/public/write_transaction.h"
#include "sync/protocol/sync.pb.h"
-#include "sync/syncable/entry.h"
-#include "sync/syncable/mutable_entry.h"
-#include "sync/syncable/write_transaction.h"
-#include "sync/test/engine/test_id_factory.h"
#include "sync/util/cryptographer.h"
-using syncer::TestIdFactory;
using content::BrowserThread;
using syncer::ModelType;
using syncer::UserShare;
-using syncer::syncable::BASE_VERSION;
-using syncer::syncable::CREATE;
-using syncer::syncable::IS_DEL;
-using syncer::syncable::IS_DIR;
-using syncer::syncable::IS_UNAPPLIED_UPDATE;
-using syncer::syncable::IS_UNSYNCED;
-using syncer::syncable::MutableEntry;
-using syncer::syncable::SERVER_IS_DIR;
-using syncer::syncable::SERVER_VERSION;
-using syncer::syncable::SPECIFICS;
-using syncer::syncable::UNIQUE_SERVER_TAG;
-using syncer::syncable::UNITTEST;
-using syncer::syncable::WriteTransaction;
-
-/* static */
-const std::string ProfileSyncServiceTestHelper::GetTagForType(
- ModelType model_type) {
- return syncer::ModelTypeToRootTag(model_type);
-}
-
-/* static */
-bool ProfileSyncServiceTestHelper::CreateRoot(ModelType model_type,
- UserShare* user_share,
- TestIdFactory* ids) {
- syncer::syncable::Directory* directory = user_share->directory.get();
-
- std::string tag_name = GetTagForType(model_type);
-
- WriteTransaction wtrans(FROM_HERE, UNITTEST, directory);
- MutableEntry node(&wtrans,
- CREATE,
- wtrans.root_id(),
- tag_name);
- node.Put(UNIQUE_SERVER_TAG, tag_name);
- node.Put(IS_DIR, true);
- node.Put(SERVER_IS_DIR, false);
- node.Put(IS_UNSYNCED, false);
- node.Put(IS_UNAPPLIED_UPDATE, false);
- node.Put(SERVER_VERSION, 20);
- node.Put(BASE_VERSION, 20);
- node.Put(IS_DEL, false);
- node.Put(syncer::syncable::ID, ids->MakeServer(tag_name));
- sync_pb::EntitySpecifics specifics;
- syncer::AddDefaultFieldValue(model_type, &specifics);
- node.Put(SPECIFICS, specifics);
-
- return true;
-}
/* static */
syncer::ImmutableChangeRecordList
@@ -118,10 +66,8 @@ void AbstractProfileSyncServiceTest::TearDown() {
}
bool AbstractProfileSyncServiceTest::CreateRoot(ModelType model_type) {
- return ProfileSyncServiceTestHelper::CreateRoot(
- model_type,
- service_->GetUserShare(),
- service_->id_factory());
+ return syncer::TestUserShare::CreateRoot(model_type,
+ service_->GetUserShare());
}
// static

Powered by Google App Engine
This is Rietveld 408576698