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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 | 63 |
64 TEST_F(ModelTypeTest, IsRealDataType) { | 64 TEST_F(ModelTypeTest, IsRealDataType) { |
65 EXPECT_FALSE(IsRealDataType(UNSPECIFIED)); | 65 EXPECT_FALSE(IsRealDataType(UNSPECIFIED)); |
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 |
| 74 // numbers. |
| 75 TEST_F(ModelTypeTest, ModelTypeToFromSpecificsFieldNumber) { |
| 76 for (int i = FIRST_REAL_MODEL_TYPE; i < MODEL_TYPE_COUNT; ++i) { |
| 77 ModelType model_type = ModelTypeFromInt(i); |
| 78 int field_number = GetSpecificsFieldNumberFromModelType(model_type); |
| 79 EXPECT_EQ(model_type, |
| 80 GetModelTypeFromSpecificsFieldNumber(field_number)); |
| 81 } |
| 82 } |
| 83 |
| 84 TEST_F(ModelTypeTest, ModelTypeOfInvalidSpecificsFieldNumber) { |
| 85 EXPECT_EQ(UNSPECIFIED, GetModelTypeFromSpecificsFieldNumber(0)); |
| 86 } |
| 87 |
73 } // namespace | 88 } // namespace |
74 } // namespace syncer | 89 } // namespace syncer |
OLD | NEW |