OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #ifndef TOOLS_JSON_SCHEMA_COMPILER_TEST_TEST_UTIL_H_ | 5 #ifndef TOOLS_JSON_SCHEMA_COMPILER_TEST_TEST_UTIL_H_ |
6 #define TOOLS_JSON_SCHEMA_COMPILER_TEST_TEST_UTIL_H_ | 6 #define TOOLS_JSON_SCHEMA_COMPILER_TEST_TEST_UTIL_H_ |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include <memory> |
| 9 |
9 #include "base/strings/string_piece.h" | 10 #include "base/strings/string_piece.h" |
10 #include "base/values.h" | 11 #include "base/values.h" |
11 | 12 |
12 namespace json_schema_compiler { | 13 namespace json_schema_compiler { |
13 namespace test_util { | 14 namespace test_util { |
14 | 15 |
15 scoped_ptr<base::Value> ReadJson(const base::StringPiece& json); | 16 std::unique_ptr<base::Value> ReadJson(const base::StringPiece& json); |
16 | 17 |
17 template <typename T> | 18 template <typename T> |
18 std::vector<T> Vector(const T& a) { | 19 std::vector<T> Vector(const T& a) { |
19 std::vector<T> arr; | 20 std::vector<T> arr; |
20 arr.push_back(a); | 21 arr.push_back(a); |
21 return arr; | 22 return arr; |
22 } | 23 } |
23 template <typename T> | 24 template <typename T> |
24 std::vector<T> Vector(const T& a, const T& b) { | 25 std::vector<T> Vector(const T& a, const T& b) { |
25 std::vector<T> arr = Vector(a); | 26 std::vector<T> arr = Vector(a); |
26 arr.push_back(b); | 27 arr.push_back(b); |
27 return arr; | 28 return arr; |
28 } | 29 } |
29 template <typename T> | 30 template <typename T> |
30 std::vector<T> Vector(const T& a, const T& b, const T& c) { | 31 std::vector<T> Vector(const T& a, const T& b, const T& c) { |
31 std::vector<T> arr = Vector(a, b); | 32 std::vector<T> arr = Vector(a, b); |
32 arr.push_back(c); | 33 arr.push_back(c); |
33 return arr; | 34 return arr; |
34 } | 35 } |
35 | 36 |
36 scoped_ptr<base::ListValue> List(base::Value* a); | 37 std::unique_ptr<base::ListValue> List(base::Value* a); |
37 scoped_ptr<base::ListValue> List(base::Value* a, base::Value* b); | 38 std::unique_ptr<base::ListValue> List(base::Value* a, base::Value* b); |
38 scoped_ptr<base::ListValue> List(base::Value* a, | 39 std::unique_ptr<base::ListValue> List(base::Value* a, |
39 base::Value* b, | 40 base::Value* b, |
40 base::Value* c); | 41 base::Value* c); |
41 | 42 |
42 scoped_ptr<base::DictionaryValue> Dictionary( | 43 std::unique_ptr<base::DictionaryValue> Dictionary(const std::string& ak, |
43 const std::string& ak, base::Value* av); | 44 base::Value* av); |
44 scoped_ptr<base::DictionaryValue> Dictionary( | 45 std::unique_ptr<base::DictionaryValue> Dictionary(const std::string& ak, |
45 const std::string& ak, base::Value* av, | 46 base::Value* av, |
46 const std::string& bk, base::Value* bv); | 47 const std::string& bk, |
47 scoped_ptr<base::DictionaryValue> Dictionary( | 48 base::Value* bv); |
48 const std::string& ak, base::Value* av, | 49 std::unique_ptr<base::DictionaryValue> Dictionary(const std::string& ak, |
49 const std::string& bk, base::Value* bv, | 50 base::Value* av, |
50 const std::string& ck, base::Value* cv); | 51 const std::string& bk, |
| 52 base::Value* bv, |
| 53 const std::string& ck, |
| 54 base::Value* cv); |
51 | 55 |
52 } // namespace test_util | 56 } // namespace test_util |
53 } // namespace json_schema_compiler | 57 } // namespace json_schema_compiler |
54 | 58 |
55 #endif // TOOLS_JSON_SCHEMA_COMPILER_TEST_TEST_UTIL_H_ | 59 #endif // TOOLS_JSON_SCHEMA_COMPILER_TEST_TEST_UTIL_H_ |
OLD | NEW |