| 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 the .proto files in this directory. | |
| 6 | |
| 7 #include "components/sync/protocol/proto_enum_conversions.h" | 5 #include "components/sync/protocol/proto_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 { | 12 namespace { |
| 15 | 13 |
| 14 // Keep this file in sync with the .proto files in this directory. |
| 16 class ProtoEnumConversionsTest : public testing::Test {}; | 15 class ProtoEnumConversionsTest : public testing::Test {}; |
| 17 | 16 |
| 18 template <class T> | 17 template <class T> |
| 19 void TestEnumStringFunction(const char* (*enum_string_fn)(T), | 18 void TestEnumStringFunction(const char* (*enum_string_fn)(T), |
| 20 int enum_min, | 19 int enum_min, |
| 21 int enum_max) { | 20 int enum_max) { |
| 22 for (int i = enum_min; i <= enum_max; ++i) { | 21 for (int i = enum_min; i <= enum_max; ++i) { |
| 23 const std::string& str = enum_string_fn(static_cast<T>(i)); | 22 const std::string& str = enum_string_fn(static_cast<T>(i)); |
| 24 EXPECT_FALSE(str.empty()); | 23 EXPECT_FALSE(str.empty()); |
| 25 } | 24 } |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 sync_pb::SyncEnums::ErrorType_MAX); | 77 sync_pb::SyncEnums::ErrorType_MAX); |
| 79 } | 78 } |
| 80 | 79 |
| 81 TEST_F(ProtoEnumConversionsTest, GetActionString) { | 80 TEST_F(ProtoEnumConversionsTest, GetActionString) { |
| 82 TestEnumStringFunction(GetActionString, sync_pb::SyncEnums::Action_MIN, | 81 TestEnumStringFunction(GetActionString, sync_pb::SyncEnums::Action_MIN, |
| 83 sync_pb::SyncEnums::Action_MAX); | 82 sync_pb::SyncEnums::Action_MAX); |
| 84 } | 83 } |
| 85 | 84 |
| 86 } // namespace | 85 } // namespace |
| 87 } // namespace syncer | 86 } // namespace syncer |
| OLD | NEW |