| 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 #include "sync/internal_api/public/base/model_type.h" | 5 #include "sync/internal_api/public/base/model_type.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/test/values_test_util.h" | 10 #include "base/test/values_test_util.h" |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 EXPECT_FALSE(IsRealDataType(MODEL_TYPE_COUNT)); | 66 EXPECT_FALSE(IsRealDataType(MODEL_TYPE_COUNT)); |
| 67 EXPECT_FALSE(IsRealDataType(TOP_LEVEL_FOLDER)); | 67 EXPECT_FALSE(IsRealDataType(TOP_LEVEL_FOLDER)); |
| 68 EXPECT_TRUE(IsRealDataType(FIRST_REAL_MODEL_TYPE)); | 68 EXPECT_TRUE(IsRealDataType(FIRST_REAL_MODEL_TYPE)); |
| 69 EXPECT_TRUE(IsRealDataType(BOOKMARKS)); | 69 EXPECT_TRUE(IsRealDataType(BOOKMARKS)); |
| 70 EXPECT_TRUE(IsRealDataType(APPS)); | 70 EXPECT_TRUE(IsRealDataType(APPS)); |
| 71 } | 71 } |
| 72 | 72 |
| 73 // Make sure we can convert ModelTypes to and from specifics field | 73 // Make sure we can convert ModelTypes to and from specifics field |
| 74 // numbers. | 74 // numbers. |
| 75 TEST_F(ModelTypeTest, ModelTypeToFromSpecificsFieldNumber) { | 75 TEST_F(ModelTypeTest, ModelTypeToFromSpecificsFieldNumber) { |
| 76 for (int i = FIRST_REAL_MODEL_TYPE; i < MODEL_TYPE_COUNT; ++i) { | 76 ModelTypeSet protocol_types = ProtocolTypes(); |
| 77 ModelType model_type = ModelTypeFromInt(i); | 77 for (ModelTypeSet::Iterator iter = protocol_types.First(); iter.Good(); |
| 78 int field_number = GetSpecificsFieldNumberFromModelType(model_type); | 78 iter.Inc()) { |
| 79 EXPECT_EQ(model_type, | 79 int field_number = GetSpecificsFieldNumberFromModelType(iter.Get()); |
| 80 EXPECT_EQ(iter.Get(), |
| 80 GetModelTypeFromSpecificsFieldNumber(field_number)); | 81 GetModelTypeFromSpecificsFieldNumber(field_number)); |
| 81 } | 82 } |
| 82 } | 83 } |
| 83 | 84 |
| 84 TEST_F(ModelTypeTest, ModelTypeOfInvalidSpecificsFieldNumber) { | 85 TEST_F(ModelTypeTest, ModelTypeOfInvalidSpecificsFieldNumber) { |
| 85 EXPECT_EQ(UNSPECIFIED, GetModelTypeFromSpecificsFieldNumber(0)); | 86 EXPECT_EQ(UNSPECIFIED, GetModelTypeFromSpecificsFieldNumber(0)); |
| 86 } | 87 } |
| 87 | 88 |
| 88 } // namespace | 89 } // namespace |
| 89 } // namespace syncer | 90 } // namespace syncer |
| OLD | NEW |