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 "testing/gtest/include/gtest/gtest.h" | 5 #include "testing/gtest/include/gtest/gtest.h" |
6 #include "tools/json_schema_compiler/test/any.h" | 6 #include "tools/json_schema_compiler/test/any.h" |
7 | 7 |
8 using namespace test::api::any; | 8 using namespace test::api::any; |
9 | 9 |
10 TEST(JsonSchemaCompilerAnyTest, AnyTypePopulate) { | 10 TEST(JsonSchemaCompilerAnyTest, AnyTypePopulate) { |
(...skipping 20 matching lines...) Expand all Loading... |
31 TEST(JsonSchemaCompilerAnyTest, OptionalAnyParamsCreate) { | 31 TEST(JsonSchemaCompilerAnyTest, OptionalAnyParamsCreate) { |
32 { | 32 { |
33 std::unique_ptr<base::ListValue> params_value(new base::ListValue()); | 33 std::unique_ptr<base::ListValue> params_value(new base::ListValue()); |
34 std::unique_ptr<OptionalAny::Params> params( | 34 std::unique_ptr<OptionalAny::Params> params( |
35 OptionalAny::Params::Create(*params_value)); | 35 OptionalAny::Params::Create(*params_value)); |
36 EXPECT_TRUE(params.get()); | 36 EXPECT_TRUE(params.get()); |
37 EXPECT_FALSE(params->any_name.get()); | 37 EXPECT_FALSE(params->any_name.get()); |
38 } | 38 } |
39 { | 39 { |
40 std::unique_ptr<base::ListValue> params_value(new base::ListValue()); | 40 std::unique_ptr<base::ListValue> params_value(new base::ListValue()); |
41 std::unique_ptr<base::Value> param(new base::StringValue("asdf")); | 41 std::unique_ptr<base::Value> param(new base::Value("asdf")); |
42 params_value->Append(param->CreateDeepCopy()); | 42 params_value->Append(param->CreateDeepCopy()); |
43 std::unique_ptr<OptionalAny::Params> params( | 43 std::unique_ptr<OptionalAny::Params> params( |
44 OptionalAny::Params::Create(*params_value)); | 44 OptionalAny::Params::Create(*params_value)); |
45 ASSERT_TRUE(params); | 45 ASSERT_TRUE(params); |
46 ASSERT_TRUE(params->any_name); | 46 ASSERT_TRUE(params->any_name); |
47 EXPECT_TRUE(params->any_name->Equals(param.get())); | 47 EXPECT_TRUE(params->any_name->Equals(param.get())); |
48 } | 48 } |
49 { | 49 { |
50 std::unique_ptr<base::ListValue> params_value(new base::ListValue()); | 50 std::unique_ptr<base::ListValue> params_value(new base::ListValue()); |
51 std::unique_ptr<base::Value> param(new base::Value(true)); | 51 std::unique_ptr<base::Value> param(new base::Value(true)); |
52 params_value->Append(param->CreateDeepCopy()); | 52 params_value->Append(param->CreateDeepCopy()); |
53 std::unique_ptr<OptionalAny::Params> params( | 53 std::unique_ptr<OptionalAny::Params> params( |
54 OptionalAny::Params::Create(*params_value)); | 54 OptionalAny::Params::Create(*params_value)); |
55 ASSERT_TRUE(params); | 55 ASSERT_TRUE(params); |
56 ASSERT_TRUE(params->any_name); | 56 ASSERT_TRUE(params->any_name); |
57 EXPECT_TRUE(params->any_name->Equals(param.get())); | 57 EXPECT_TRUE(params->any_name->Equals(param.get())); |
58 } | 58 } |
59 } | 59 } |
OLD | NEW |