diff options
author | rlarocque@chromium.org <rlarocque@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-09-24 18:45:09 +0000 |
---|---|---|
committer | rlarocque@chromium.org <rlarocque@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-09-24 18:45:09 +0000 |
commit | 550110450015f04eda1952f591a80ef2c1d22105 (patch) | |
tree | 746827b4a8c6c3d7a085831289a36651ec6a84c3 /chrome/browser/sync/abstract_profile_sync_service_test.cc | |
parent | 74f45dda73cf3707524942508474e7b37fe6e711 (diff) | |
download | chromium_src-550110450015f04eda1952f591a80ef2c1d22105.zip chromium_src-550110450015f04eda1952f591a80ef2c1d22105.tar.gz chromium_src-550110450015f04eda1952f591a80ef2c1d22105.tar.bz2 |
sync: Refactor CreateRoot() test helper function
Move the function's definition so we can eventually make use of it in
FakeSyncManager to test the DEVICE_INFO type. This change also removes
the unnecessary TestIdFactory parameter.
BUG=122825
Review URL: https://chromiumcodereview.appspot.com/10958007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@158331 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/sync/abstract_profile_sync_service_test.cc')
-rw-r--r-- | chrome/browser/sync/abstract_profile_sync_service_test.cc | 60 |
1 files changed, 3 insertions, 57 deletions
diff --git a/chrome/browser/sync/abstract_profile_sync_service_test.cc b/chrome/browser/sync/abstract_profile_sync_service_test.cc index f12c501..079eadc 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 |