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

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

Issue 2379173002: Add native_testing library to mock @Native classes (Closed)
Patch Set: xxx 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 (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 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. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 import "dart:_js_helper"; 5 import "native_testing.dart";
6 import "package:expect/expect.dart";
7 6
8 // Test to see if resolving a hidden native class's method interferes with 7 // Test to see if resolving a hidden native class's method interferes with
9 // subsequent resolving the subclass's method. This might happen if the 8 // subsequent resolving the subclass's method. This might happen if the
10 // superclass caches the method in the prototype, so shadowing the dispatcher 9 // superclass caches the method in the prototype, so shadowing the dispatcher
11 // stored on Object.prototype. 10 // stored on Object.prototype.
12 11
13 @Native("A") 12 @Native("A")
14 class A { 13 class A {
15 foo() => 'A.foo ${bar()}'; 14 foo() => 'A.foo ${bar()}';
16 bar() => 'A.bar'; 15 bar() => 'A.bar';
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 inherits(B, A); 54 inherits(B, A);
56 function C(){} 55 function C(){}
57 inherits(C, B); 56 inherits(C, B);
58 function D(){} 57 function D(){}
59 inherits(D, C); 58 inherits(D, C);
60 59
61 makeA = function(){return new A}; 60 makeA = function(){return new A};
62 makeB = function(){return new B}; 61 makeB = function(){return new B};
63 makeC = function(){return new C}; 62 makeC = function(){return new C};
64 makeD = function(){return new D}; 63 makeD = function(){return new D};
64
65 self.nativeConstructor(A);
66 self.nativeConstructor(B);
67 self.nativeConstructor(C);
68 self.nativeConstructor(D);
65 """; 69 """;
66 70
67 main() { 71 main() {
72 nativeTesting();
68 setup(); 73 setup();
69 74
70 var a = makeA(); 75 var a = makeA();
71 var b = makeB(); 76 var b = makeB();
72 var c = makeC(); 77 var c = makeC();
73 var d = makeD(); 78 var d = makeD();
74 79
75 Expect.equals('A.foo A.bar', a.foo()); 80 Expect.equals('A.foo A.bar', a.foo());
76 Expect.equals('A.foo B.bar', b.foo()); 81 Expect.equals('A.foo B.bar', b.foo());
77 Expect.equals('C.foo; super.foo = A.foo C.bar', c.foo()); 82 Expect.equals('C.foo; super.foo = A.foo C.bar', c.foo());
78 Expect.equals('C.foo; super.foo = A.foo D.bar', d.foo()); 83 Expect.equals('C.foo; super.foo = A.foo D.bar', d.foo());
79 } 84 }
OLDNEW
« no previous file with comments | « tests/compiler/dart2js_native/subclassing_type_test.dart ('k') | tests/compiler/dart2js_native/super_property_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698