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 <memory> | 5 #include <memory> |
6 #include <string> | 6 #include <string> |
7 | 7 |
8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
9 #include "base/test/values_test_util.h" | 9 #include "base/test/values_test_util.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 ModelTypeToValue(model_type)); | 24 ModelTypeToValue(model_type)); |
25 } | 25 } |
26 base::ExpectStringValue("Top-level folder", | 26 base::ExpectStringValue("Top-level folder", |
27 ModelTypeToValue(TOP_LEVEL_FOLDER)); | 27 ModelTypeToValue(TOP_LEVEL_FOLDER)); |
28 base::ExpectStringValue("Unspecified", ModelTypeToValue(UNSPECIFIED)); | 28 base::ExpectStringValue("Unspecified", ModelTypeToValue(UNSPECIFIED)); |
29 } | 29 } |
30 | 30 |
31 TEST_F(ModelTypeTest, ModelTypeFromValue) { | 31 TEST_F(ModelTypeTest, ModelTypeFromValue) { |
32 for (int i = FIRST_REAL_MODEL_TYPE; i < MODEL_TYPE_COUNT; ++i) { | 32 for (int i = FIRST_REAL_MODEL_TYPE; i < MODEL_TYPE_COUNT; ++i) { |
33 ModelType model_type = ModelTypeFromInt(i); | 33 ModelType model_type = ModelTypeFromInt(i); |
34 std::unique_ptr<base::StringValue> value(ModelTypeToValue(model_type)); | 34 std::unique_ptr<base::Value> value(ModelTypeToValue(model_type)); |
35 EXPECT_EQ(model_type, ModelTypeFromValue(*value)); | 35 EXPECT_EQ(model_type, ModelTypeFromValue(*value)); |
36 } | 36 } |
37 } | 37 } |
38 | 38 |
39 TEST_F(ModelTypeTest, ModelTypeSetToValue) { | 39 TEST_F(ModelTypeTest, ModelTypeSetToValue) { |
40 const ModelTypeSet model_types(BOOKMARKS, APPS); | 40 const ModelTypeSet model_types(BOOKMARKS, APPS); |
41 | 41 |
42 std::unique_ptr<base::ListValue> value(ModelTypeSetToValue(model_types)); | 42 std::unique_ptr<base::ListValue> value(ModelTypeSetToValue(model_types)); |
43 EXPECT_EQ(2u, value->GetSize()); | 43 EXPECT_EQ(2u, value->GetSize()); |
44 std::string types[2]; | 44 std::string types[2]; |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 EXPECT_EQ(notified_model_type, model_type); | 184 EXPECT_EQ(notified_model_type, model_type); |
185 } else { | 185 } else { |
186 EXPECT_FALSE(ProtocolTypes().Has(model_type)); | 186 EXPECT_FALSE(ProtocolTypes().Has(model_type)); |
187 EXPECT_TRUE(notification_type.empty()); | 187 EXPECT_TRUE(notification_type.empty()); |
188 } | 188 } |
189 } | 189 } |
190 } | 190 } |
191 | 191 |
192 } // namespace | 192 } // namespace |
193 } // namespace syncer | 193 } // namespace syncer |
OLD | NEW |