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

Side by Side Diff: extensions/renderer/argument_spec_unittest.cc

Issue 2438623002: [Extensions Bindings] Add APIBindingsSystem (Closed)
Patch Set: woot Created 4 years, 1 month 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/memory/ptr_util.h" 5 #include "base/memory/ptr_util.h"
6 #include "base/values.h" 6 #include "base/values.h"
7 #include "extensions/renderer/api_binding_test_util.h" 7 #include "extensions/renderer/api_binding_test_util.h"
8 #include "extensions/renderer/argument_spec.h" 8 #include "extensions/renderer/argument_spec.h"
9 #include "gin/converter.h" 9 #include "gin/converter.h"
10 #include "gin/public/isolate_holder.h" 10 #include "gin/public/isolate_holder.h"
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 ExpectSuccess(spec, "'foo'", "'foo'"); 123 ExpectSuccess(spec, "'foo'", "'foo'");
124 ExpectSuccess(spec, "'bar'", "'bar'"); 124 ExpectSuccess(spec, "'bar'", "'bar'");
125 ExpectFailure(spec, "['foo']"); 125 ExpectFailure(spec, "['foo']");
126 ExpectFailure(spec, "'fo'"); 126 ExpectFailure(spec, "'fo'");
127 ExpectFailure(spec, "'foobar'"); 127 ExpectFailure(spec, "'foobar'");
128 ExpectFailure(spec, "'baz'"); 128 ExpectFailure(spec, "'baz'");
129 ExpectFailure(spec, "''"); 129 ExpectFailure(spec, "''");
130 } 130 }
131 131
132 { 132 {
133 ArgumentSpec spec(*ValueFromString(
134 "{'type': 'string', 'enum': [{'name': 'foo'}, {'name': 'bar'}]}"));
135 ExpectSuccess(spec, "'foo'", "'foo'");
136 ExpectSuccess(spec, "'bar'", "'bar'");
137 ExpectFailure(spec, "['foo']");
138 ExpectFailure(spec, "'fo'");
139 ExpectFailure(spec, "'foobar'");
140 ExpectFailure(spec, "'baz'");
141 ExpectFailure(spec, "''");
142 }
143
144 {
133 ArgumentSpec spec(*ValueFromString("{'type': 'boolean'}")); 145 ArgumentSpec spec(*ValueFromString("{'type': 'boolean'}"));
134 ExpectSuccess(spec, "true", "true"); 146 ExpectSuccess(spec, "true", "true");
135 ExpectSuccess(spec, "false", "false"); 147 ExpectSuccess(spec, "false", "false");
136 ExpectFailure(spec, "1"); 148 ExpectFailure(spec, "1");
137 ExpectFailure(spec, "'true'"); 149 ExpectFailure(spec, "'true'");
138 ExpectFailure(spec, "null"); 150 ExpectFailure(spec, "null");
139 } 151 }
140 152
141 { 153 {
142 ArgumentSpec spec( 154 ArgumentSpec spec(
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 "{'type': 'array', 'items': {'$ref': 'refEnum'}}"; 280 "{'type': 'array', 'items': {'$ref': 'refEnum'}}";
269 ArgumentSpec spec(*ValueFromString(kRefEnumListSpec)); 281 ArgumentSpec spec(*ValueFromString(kRefEnumListSpec));
270 ExpectSuccess(spec, "['alpha']", "['alpha']"); 282 ExpectSuccess(spec, "['alpha']", "['alpha']");
271 ExpectSuccess(spec, "['alpha', 'alpha']", "['alpha','alpha']"); 283 ExpectSuccess(spec, "['alpha', 'alpha']", "['alpha','alpha']");
272 ExpectSuccess(spec, "['alpha', 'beta']", "['alpha','beta']"); 284 ExpectSuccess(spec, "['alpha', 'beta']", "['alpha','beta']");
273 ExpectFailure(spec, "['alpha', 'beta', 'gamma']"); 285 ExpectFailure(spec, "['alpha', 'beta', 'gamma']");
274 } 286 }
275 } 287 }
276 288
277 } // namespace extensions 289 } // namespace extensions
OLDNEW
« extensions/renderer/argument_spec.cc ('K') | « extensions/renderer/argument_spec.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698