OLD | NEW |
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/api_type_reference_map.h" | 8 #include "extensions/renderer/api_type_reference_map.h" |
9 #include "extensions/renderer/argument_spec.h" | 9 #include "extensions/renderer/argument_spec.h" |
10 #include "gin/converter.h" | 10 #include "gin/converter.h" |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 "Object.defineProperty(\n" | 261 "Object.defineProperty(\n" |
262 " x, 'prop2',\n" | 262 " x, 'prop2',\n" |
263 " { get: () => { throw new Error('Badness'); } });\n" | 263 " { get: () => { throw new Error('Badness'); } });\n" |
264 "x;", | 264 "x;", |
265 "Uncaught Error: Badness"); | 265 "Uncaught Error: Badness"); |
266 } | 266 } |
267 | 267 |
268 { | 268 { |
269 const char kFunctionSpec[] = "{ 'type': 'function' }"; | 269 const char kFunctionSpec[] = "{ 'type': 'function' }"; |
270 ArgumentSpec spec(*ValueFromString(kFunctionSpec)); | 270 ArgumentSpec spec(*ValueFromString(kFunctionSpec)); |
| 271 // Functions are parsed to empty dictionary values. |
| 272 ExpectSuccess(spec, "(function() {})", "{}"); |
271 ExpectSuccessWithNoConversion(spec, "(function() {})"); | 273 ExpectSuccessWithNoConversion(spec, "(function() {})"); |
272 ExpectSuccessWithNoConversion(spec, "(function(a, b) { a(); b(); })"); | 274 ExpectSuccessWithNoConversion(spec, "(function(a, b) { a(); b(); })"); |
273 ExpectSuccessWithNoConversion(spec, "(function(a, b) { a(); b(); })"); | 275 ExpectSuccessWithNoConversion(spec, "(function(a, b) { a(); b(); })"); |
274 ExpectFailureWithNoConversion(spec, "({a: function() {}})"); | 276 ExpectFailureWithNoConversion(spec, "({a: function() {}})"); |
275 ExpectFailureWithNoConversion(spec, "([function() {}])"); | 277 ExpectFailureWithNoConversion(spec, "([function() {}])"); |
276 ExpectFailureWithNoConversion(spec, "1"); | 278 ExpectFailureWithNoConversion(spec, "1"); |
277 } | 279 } |
278 | 280 |
279 { | 281 { |
280 const char kBinarySpec[] = "{ 'type': 'binary' }"; | 282 const char kBinarySpec[] = "{ 'type': 'binary' }"; |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
576 ExpectFailure(spec, "({})"); | 578 ExpectFailure(spec, "({})"); |
577 ExpectFailure(spec, | 579 ExpectFailure(spec, |
578 "(function() {\n" | 580 "(function() {\n" |
579 " function otherClass() {}\n" | 581 " function otherClass() {}\n" |
580 " return new otherClass();\n" | 582 " return new otherClass();\n" |
581 "})()"); | 583 "})()"); |
582 } | 584 } |
583 } | 585 } |
584 | 586 |
585 } // namespace extensions | 587 } // namespace extensions |
OLD | NEW |