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

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

Issue 2984403002: dart2js_native tests: Migrate 'native STRING' to JS-calls (Closed)
Patch Set: the rest of the files Created 3 years, 4 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
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 "native_testing.dart"; 5 import "native_testing.dart";
6 6
7 // Test that native classes and ordinary Dart classes can both use the same 7 // Test that native classes and ordinary Dart classes can both use the same
8 // ordinary Dart classes as a mixin. 8 // ordinary Dart classes as a mixin.
9 9
10 @Native("A") 10 @Native("A")
(...skipping 22 matching lines...) Expand all
33 } 33 }
34 34
35 class D extends C with M { 35 class D extends C with M {
36 bar() => 'D-bar -> ${baz()}'; 36 bar() => 'D-bar -> ${baz()}';
37 get mm => 'D.mm($cc)'; 37 get mm => 'D.mm($cc)';
38 } 38 }
39 39
40 makeA() native; 40 makeA() native;
41 makeB() native; 41 makeB() native;
42 42
43 void setup() native """ 43 void setup() {
44 function A() {this.aa = 'aa'} 44 JS('', r"""
45 function B() {this.aa = 'bb'} 45 (function(){
46 makeA = function(){return new A;}; 46 function A() {this.aa = 'aa'}
47 makeB = function(){return new B;}; 47 function B() {this.aa = 'bb'}
48 makeA = function(){return new A()};
49 makeB = function(){return new B()};
48 50
49 self.nativeConstructor(A); 51 self.nativeConstructor(A);
50 self.nativeConstructor(B); 52 self.nativeConstructor(B);
51 """; 53 })()""");
54 }
52 55
53 main() { 56 main() {
54 nativeTesting(); 57 nativeTesting();
55 setup(); 58 setup();
56 var things = [makeA, makeB, () => new C(), () => new D(), () => new M()] 59 var things = [makeA, makeB, () => new C(), () => new D(), () => new M()]
57 .map((f) => f()) 60 .map((f) => f())
58 .toList(); 61 .toList();
59 var a = things[0]; 62 var a = things[0];
60 var b = things[1]; 63 var b = things[1];
61 var c = things[2]; 64 var c = things[2];
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 103
101 Expect.equals("M-foo D.mm(cc)", d.foo()); 104 Expect.equals("M-foo D.mm(cc)", d.foo());
102 Expect.equals("D-bar -> C-baz cc", d.bar()); 105 Expect.equals("D-bar -> C-baz cc", d.bar());
103 Expect.equals("C-baz cc", d.baz()); 106 Expect.equals("C-baz cc", d.baz());
104 Expect.isFalse(d is A); 107 Expect.isFalse(d is A);
105 Expect.isFalse(d is B); 108 Expect.isFalse(d is B);
106 Expect.isTrue(d is C); 109 Expect.isTrue(d is C);
107 Expect.isTrue(d is D); 110 Expect.isTrue(d is D);
108 Expect.isTrue(d is M); 111 Expect.isTrue(d is M);
109 } 112 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698