Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(617)

Side by Side Diff: tools/json_schema_compiler/test/idl_schemas_unittest.cc

Issue 11826020: IDL schema compiler: Fixed pseudo-random order (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Incorporate upstream changes. Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tools/json_schema_compiler/test/idl_basics.idl ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "base/values.h" 5 #include "base/values.h"
6 #include "tools/json_schema_compiler/test/idl_basics.h" 6 #include "tools/json_schema_compiler/test/idl_basics.h"
7 #include "tools/json_schema_compiler/test/idl_object_types.h" 7 #include "tools/json_schema_compiler/test/idl_object_types.h"
8 8
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 10
(...skipping 28 matching lines...) Expand all
39 ListValue list; 39 ListValue list;
40 list.Append(Value::CreateIntegerValue(5)); 40 list.Append(Value::CreateIntegerValue(5));
41 scoped_ptr<Function2::Params> f2_params = Function2::Params::Create(list); 41 scoped_ptr<Function2::Params> f2_params = Function2::Params::Create(list);
42 EXPECT_EQ(5, f2_params->x); 42 EXPECT_EQ(5, f2_params->x);
43 43
44 // Test Function3, which takes a MyType1 parameter. 44 // Test Function3, which takes a MyType1 parameter.
45 list.Clear(); 45 list.Clear();
46 DictionaryValue* tmp = new DictionaryValue(); 46 DictionaryValue* tmp = new DictionaryValue();
47 tmp->SetInteger("x", 17); 47 tmp->SetInteger("x", 17);
48 tmp->SetString("y", "hello"); 48 tmp->SetString("y", "hello");
49 tmp->SetString("z", "zstring");
50 tmp->SetString("a", "astring");
51 tmp->SetString("b", "bstring");
52 tmp->SetString("c", "cstring");
49 list.Append(tmp); 53 list.Append(tmp);
50 scoped_ptr<Function3::Params> f3_params = Function3::Params::Create(list); 54 scoped_ptr<Function3::Params> f3_params = Function3::Params::Create(list);
51 EXPECT_EQ(17, f3_params->arg.x); 55 EXPECT_EQ(17, f3_params->arg.x);
52 EXPECT_EQ("hello", f3_params->arg.y); 56 EXPECT_EQ("hello", f3_params->arg.y);
53 57
54 // Test functions that take a callback function as a parameter, with varying 58 // Test functions that take a callback function as a parameter, with varying
55 // callback signatures. 59 // callback signatures.
56 scoped_ptr<ListValue> f4_results = Function4::Results::Create(); 60 scoped_ptr<ListValue> f4_results = Function4::Results::Create();
57 ListValue expected; 61 ListValue expected;
58 EXPECT_TRUE(f4_results->Equals(&expected)); 62 EXPECT_TRUE(f4_results->Equals(&expected));
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 EXPECT_EQ("foo", *(f8_params->arg2)); 98 EXPECT_EQ("foo", *(f8_params->arg2));
95 99
96 // Test a function with an optional argument of custom type. 100 // Test a function with an optional argument of custom type.
97 list.Clear(); 101 list.Clear();
98 scoped_ptr<Function9::Params> f9_params = Function9::Params::Create(list); 102 scoped_ptr<Function9::Params> f9_params = Function9::Params::Create(list);
99 EXPECT_EQ(NULL, f9_params->arg.get()); 103 EXPECT_EQ(NULL, f9_params->arg.get());
100 list.Clear(); 104 list.Clear();
101 DictionaryValue* tmp = new DictionaryValue(); 105 DictionaryValue* tmp = new DictionaryValue();
102 tmp->SetInteger("x", 17); 106 tmp->SetInteger("x", 17);
103 tmp->SetString("y", "hello"); 107 tmp->SetString("y", "hello");
108 tmp->SetString("z", "zstring");
109 tmp->SetString("a", "astring");
110 tmp->SetString("b", "bstring");
111 tmp->SetString("c", "cstring");
104 list.Append(tmp); 112 list.Append(tmp);
105 f9_params = Function9::Params::Create(list); 113 f9_params = Function9::Params::Create(list);
106 ASSERT_TRUE(f9_params->arg.get() != NULL); 114 ASSERT_TRUE(f9_params->arg.get() != NULL);
107 MyType1* t1 = f9_params->arg.get(); 115 MyType1* t1 = f9_params->arg.get();
108 EXPECT_EQ(17, t1->x); 116 EXPECT_EQ(17, t1->x);
109 EXPECT_EQ("hello", t1->y); 117 EXPECT_EQ("hello", t1->y);
110 } 118 }
111 119
112 TEST(IdlCompiler, ArrayTypes) { 120 TEST(IdlCompiler, ArrayTypes) {
113 // Tests of a function that takes an integer and an array of integers. First 121 // Tests of a function that takes an integer and an array of integers. First
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 &icon)); 190 &icon));
183 ListValue list; 191 ListValue list;
184 list.Append(icon_props.release()); 192 list.Append(icon_props.release());
185 scoped_ptr<ObjectFunction1::Params> params = 193 scoped_ptr<ObjectFunction1::Params> params =
186 ObjectFunction1::Params::Create(list); 194 ObjectFunction1::Params::Create(list);
187 ASSERT_TRUE(params.get() != NULL); 195 ASSERT_TRUE(params.get() != NULL);
188 std::string tmp; 196 std::string tmp;
189 EXPECT_TRUE(params->icon.additional_properties.GetString("hello", &tmp)); 197 EXPECT_TRUE(params->icon.additional_properties.GetString("hello", &tmp));
190 EXPECT_EQ("world", tmp); 198 EXPECT_EQ("world", tmp);
191 } 199 }
OLDNEW
« no previous file with comments | « tools/json_schema_compiler/test/idl_basics.idl ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698