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

Unified Diff: sync/syncable/model_type_unittest.cc

Issue 298503002: sync: Enable typed tombstones commits (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add tests for AddDefaultFieldValues Created 6 years, 7 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/protocol/sync.proto ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sync/syncable/model_type_unittest.cc
diff --git a/sync/syncable/model_type_unittest.cc b/sync/syncable/model_type_unittest.cc
index 3ac9fd116f5a67a9802c56f2787d385d3cd14c16..7bf50e55ed84f418d7935d0616ce711102498431 100644
--- a/sync/syncable/model_type_unittest.cc
+++ b/sync/syncable/model_type_unittest.cc
@@ -9,6 +9,7 @@
#include "base/memory/scoped_ptr.h"
#include "base/test/values_test_util.h"
#include "base/values.h"
+#include "sync/protocol/sync.pb.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace syncer {
@@ -117,5 +118,25 @@ TEST_F(ModelTypeTest, ModelTypeSetFromString) {
two.Equals(ModelTypeSetFromString(ModelTypeSetToString(two))));
}
+TEST_F(ModelTypeTest, DefaultFieldValues) {
+ syncer::ModelTypeSet types = syncer::ProtocolTypes();
+ for (ModelTypeSet::Iterator it = types.First(); it.Good(); it.Inc()) {
+ SCOPED_TRACE(ModelTypeToString(it.Get()));
+
+ sync_pb::EntitySpecifics specifics;
+ syncer::AddDefaultFieldValue(it.Get(), &specifics);
+ EXPECT_TRUE(specifics.IsInitialized());
+
+ std::string tmp;
+ EXPECT_TRUE(specifics.SerializeToString(&tmp));
+
+ sync_pb::EntitySpecifics from_string;
+ EXPECT_TRUE(from_string.ParseFromString(tmp));
+ EXPECT_TRUE(from_string.IsInitialized());
+
+ EXPECT_EQ(it.Get(), syncer::GetModelTypeFromSpecifics(from_string));
+ }
+}
+
} // namespace
} // namespace syncer
« no previous file with comments | « sync/protocol/sync.proto ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698