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

Unified Diff: sync/internal_api/test/test_user_share.cc

Issue 10911073: NOT FOR COMMIT: Add DeviceInfo type and ChangeProcessor (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix several issues 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
« no previous file with comments | « sync/internal_api/test/fake_sync_manager.cc ('k') | sync/internal_api/user_share.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sync/internal_api/test/test_user_share.cc
diff --git a/sync/internal_api/test/test_user_share.cc b/sync/internal_api/test/test_user_share.cc
index ef93b1812cfba32676ece47913359349061e9a2f..bb19fe21d9d30e2ca6d6774debb22b41902f9eda 100644
--- a/sync/internal_api/test/test_user_share.cc
+++ b/sync/internal_api/test/test_user_share.cc
@@ -6,7 +6,10 @@
#include "base/compiler_specific.h"
#include "sync/syncable/directory.h"
+#include "sync/syncable/mutable_entry.h"
+#include "sync/syncable/write_transaction.h"
#include "sync/test/engine/test_directory_setter_upper.h"
+#include "sync/test/engine/test_id_factory.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace syncer {
@@ -43,4 +46,35 @@ SyncEncryptionHandler* TestUserShare::encryption_handler() {
return dir_maker_->encryption_handler();
}
+syncable::MockTransactionObserver* TestUserShare::transaction_observer() {
+ return dir_maker_->transaction_observer();
+}
+
+/* static */
+bool TestUserShare::CreateRoot(ModelType model_type, UserShare* user_share) {
+ syncer::syncable::Directory* directory = user_share->directory.get();
+
+ std::string tag_name = syncer::ModelTypeToRootTag(model_type);
+
+ syncable::WriteTransaction wtrans(FROM_HERE, syncable::UNITTEST, directory);
+ syncable::MutableEntry node(&wtrans,
+ syncable::CREATE,
+ wtrans.root_id(),
+ tag_name);
+ node.Put(syncable::UNIQUE_SERVER_TAG, tag_name);
+ node.Put(syncable::IS_DIR, true);
+ node.Put(syncable::SERVER_IS_DIR, false);
+ node.Put(syncable::IS_UNSYNCED, false);
+ node.Put(syncable::IS_UNAPPLIED_UPDATE, false);
+ node.Put(syncable::SERVER_VERSION, 20);
+ node.Put(syncable::BASE_VERSION, 20);
+ node.Put(syncable::IS_DEL, false);
+ node.Put(syncable::ID, syncer::TestIdFactory::MakeServer(tag_name));
+ sync_pb::EntitySpecifics specifics;
+ syncer::AddDefaultFieldValue(model_type, &specifics);
+ node.Put(syncable::SPECIFICS, specifics);
+
+ return true;
+}
+
} // namespace syncer
« no previous file with comments | « sync/internal_api/test/fake_sync_manager.cc ('k') | sync/internal_api/user_share.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698