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

Unified Diff: components/sync/syncable/syncable_enum_conversions_unittest.cc

Issue 2130453004: [Sync] Move //sync to //components/sync. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 years, 5 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 | « components/sync/syncable/syncable_enum_conversions.cc ('k') | components/sync/syncable/syncable_id.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/sync/syncable/syncable_enum_conversions_unittest.cc
diff --git a/components/sync/syncable/syncable_enum_conversions_unittest.cc b/components/sync/syncable/syncable_enum_conversions_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..16896289d3ceea3c660bd5d53791aff32d5be0aa
--- /dev/null
+++ b/components/sync/syncable/syncable_enum_conversions_unittest.cc
@@ -0,0 +1,94 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Keep this file in sync with entry_kernel.h.
+
+#include "components/sync/syncable/syncable_enum_conversions.h"
+
+#include <string>
+
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace syncer {
+namespace syncable {
+namespace {
+
+class SyncableEnumConversionsTest : public testing::Test {};
+
+template <class T>
+void TestEnumStringFunction(const char* (*enum_string_fn)(T),
+ int enum_min,
+ int enum_max) {
+ EXPECT_LE(enum_min, enum_max);
+ for (int i = enum_min; i <= enum_max; ++i) {
+ const std::string& str = enum_string_fn(static_cast<T>(i));
+ EXPECT_FALSE(str.empty());
+ }
+}
+
+TEST_F(SyncableEnumConversionsTest, GetMetahandleFieldString) {
+ TestEnumStringFunction(GetMetahandleFieldString, INT64_FIELDS_BEGIN,
+ META_HANDLE);
+}
+
+TEST_F(SyncableEnumConversionsTest, GetBaseVersionString) {
+ TestEnumStringFunction(GetBaseVersionString, META_HANDLE + 1, BASE_VERSION);
+}
+
+TEST_F(SyncableEnumConversionsTest, GetInt64FieldString) {
+ TestEnumStringFunction(GetInt64FieldString, BASE_VERSION + 1,
+ INT64_FIELDS_END - 1);
+}
+
+TEST_F(SyncableEnumConversionsTest, GetTimeFieldString) {
+ TestEnumStringFunction(GetTimeFieldString, TIME_FIELDS_BEGIN,
+ TIME_FIELDS_END - 1);
+}
+
+TEST_F(SyncableEnumConversionsTest, GetIdFieldString) {
+ TestEnumStringFunction(GetIdFieldString, ID_FIELDS_BEGIN, ID_FIELDS_END - 1);
+}
+
+TEST_F(SyncableEnumConversionsTest, GetIndexedBitFieldString) {
+ TestEnumStringFunction(GetIndexedBitFieldString, BIT_FIELDS_BEGIN,
+ INDEXED_BIT_FIELDS_END - 1);
+}
+
+TEST_F(SyncableEnumConversionsTest, GetIsDelFieldString) {
+ TestEnumStringFunction(GetIsDelFieldString, INDEXED_BIT_FIELDS_END, IS_DEL);
+}
+
+TEST_F(SyncableEnumConversionsTest, GetBitFieldString) {
+ TestEnumStringFunction(GetBitFieldString, IS_DEL + 1, BIT_FIELDS_END - 1);
+}
+
+TEST_F(SyncableEnumConversionsTest, GetStringFieldString) {
+ TestEnumStringFunction(GetStringFieldString, STRING_FIELDS_BEGIN,
+ STRING_FIELDS_END - 1);
+}
+
+TEST_F(SyncableEnumConversionsTest, GetProtoFieldString) {
+ TestEnumStringFunction(GetProtoFieldString, PROTO_FIELDS_BEGIN,
+ PROTO_FIELDS_END - 1);
+}
+
+TEST_F(SyncableEnumConversionsTest, GetUniquePositionFieldString) {
+ TestEnumStringFunction(GetUniquePositionFieldString,
+ UNIQUE_POSITION_FIELDS_BEGIN,
+ UNIQUE_POSITION_FIELDS_END - 1);
+}
+
+TEST_F(SyncableEnumConversionsTest, GetAttachmentMetadataFieldString) {
+ TestEnumStringFunction(GetAttachmentMetadataFieldString,
+ ATTACHMENT_METADATA_FIELDS_BEGIN,
+ ATTACHMENT_METADATA_FIELDS_END - 1);
+}
+
+TEST_F(SyncableEnumConversionsTest, GetBitTempString) {
+ TestEnumStringFunction(GetBitTempString, BIT_TEMPS_BEGIN, BIT_TEMPS_END - 1);
+}
+
+} // namespace
+} // namespace syncable
+} // namespace syncer
« no previous file with comments | « components/sync/syncable/syncable_enum_conversions.cc ('k') | components/sync/syncable/syncable_id.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698