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

Side by Side Diff: tests/compiler/dart2js_native/dispatch_property_initialization_test.dart

Issue 2359023002: Add another test for initializing dispatchPropertyName that runs outside the browser (Closed)
Patch Set: typo Created 4 years, 3 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 | « no previous file | 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
(Empty)
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file.
4
5 // Test for initialization of dispatchPropertyName.
6
7 import "package:expect/expect.dart";
8 import 'dart:_foreign_helper' show JS;
9 import 'dart:_js_helper' show Native;
10
11 @Native("Foo")
12 class Foo {
13 String method(String x) native;
14 }
15
16 makeFoo() native;
17
18 void setup() native r"""
19 function Foo() {}
20 Foo.prototype.method = function(x) { return 'Foo ' + x; }
21
22 self.makeFoo = function() { return new Foo(); }
23 """;
24
25
26 main() {
27 setup();
28
29 // If the dispatchPropertyName is uninitialized, it will be `undefined` or
30 // `null` instead of the secret string or Symbol. These properties on
31 // `Object.prototype` will be retrieved by the lookup instead of `undefined`
32 // for the dispatch record.
33 JS('', r'self.Object.prototype["undefined"] = {}');
34 JS('', r'self.Object.prototype["null"] = {}');
35 Expect.equals('Foo A', makeFoo().method('A'));
36
37 // Slightly different version that has malformed dispatch records.
38 JS('', r'self.Object.prototype["undefined"] = {p: false}');
39 JS('', r'self.Object.prototype["null"] = {p: false}');
40 Expect.equals('Foo B', makeFoo().method('B'));
41 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698