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

Side by Side 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, 4 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 // Keep this file in sync with entry_kernel.h.
6
7 #include "components/sync/syncable/syncable_enum_conversions.h"
8
9 #include <string>
10
11 #include "testing/gtest/include/gtest/gtest.h"
12
13 namespace syncer {
14 namespace syncable {
15 namespace {
16
17 class SyncableEnumConversionsTest : public testing::Test {};
18
19 template <class T>
20 void TestEnumStringFunction(const char* (*enum_string_fn)(T),
21 int enum_min,
22 int enum_max) {
23 EXPECT_LE(enum_min, enum_max);
24 for (int i = enum_min; i <= enum_max; ++i) {
25 const std::string& str = enum_string_fn(static_cast<T>(i));
26 EXPECT_FALSE(str.empty());
27 }
28 }
29
30 TEST_F(SyncableEnumConversionsTest, GetMetahandleFieldString) {
31 TestEnumStringFunction(GetMetahandleFieldString, INT64_FIELDS_BEGIN,
32 META_HANDLE);
33 }
34
35 TEST_F(SyncableEnumConversionsTest, GetBaseVersionString) {
36 TestEnumStringFunction(GetBaseVersionString, META_HANDLE + 1, BASE_VERSION);
37 }
38
39 TEST_F(SyncableEnumConversionsTest, GetInt64FieldString) {
40 TestEnumStringFunction(GetInt64FieldString, BASE_VERSION + 1,
41 INT64_FIELDS_END - 1);
42 }
43
44 TEST_F(SyncableEnumConversionsTest, GetTimeFieldString) {
45 TestEnumStringFunction(GetTimeFieldString, TIME_FIELDS_BEGIN,
46 TIME_FIELDS_END - 1);
47 }
48
49 TEST_F(SyncableEnumConversionsTest, GetIdFieldString) {
50 TestEnumStringFunction(GetIdFieldString, ID_FIELDS_BEGIN, ID_FIELDS_END - 1);
51 }
52
53 TEST_F(SyncableEnumConversionsTest, GetIndexedBitFieldString) {
54 TestEnumStringFunction(GetIndexedBitFieldString, BIT_FIELDS_BEGIN,
55 INDEXED_BIT_FIELDS_END - 1);
56 }
57
58 TEST_F(SyncableEnumConversionsTest, GetIsDelFieldString) {
59 TestEnumStringFunction(GetIsDelFieldString, INDEXED_BIT_FIELDS_END, IS_DEL);
60 }
61
62 TEST_F(SyncableEnumConversionsTest, GetBitFieldString) {
63 TestEnumStringFunction(GetBitFieldString, IS_DEL + 1, BIT_FIELDS_END - 1);
64 }
65
66 TEST_F(SyncableEnumConversionsTest, GetStringFieldString) {
67 TestEnumStringFunction(GetStringFieldString, STRING_FIELDS_BEGIN,
68 STRING_FIELDS_END - 1);
69 }
70
71 TEST_F(SyncableEnumConversionsTest, GetProtoFieldString) {
72 TestEnumStringFunction(GetProtoFieldString, PROTO_FIELDS_BEGIN,
73 PROTO_FIELDS_END - 1);
74 }
75
76 TEST_F(SyncableEnumConversionsTest, GetUniquePositionFieldString) {
77 TestEnumStringFunction(GetUniquePositionFieldString,
78 UNIQUE_POSITION_FIELDS_BEGIN,
79 UNIQUE_POSITION_FIELDS_END - 1);
80 }
81
82 TEST_F(SyncableEnumConversionsTest, GetAttachmentMetadataFieldString) {
83 TestEnumStringFunction(GetAttachmentMetadataFieldString,
84 ATTACHMENT_METADATA_FIELDS_BEGIN,
85 ATTACHMENT_METADATA_FIELDS_END - 1);
86 }
87
88 TEST_F(SyncableEnumConversionsTest, GetBitTempString) {
89 TestEnumStringFunction(GetBitTempString, BIT_TEMPS_BEGIN, BIT_TEMPS_END - 1);
90 }
91
92 } // namespace
93 } // namespace syncable
94 } // namespace syncer
OLDNEW
« 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