Roll src/third_party/WebKit 6f84130:7353389 (svn 184386:184391)
[chromium-blink-merge.git] / tools / json_schema_compiler / test / test_util.h
blob7590004a7de139a4f0f01d44e9a17ea8748357ff
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
3 // found in the LICENSE file.
5 #ifndef TOOLS_JSON_SCHEMA_COMPILER_TEST_TEST_UTIL_H_
6 #define TOOLS_JSON_SCHEMA_COMPILER_TEST_TEST_UTIL_H_
8 #include "base/memory/scoped_ptr.h"
9 #include "base/strings/string_piece.h"
10 #include "base/values.h"
12 namespace json_schema_compiler {
13 namespace test_util {
15 scoped_ptr<base::Value> ReadJson(const base::StringPiece& json);
17 template <typename T>
18 std::vector<T> Vector(const T& a) {
19 std::vector<T> arr;
20 arr.push_back(a);
21 return arr;
23 template <typename T>
24 std::vector<T> Vector(const T& a, const T& b) {
25 std::vector<T> arr = Vector(a);
26 arr.push_back(b);
27 return arr;
29 template <typename T>
30 std::vector<T> Vector(const T& a, const T& b, const T& c) {
31 std::vector<T> arr = Vector(a, b);
32 arr.push_back(c);
33 return arr;
36 scoped_ptr<base::ListValue> List(base::Value* a);
37 scoped_ptr<base::ListValue> List(base::Value* a, base::Value* b);
38 scoped_ptr<base::ListValue> List(base::Value* a,
39 base::Value* b,
40 base::Value* c);
42 scoped_ptr<base::DictionaryValue> Dictionary(
43 const std::string& ak, base::Value* av);
44 scoped_ptr<base::DictionaryValue> Dictionary(
45 const std::string& ak, base::Value* av,
46 const std::string& bk, base::Value* bv);
47 scoped_ptr<base::DictionaryValue> Dictionary(
48 const std::string& ak, base::Value* av,
49 const std::string& bk, base::Value* bv,
50 const std::string& ck, base::Value* cv);
52 } // namespace test_util
53 } // namespace json_schema_compiler
55 #endif // TOOLS_JSON_SCHEMA_COMPILER_TEST_TEST_UTIL_H_