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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 | 64 |
65 TEST_F(ModelTypeTest, IsRealDataType) { | 65 TEST_F(ModelTypeTest, IsRealDataType) { |
66 EXPECT_FALSE(IsRealDataType(UNSPECIFIED)); | 66 EXPECT_FALSE(IsRealDataType(UNSPECIFIED)); |
67 EXPECT_FALSE(IsRealDataType(MODEL_TYPE_COUNT)); | 67 EXPECT_FALSE(IsRealDataType(MODEL_TYPE_COUNT)); |
68 EXPECT_FALSE(IsRealDataType(TOP_LEVEL_FOLDER)); | 68 EXPECT_FALSE(IsRealDataType(TOP_LEVEL_FOLDER)); |
69 EXPECT_TRUE(IsRealDataType(FIRST_REAL_MODEL_TYPE)); | 69 EXPECT_TRUE(IsRealDataType(FIRST_REAL_MODEL_TYPE)); |
70 EXPECT_TRUE(IsRealDataType(BOOKMARKS)); | 70 EXPECT_TRUE(IsRealDataType(BOOKMARKS)); |
71 EXPECT_TRUE(IsRealDataType(APPS)); | 71 EXPECT_TRUE(IsRealDataType(APPS)); |
72 } | 72 } |
73 | 73 |
| 74 TEST_F(ModelTypeTest, IsProxyType) { |
| 75 EXPECT_FALSE(IsProxyType(BOOKMARKS)); |
| 76 EXPECT_FALSE(IsProxyType(MODEL_TYPE_COUNT)); |
| 77 EXPECT_TRUE(IsProxyType(PROXY_TABS)); |
| 78 } |
| 79 |
74 // Make sure we can convert ModelTypes to and from specifics field | 80 // Make sure we can convert ModelTypes to and from specifics field |
75 // numbers. | 81 // numbers. |
76 TEST_F(ModelTypeTest, ModelTypeToFromSpecificsFieldNumber) { | 82 TEST_F(ModelTypeTest, ModelTypeToFromSpecificsFieldNumber) { |
77 ModelTypeSet protocol_types = ProtocolTypes(); | 83 ModelTypeSet protocol_types = ProtocolTypes(); |
78 for (ModelTypeSet::Iterator iter = protocol_types.First(); iter.Good(); | 84 for (ModelTypeSet::Iterator iter = protocol_types.First(); iter.Good(); |
79 iter.Inc()) { | 85 iter.Inc()) { |
80 int field_number = GetSpecificsFieldNumberFromModelType(iter.Get()); | 86 int field_number = GetSpecificsFieldNumberFromModelType(iter.Get()); |
81 EXPECT_EQ(iter.Get(), | 87 EXPECT_EQ(iter.Get(), |
82 GetModelTypeFromSpecificsFieldNumber(field_number)); | 88 GetModelTypeFromSpecificsFieldNumber(field_number)); |
83 } | 89 } |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 sync_pb::EntitySpecifics from_string; | 139 sync_pb::EntitySpecifics from_string; |
134 EXPECT_TRUE(from_string.ParseFromString(tmp)); | 140 EXPECT_TRUE(from_string.ParseFromString(tmp)); |
135 EXPECT_TRUE(from_string.IsInitialized()); | 141 EXPECT_TRUE(from_string.IsInitialized()); |
136 | 142 |
137 EXPECT_EQ(it.Get(), syncer::GetModelTypeFromSpecifics(from_string)); | 143 EXPECT_EQ(it.Get(), syncer::GetModelTypeFromSpecifics(from_string)); |
138 } | 144 } |
139 } | 145 } |
140 | 146 |
141 } // namespace | 147 } // namespace |
142 } // namespace syncer | 148 } // namespace syncer |
OLD | NEW |