| 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 "tools/json_schema_compiler/test/choices.h" | 5 #include "tools/json_schema_compiler/test/choices.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/strings/string_piece.h" | 9 #include "base/strings/string_piece.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| 11 #include "tools/json_schema_compiler/test/test_util.h" | 11 #include "tools/json_schema_compiler/test/test_util.h" |
| 12 | 12 |
| 13 namespace { | 13 namespace { |
| 14 | 14 |
| 15 using namespace test::api::choices; | 15 using namespace test::api::choices; |
| 16 using json_schema_compiler::test_util::Dictionary; | 16 using json_schema_compiler::test_util::Dictionary; |
| 17 using json_schema_compiler::test_util::List; | 17 using json_schema_compiler::test_util::List; |
| 18 using json_schema_compiler::test_util::ReadJson; | 18 using json_schema_compiler::test_util::ReadJson; |
| 19 using json_schema_compiler::test_util::Vector; | 19 using json_schema_compiler::test_util::Vector; |
| 20 | 20 |
| 21 TEST(JsonSchemaCompilerChoicesTest, TakesIntegersParamsCreate) { | 21 TEST(JsonSchemaCompilerChoicesTest, TakesIntegersParamsCreate) { |
| 22 { | 22 { |
| 23 scoped_ptr<TakesIntegers::Params> params( | 23 std::unique_ptr<TakesIntegers::Params> params( |
| 24 TakesIntegers::Params::Create(*List(new base::FundamentalValue(true)))); | 24 TakesIntegers::Params::Create(*List(new base::FundamentalValue(true)))); |
| 25 EXPECT_FALSE(params); | 25 EXPECT_FALSE(params); |
| 26 } | 26 } |
| 27 { | 27 { |
| 28 scoped_ptr<TakesIntegers::Params> params( | 28 std::unique_ptr<TakesIntegers::Params> params( |
| 29 TakesIntegers::Params::Create(*List(new base::FundamentalValue(6)))); | 29 TakesIntegers::Params::Create(*List(new base::FundamentalValue(6)))); |
| 30 ASSERT_TRUE(params); | 30 ASSERT_TRUE(params); |
| 31 EXPECT_FALSE(params->nums.as_integers); | 31 EXPECT_FALSE(params->nums.as_integers); |
| 32 EXPECT_EQ(6, *params->nums.as_integer); | 32 EXPECT_EQ(6, *params->nums.as_integer); |
| 33 } | 33 } |
| 34 { | 34 { |
| 35 scoped_ptr<TakesIntegers::Params> params(TakesIntegers::Params::Create( | 35 std::unique_ptr<TakesIntegers::Params> params(TakesIntegers::Params::Create( |
| 36 *List(List(new base::FundamentalValue(2), | 36 *List(List(new base::FundamentalValue(2), new base::FundamentalValue(6), |
| 37 new base::FundamentalValue(6), | 37 new base::FundamentalValue(8)) |
| 38 new base::FundamentalValue(8)).release()))); | 38 .release()))); |
| 39 ASSERT_TRUE(params); | 39 ASSERT_TRUE(params); |
| 40 ASSERT_TRUE(params->nums.as_integers); | 40 ASSERT_TRUE(params->nums.as_integers); |
| 41 EXPECT_EQ(Vector(2, 6, 8), *params->nums.as_integers); | 41 EXPECT_EQ(Vector(2, 6, 8), *params->nums.as_integers); |
| 42 } | 42 } |
| 43 } | 43 } |
| 44 | 44 |
| 45 TEST(JsonSchemaCompilerChoicesTest, ObjectWithChoicesParamsCreate) { | 45 TEST(JsonSchemaCompilerChoicesTest, ObjectWithChoicesParamsCreate) { |
| 46 { | 46 { |
| 47 scoped_ptr<ObjectWithChoices::Params> params( | 47 std::unique_ptr<ObjectWithChoices::Params> params( |
| 48 ObjectWithChoices::Params::Create(*List( | 48 ObjectWithChoices::Params::Create(*List( |
| 49 Dictionary("strings", new base::StringValue("asdf")).release()))); | 49 Dictionary("strings", new base::StringValue("asdf")).release()))); |
| 50 ASSERT_TRUE(params); | 50 ASSERT_TRUE(params); |
| 51 EXPECT_FALSE(params->string_info.strings.as_strings); | 51 EXPECT_FALSE(params->string_info.strings.as_strings); |
| 52 EXPECT_EQ("asdf", *params->string_info.strings.as_string); | 52 EXPECT_EQ("asdf", *params->string_info.strings.as_string); |
| 53 EXPECT_FALSE(params->string_info.integers); | 53 EXPECT_FALSE(params->string_info.integers); |
| 54 } | 54 } |
| 55 { | 55 { |
| 56 scoped_ptr<ObjectWithChoices::Params> params( | 56 std::unique_ptr<ObjectWithChoices::Params> params( |
| 57 ObjectWithChoices::Params::Create(*List( | 57 ObjectWithChoices::Params::Create( |
| 58 Dictionary("strings", new base::StringValue("asdf"), | 58 *List(Dictionary("strings", new base::StringValue("asdf"), |
| 59 "integers", new base::FundamentalValue(6)).release()))); | 59 "integers", new base::FundamentalValue(6)) |
| 60 .release()))); |
| 60 ASSERT_TRUE(params); | 61 ASSERT_TRUE(params); |
| 61 EXPECT_FALSE(params->string_info.strings.as_strings); | 62 EXPECT_FALSE(params->string_info.strings.as_strings); |
| 62 EXPECT_EQ("asdf", *params->string_info.strings.as_string); | 63 EXPECT_EQ("asdf", *params->string_info.strings.as_string); |
| 63 ASSERT_TRUE(params->string_info.integers); | 64 ASSERT_TRUE(params->string_info.integers); |
| 64 EXPECT_FALSE(params->string_info.integers->as_integers); | 65 EXPECT_FALSE(params->string_info.integers->as_integers); |
| 65 EXPECT_EQ(6, *params->string_info.integers->as_integer); | 66 EXPECT_EQ(6, *params->string_info.integers->as_integer); |
| 66 } | 67 } |
| 67 } | 68 } |
| 68 | 69 |
| 69 // TODO(kalman): Clean up the rest of these tests to use the | 70 // TODO(kalman): Clean up the rest of these tests to use the |
| 70 // Vector/List/Dictionary helpers. | 71 // Vector/List/Dictionary helpers. |
| 71 | 72 |
| 72 TEST(JsonSchemaCompilerChoicesTest, ObjectWithChoicesParamsCreateFail) { | 73 TEST(JsonSchemaCompilerChoicesTest, ObjectWithChoicesParamsCreateFail) { |
| 73 { | 74 { |
| 74 scoped_ptr<base::DictionaryValue> object_param(new base::DictionaryValue()); | 75 std::unique_ptr<base::DictionaryValue> object_param( |
| 76 new base::DictionaryValue()); |
| 75 object_param->SetWithoutPathExpansion("strings", | 77 object_param->SetWithoutPathExpansion("strings", |
| 76 new base::FundamentalValue(5)); | 78 new base::FundamentalValue(5)); |
| 77 scoped_ptr<base::ListValue> params_value(new base::ListValue()); | 79 std::unique_ptr<base::ListValue> params_value(new base::ListValue()); |
| 78 params_value->Append(object_param.release()); | 80 params_value->Append(object_param.release()); |
| 79 scoped_ptr<ObjectWithChoices::Params> params( | 81 std::unique_ptr<ObjectWithChoices::Params> params( |
| 80 ObjectWithChoices::Params::Create(*params_value)); | 82 ObjectWithChoices::Params::Create(*params_value)); |
| 81 EXPECT_FALSE(params.get()); | 83 EXPECT_FALSE(params.get()); |
| 82 } | 84 } |
| 83 { | 85 { |
| 84 scoped_ptr<base::DictionaryValue> object_param(new base::DictionaryValue()); | 86 std::unique_ptr<base::DictionaryValue> object_param( |
| 87 new base::DictionaryValue()); |
| 85 object_param->SetWithoutPathExpansion("strings", | 88 object_param->SetWithoutPathExpansion("strings", |
| 86 new base::StringValue("asdf")); | 89 new base::StringValue("asdf")); |
| 87 object_param->SetWithoutPathExpansion("integers", | 90 object_param->SetWithoutPathExpansion("integers", |
| 88 new base::StringValue("asdf")); | 91 new base::StringValue("asdf")); |
| 89 scoped_ptr<base::ListValue> params_value(new base::ListValue()); | 92 std::unique_ptr<base::ListValue> params_value(new base::ListValue()); |
| 90 params_value->Append(object_param.release()); | 93 params_value->Append(object_param.release()); |
| 91 scoped_ptr<ObjectWithChoices::Params> params( | 94 std::unique_ptr<ObjectWithChoices::Params> params( |
| 92 ObjectWithChoices::Params::Create(*params_value)); | 95 ObjectWithChoices::Params::Create(*params_value)); |
| 93 EXPECT_FALSE(params.get()); | 96 EXPECT_FALSE(params.get()); |
| 94 } | 97 } |
| 95 { | 98 { |
| 96 scoped_ptr<base::DictionaryValue> object_param(new base::DictionaryValue()); | 99 std::unique_ptr<base::DictionaryValue> object_param( |
| 100 new base::DictionaryValue()); |
| 97 object_param->SetWithoutPathExpansion("integers", | 101 object_param->SetWithoutPathExpansion("integers", |
| 98 new base::FundamentalValue(6)); | 102 new base::FundamentalValue(6)); |
| 99 scoped_ptr<base::ListValue> params_value(new base::ListValue()); | 103 std::unique_ptr<base::ListValue> params_value(new base::ListValue()); |
| 100 params_value->Append(object_param.release()); | 104 params_value->Append(object_param.release()); |
| 101 scoped_ptr<ObjectWithChoices::Params> params( | 105 std::unique_ptr<ObjectWithChoices::Params> params( |
| 102 ObjectWithChoices::Params::Create(*params_value)); | 106 ObjectWithChoices::Params::Create(*params_value)); |
| 103 EXPECT_FALSE(params.get()); | 107 EXPECT_FALSE(params.get()); |
| 104 } | 108 } |
| 105 } | 109 } |
| 106 | 110 |
| 107 TEST(JsonSchemaCompilerChoicesTest, PopulateChoiceType) { | 111 TEST(JsonSchemaCompilerChoicesTest, PopulateChoiceType) { |
| 108 std::vector<std::string> strings = Vector(std::string("list"), | 112 std::vector<std::string> strings = Vector(std::string("list"), |
| 109 std::string("of"), | 113 std::string("of"), |
| 110 std::string("strings")); | 114 std::string("strings")); |
| 111 | 115 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 142 ASSERT_TRUE(ChoiceType::Populate(value, &out)); | 146 ASSERT_TRUE(ChoiceType::Populate(value, &out)); |
| 143 | 147 |
| 144 EXPECT_TRUE(value.Equals(out.ToValue().get())); | 148 EXPECT_TRUE(value.Equals(out.ToValue().get())); |
| 145 } | 149 } |
| 146 | 150 |
| 147 TEST(JsonSchemaCompilerChoicesTest, ReturnChoices) { | 151 TEST(JsonSchemaCompilerChoicesTest, ReturnChoices) { |
| 148 { | 152 { |
| 149 ReturnChoices::Results::Result results; | 153 ReturnChoices::Results::Result results; |
| 150 results.as_integers.reset(new std::vector<int>(Vector(1, 2))); | 154 results.as_integers.reset(new std::vector<int>(Vector(1, 2))); |
| 151 | 155 |
| 152 scoped_ptr<base::Value> results_value = results.ToValue(); | 156 std::unique_ptr<base::Value> results_value = results.ToValue(); |
| 153 ASSERT_TRUE(results_value); | 157 ASSERT_TRUE(results_value); |
| 154 | 158 |
| 155 base::ListValue expected; | 159 base::ListValue expected; |
| 156 expected.AppendInteger(1); | 160 expected.AppendInteger(1); |
| 157 expected.AppendInteger(2); | 161 expected.AppendInteger(2); |
| 158 | 162 |
| 159 EXPECT_TRUE(expected.Equals(results_value.get())); | 163 EXPECT_TRUE(expected.Equals(results_value.get())); |
| 160 } | 164 } |
| 161 { | 165 { |
| 162 ReturnChoices::Results::Result results; | 166 ReturnChoices::Results::Result results; |
| 163 results.as_integer.reset(new int(5)); | 167 results.as_integer.reset(new int(5)); |
| 164 | 168 |
| 165 scoped_ptr<base::Value> results_value = results.ToValue(); | 169 std::unique_ptr<base::Value> results_value = results.ToValue(); |
| 166 ASSERT_TRUE(results_value); | 170 ASSERT_TRUE(results_value); |
| 167 | 171 |
| 168 base::FundamentalValue expected(5); | 172 base::FundamentalValue expected(5); |
| 169 | 173 |
| 170 EXPECT_TRUE(expected.Equals(results_value.get())); | 174 EXPECT_TRUE(expected.Equals(results_value.get())); |
| 171 } | 175 } |
| 172 } | 176 } |
| 173 | 177 |
| 174 TEST(JsonSchemaCompilerChoicesTest, NestedChoices) { | 178 TEST(JsonSchemaCompilerChoicesTest, NestedChoices) { |
| 175 // These test both ToValue and FromValue for every legitimate configuration of | 179 // These test both ToValue and FromValue for every legitimate configuration of |
| 176 // NestedChoices. | 180 // NestedChoices. |
| 177 { | 181 { |
| 178 // The plain integer choice. | 182 // The plain integer choice. |
| 179 scoped_ptr<base::Value> value = ReadJson("42"); | 183 std::unique_ptr<base::Value> value = ReadJson("42"); |
| 180 scoped_ptr<NestedChoice> obj = NestedChoice::FromValue(*value); | 184 std::unique_ptr<NestedChoice> obj = NestedChoice::FromValue(*value); |
| 181 | 185 |
| 182 ASSERT_TRUE(obj); | 186 ASSERT_TRUE(obj); |
| 183 ASSERT_TRUE(obj->as_integer); | 187 ASSERT_TRUE(obj->as_integer); |
| 184 EXPECT_FALSE(obj->as_choice1); | 188 EXPECT_FALSE(obj->as_choice1); |
| 185 EXPECT_FALSE(obj->as_choice2); | 189 EXPECT_FALSE(obj->as_choice2); |
| 186 EXPECT_EQ(42, *obj->as_integer); | 190 EXPECT_EQ(42, *obj->as_integer); |
| 187 | 191 |
| 188 EXPECT_TRUE(base::Value::Equals(value.get(), obj->ToValue().get())); | 192 EXPECT_TRUE(base::Value::Equals(value.get(), obj->ToValue().get())); |
| 189 } | 193 } |
| 190 | 194 |
| 191 { | 195 { |
| 192 // The string choice within the first choice. | 196 // The string choice within the first choice. |
| 193 scoped_ptr<base::Value> value = ReadJson("\"foo\""); | 197 std::unique_ptr<base::Value> value = ReadJson("\"foo\""); |
| 194 scoped_ptr<NestedChoice> obj = NestedChoice::FromValue(*value); | 198 std::unique_ptr<NestedChoice> obj = NestedChoice::FromValue(*value); |
| 195 | 199 |
| 196 ASSERT_TRUE(obj); | 200 ASSERT_TRUE(obj); |
| 197 EXPECT_FALSE(obj->as_integer); | 201 EXPECT_FALSE(obj->as_integer); |
| 198 ASSERT_TRUE(obj->as_choice1); | 202 ASSERT_TRUE(obj->as_choice1); |
| 199 EXPECT_FALSE(obj->as_choice2); | 203 EXPECT_FALSE(obj->as_choice2); |
| 200 ASSERT_TRUE(obj->as_choice1->as_string); | 204 ASSERT_TRUE(obj->as_choice1->as_string); |
| 201 EXPECT_FALSE(obj->as_choice1->as_boolean); | 205 EXPECT_FALSE(obj->as_choice1->as_boolean); |
| 202 EXPECT_EQ("foo", *obj->as_choice1->as_string); | 206 EXPECT_EQ("foo", *obj->as_choice1->as_string); |
| 203 | 207 |
| 204 EXPECT_TRUE(base::Value::Equals(value.get(), obj->ToValue().get())); | 208 EXPECT_TRUE(base::Value::Equals(value.get(), obj->ToValue().get())); |
| 205 } | 209 } |
| 206 | 210 |
| 207 { | 211 { |
| 208 // The boolean choice within the first choice. | 212 // The boolean choice within the first choice. |
| 209 scoped_ptr<base::Value> value = ReadJson("true"); | 213 std::unique_ptr<base::Value> value = ReadJson("true"); |
| 210 scoped_ptr<NestedChoice> obj = NestedChoice::FromValue(*value); | 214 std::unique_ptr<NestedChoice> obj = NestedChoice::FromValue(*value); |
| 211 | 215 |
| 212 ASSERT_TRUE(obj); | 216 ASSERT_TRUE(obj); |
| 213 EXPECT_FALSE(obj->as_integer); | 217 EXPECT_FALSE(obj->as_integer); |
| 214 ASSERT_TRUE(obj->as_choice1); | 218 ASSERT_TRUE(obj->as_choice1); |
| 215 EXPECT_FALSE(obj->as_choice2); | 219 EXPECT_FALSE(obj->as_choice2); |
| 216 EXPECT_FALSE(obj->as_choice1->as_string); | 220 EXPECT_FALSE(obj->as_choice1->as_string); |
| 217 ASSERT_TRUE(obj->as_choice1->as_boolean); | 221 ASSERT_TRUE(obj->as_choice1->as_boolean); |
| 218 EXPECT_TRUE(*obj->as_choice1->as_boolean); | 222 EXPECT_TRUE(*obj->as_choice1->as_boolean); |
| 219 | 223 |
| 220 EXPECT_TRUE(base::Value::Equals(value.get(), obj->ToValue().get())); | 224 EXPECT_TRUE(base::Value::Equals(value.get(), obj->ToValue().get())); |
| 221 } | 225 } |
| 222 | 226 |
| 223 { | 227 { |
| 224 // The double choice within the second choice. | 228 // The double choice within the second choice. |
| 225 scoped_ptr<base::Value> value = ReadJson("42.0"); | 229 std::unique_ptr<base::Value> value = ReadJson("42.0"); |
| 226 scoped_ptr<NestedChoice> obj = NestedChoice::FromValue(*value); | 230 std::unique_ptr<NestedChoice> obj = NestedChoice::FromValue(*value); |
| 227 | 231 |
| 228 ASSERT_TRUE(obj); | 232 ASSERT_TRUE(obj); |
| 229 EXPECT_FALSE(obj->as_integer); | 233 EXPECT_FALSE(obj->as_integer); |
| 230 EXPECT_FALSE(obj->as_choice1); | 234 EXPECT_FALSE(obj->as_choice1); |
| 231 ASSERT_TRUE(obj->as_choice2); | 235 ASSERT_TRUE(obj->as_choice2); |
| 232 ASSERT_TRUE(obj->as_choice2->as_double); | 236 ASSERT_TRUE(obj->as_choice2->as_double); |
| 233 EXPECT_FALSE(obj->as_choice2->as_choice_type); | 237 EXPECT_FALSE(obj->as_choice2->as_choice_type); |
| 234 EXPECT_FALSE(obj->as_choice2->as_choice_types); | 238 EXPECT_FALSE(obj->as_choice2->as_choice_types); |
| 235 EXPECT_EQ(42.0, *obj->as_choice2->as_double); | 239 EXPECT_EQ(42.0, *obj->as_choice2->as_double); |
| 236 | 240 |
| 237 EXPECT_TRUE(base::Value::Equals(value.get(), obj->ToValue().get())); | 241 EXPECT_TRUE(base::Value::Equals(value.get(), obj->ToValue().get())); |
| 238 } | 242 } |
| 239 | 243 |
| 240 { | 244 { |
| 241 // The ChoiceType choice within the second choice. | 245 // The ChoiceType choice within the second choice. |
| 242 scoped_ptr<base::Value> value = ReadJson( | 246 std::unique_ptr<base::Value> value = |
| 243 "{\"integers\": [1, 2], \"strings\": \"foo\"}"); | 247 ReadJson("{\"integers\": [1, 2], \"strings\": \"foo\"}"); |
| 244 scoped_ptr<NestedChoice> obj = NestedChoice::FromValue(*value); | 248 std::unique_ptr<NestedChoice> obj = NestedChoice::FromValue(*value); |
| 245 | 249 |
| 246 ASSERT_TRUE(obj); | 250 ASSERT_TRUE(obj); |
| 247 EXPECT_FALSE(obj->as_integer); | 251 EXPECT_FALSE(obj->as_integer); |
| 248 EXPECT_FALSE(obj->as_choice1); | 252 EXPECT_FALSE(obj->as_choice1); |
| 249 ASSERT_TRUE(obj->as_choice2); | 253 ASSERT_TRUE(obj->as_choice2); |
| 250 EXPECT_FALSE(obj->as_choice2->as_double); | 254 EXPECT_FALSE(obj->as_choice2->as_double); |
| 251 ASSERT_TRUE(obj->as_choice2->as_choice_type); | 255 ASSERT_TRUE(obj->as_choice2->as_choice_type); |
| 252 EXPECT_FALSE(obj->as_choice2->as_choice_types); | 256 EXPECT_FALSE(obj->as_choice2->as_choice_types); |
| 253 { | 257 { |
| 254 ChoiceType* choice_type = obj->as_choice2->as_choice_type.get(); | 258 ChoiceType* choice_type = obj->as_choice2->as_choice_type.get(); |
| 255 ASSERT_TRUE(choice_type->integers.as_integers); | 259 ASSERT_TRUE(choice_type->integers.as_integers); |
| 256 EXPECT_FALSE(choice_type->integers.as_integer); | 260 EXPECT_FALSE(choice_type->integers.as_integer); |
| 257 EXPECT_EQ(Vector(1, 2), *choice_type->integers.as_integers); | 261 EXPECT_EQ(Vector(1, 2), *choice_type->integers.as_integers); |
| 258 ASSERT_TRUE(choice_type->strings); | 262 ASSERT_TRUE(choice_type->strings); |
| 259 EXPECT_FALSE(choice_type->strings->as_strings); | 263 EXPECT_FALSE(choice_type->strings->as_strings); |
| 260 ASSERT_TRUE(choice_type->strings->as_string); | 264 ASSERT_TRUE(choice_type->strings->as_string); |
| 261 EXPECT_EQ("foo", *choice_type->strings->as_string); | 265 EXPECT_EQ("foo", *choice_type->strings->as_string); |
| 262 } | 266 } |
| 263 | 267 |
| 264 EXPECT_TRUE(base::Value::Equals(value.get(), obj->ToValue().get())); | 268 EXPECT_TRUE(base::Value::Equals(value.get(), obj->ToValue().get())); |
| 265 } | 269 } |
| 266 | 270 |
| 267 { | 271 { |
| 268 // The array of ChoiceTypes within the second choice. | 272 // The array of ChoiceTypes within the second choice. |
| 269 scoped_ptr<base::Value> value = ReadJson( | 273 std::unique_ptr<base::Value> value = ReadJson( |
| 270 "[" | 274 "[" |
| 271 " {\"integers\": [1, 2], \"strings\": \"foo\"}," | 275 " {\"integers\": [1, 2], \"strings\": \"foo\"}," |
| 272 " {\"integers\": 3, \"strings\": [\"bar\", \"baz\"]}" | 276 " {\"integers\": 3, \"strings\": [\"bar\", \"baz\"]}" |
| 273 "]"); | 277 "]"); |
| 274 scoped_ptr<NestedChoice> obj = NestedChoice::FromValue(*value); | 278 std::unique_ptr<NestedChoice> obj = NestedChoice::FromValue(*value); |
| 275 | 279 |
| 276 ASSERT_TRUE(obj); | 280 ASSERT_TRUE(obj); |
| 277 EXPECT_FALSE(obj->as_integer); | 281 EXPECT_FALSE(obj->as_integer); |
| 278 EXPECT_FALSE(obj->as_choice1); | 282 EXPECT_FALSE(obj->as_choice1); |
| 279 ASSERT_TRUE(obj->as_choice2); | 283 ASSERT_TRUE(obj->as_choice2); |
| 280 EXPECT_FALSE(obj->as_choice2->as_double); | 284 EXPECT_FALSE(obj->as_choice2->as_double); |
| 281 EXPECT_FALSE(obj->as_choice2->as_choice_type); | 285 EXPECT_FALSE(obj->as_choice2->as_choice_type); |
| 282 ASSERT_TRUE(obj->as_choice2->as_choice_types); | 286 ASSERT_TRUE(obj->as_choice2->as_choice_types); |
| 283 { | 287 { |
| 284 std::vector<ChoiceType>* choice_types = | 288 std::vector<ChoiceType>* choice_types = |
| 285 obj->as_choice2->as_choice_types.get(); | 289 obj->as_choice2->as_choice_types.get(); |
| 286 // Bleh too much effort to test everything. | 290 // Bleh too much effort to test everything. |
| 287 ASSERT_EQ(2u, choice_types->size()); | 291 ASSERT_EQ(2u, choice_types->size()); |
| 288 } | 292 } |
| 289 | 293 |
| 290 EXPECT_TRUE(base::Value::Equals(value.get(), obj->ToValue().get())); | 294 EXPECT_TRUE(base::Value::Equals(value.get(), obj->ToValue().get())); |
| 291 } | 295 } |
| 292 } | 296 } |
| 293 | 297 |
| 294 } // namespace | 298 } // namespace |
| OLD | NEW |