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 <utility> | 6 #include <utility> |
7 | 7 |
8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
9 #include "base/values.h" | 9 #include "base/values.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 | 62 |
63 // Test functions that take a callback function as a parameter, with varying | 63 // Test functions that take a callback function as a parameter, with varying |
64 // callback signatures. | 64 // callback signatures. |
65 std::unique_ptr<base::ListValue> f4_results = Function4::Results::Create(); | 65 std::unique_ptr<base::ListValue> f4_results = Function4::Results::Create(); |
66 base::ListValue expected; | 66 base::ListValue expected; |
67 EXPECT_TRUE(f4_results->Equals(&expected)); | 67 EXPECT_TRUE(f4_results->Equals(&expected)); |
68 | 68 |
69 std::unique_ptr<base::ListValue> f5_results(Function5::Results::Create(13)); | 69 std::unique_ptr<base::ListValue> f5_results(Function5::Results::Create(13)); |
70 base::Value* f5_result_int = NULL; | 70 base::Value* f5_result_int = NULL; |
71 ASSERT_TRUE(f5_results->Get(0, &f5_result_int)); | 71 ASSERT_TRUE(f5_results->Get(0, &f5_result_int)); |
72 EXPECT_TRUE(f5_result_int->IsType(base::Value::TYPE_INTEGER)); | 72 EXPECT_TRUE(f5_result_int->IsType(base::Value::Type::INTEGER)); |
73 | 73 |
74 std::unique_ptr<base::ListValue> f6_results(Function6::Results::Create(a)); | 74 std::unique_ptr<base::ListValue> f6_results(Function6::Results::Create(a)); |
75 base::Value* f6_result_dict = NULL; | 75 base::Value* f6_result_dict = NULL; |
76 ASSERT_TRUE(f6_results->Get(0, &f6_result_dict)); | 76 ASSERT_TRUE(f6_results->Get(0, &f6_result_dict)); |
77 MyType1 c; | 77 MyType1 c; |
78 EXPECT_TRUE(MyType1::Populate(*f6_result_dict, &c)); | 78 EXPECT_TRUE(MyType1::Populate(*f6_result_dict, &c)); |
79 EXPECT_EQ(a.x, c.x); | 79 EXPECT_EQ(a.x, c.x); |
80 EXPECT_EQ(a.y, c.y); | 80 EXPECT_EQ(a.y, c.y); |
81 } | 81 } |
82 | 82 |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 &icon)); | 201 &icon)); |
202 base::ListValue list; | 202 base::ListValue list; |
203 list.Append(std::move(icon_props)); | 203 list.Append(std::move(icon_props)); |
204 std::unique_ptr<ObjectFunction1::Params> params = | 204 std::unique_ptr<ObjectFunction1::Params> params = |
205 ObjectFunction1::Params::Create(list); | 205 ObjectFunction1::Params::Create(list); |
206 ASSERT_TRUE(params.get() != NULL); | 206 ASSERT_TRUE(params.get() != NULL); |
207 std::string tmp; | 207 std::string tmp; |
208 EXPECT_TRUE(params->icon.additional_properties.GetString("hello", &tmp)); | 208 EXPECT_TRUE(params->icon.additional_properties.GetString("hello", &tmp)); |
209 EXPECT_EQ("world", tmp); | 209 EXPECT_EQ("world", tmp); |
210 } | 210 } |
OLD | NEW |