| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Keep this file in sync with entry_kernel.h. | |
| 6 | |
| 7 #include "components/sync/syncable/syncable_enum_conversions.h" | 5 #include "components/sync/syncable/syncable_enum_conversions.h" |
| 8 | 6 |
| 9 #include <string> | 7 #include <string> |
| 10 | 8 |
| 11 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 12 | 10 |
| 13 namespace syncer { | 11 namespace syncer { |
| 14 namespace syncable { | 12 namespace syncable { |
| 15 namespace { | 13 namespace { |
| 16 | 14 |
| 15 // Keep this file in sync with entry_kernel.h. |
| 17 class SyncableEnumConversionsTest : public testing::Test {}; | 16 class SyncableEnumConversionsTest : public testing::Test {}; |
| 18 | 17 |
| 19 template <class T> | 18 template <class T> |
| 20 void TestEnumStringFunction(const char* (*enum_string_fn)(T), | 19 void TestEnumStringFunction(const char* (*enum_string_fn)(T), |
| 21 int enum_min, | 20 int enum_min, |
| 22 int enum_max) { | 21 int enum_max) { |
| 23 EXPECT_LE(enum_min, enum_max); | 22 EXPECT_LE(enum_min, enum_max); |
| 24 for (int i = enum_min; i <= enum_max; ++i) { | 23 for (int i = enum_min; i <= enum_max; ++i) { |
| 25 const std::string& str = enum_string_fn(static_cast<T>(i)); | 24 const std::string& str = enum_string_fn(static_cast<T>(i)); |
| 26 EXPECT_FALSE(str.empty()); | 25 EXPECT_FALSE(str.empty()); |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 ATTACHMENT_METADATA_FIELDS_END - 1); | 84 ATTACHMENT_METADATA_FIELDS_END - 1); |
| 86 } | 85 } |
| 87 | 86 |
| 88 TEST_F(SyncableEnumConversionsTest, GetBitTempString) { | 87 TEST_F(SyncableEnumConversionsTest, GetBitTempString) { |
| 89 TestEnumStringFunction(GetBitTempString, BIT_TEMPS_BEGIN, BIT_TEMPS_END - 1); | 88 TestEnumStringFunction(GetBitTempString, BIT_TEMPS_BEGIN, BIT_TEMPS_END - 1); |
| 90 } | 89 } |
| 91 | 90 |
| 92 } // namespace | 91 } // namespace |
| 93 } // namespace syncable | 92 } // namespace syncable |
| 94 } // namespace syncer | 93 } // namespace syncer |
| OLD | NEW |