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

Side by Side Diff: tests/compiler/dart2js_native/native_mixin_multiple_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 can use ordinary Dart classes as mixins. 7 // Test that native classes can use ordinary Dart classes as mixins.
8 8
9 @Native("A") 9 @Native("A")
10 class A { 10 class A {
(...skipping 11 matching lines...) Expand all
22 baz() => "M1-baz"; 22 baz() => "M1-baz";
23 } 23 }
24 24
25 class M2 { 25 class M2 {
26 foo() => "M2-foo"; 26 foo() => "M2-foo";
27 } 27 }
28 28
29 A makeA() native; 29 A makeA() native;
30 B makeB() native; 30 B makeB() native;
31 31
32 void setup() native """ 32 void setup() {
33 function A() {} 33 JS('', r"""
34 function B() {} 34 (function(){
35 makeA = function(){return new A;}; 35 function A() {}
36 makeB = function(){return new B;}; 36 function B() {}
37 makeA = function(){return new A()};
38 makeB = function(){return new B()};
37 39
38 self.nativeConstructor(A); 40 self.nativeConstructor(A);
39 self.nativeConstructor(B); 41 self.nativeConstructor(B);
40 """; 42 })()""");
43 }
41 44
42 main() { 45 main() {
43 nativeTesting(); 46 nativeTesting();
44 setup(); 47 setup();
45 A a = makeA(); 48 A a = makeA();
46 Expect.equals("A-foo", a.foo()); 49 Expect.equals("A-foo", a.foo());
47 Expect.throws(() => a.bar(), (error) => error is NoSuchMethodError); 50 Expect.throws(() => a.bar(), (error) => error is NoSuchMethodError);
48 Expect.equals("A-baz", a.baz()); 51 Expect.equals("A-baz", a.baz());
49 Expect.isTrue(a is A); 52 Expect.isTrue(a is A);
50 Expect.isFalse(a is B); 53 Expect.isFalse(a is B);
(...skipping 20 matching lines...) Expand all
71 74
72 M2 m2 = new M2(); 75 M2 m2 = new M2();
73 Expect.equals("M2-foo", m2.foo()); 76 Expect.equals("M2-foo", m2.foo());
74 Expect.throws(() => m2.bar(), (error) => error is NoSuchMethodError); 77 Expect.throws(() => m2.bar(), (error) => error is NoSuchMethodError);
75 Expect.throws(() => m2.baz(), (error) => error is NoSuchMethodError); 78 Expect.throws(() => m2.baz(), (error) => error is NoSuchMethodError);
76 Expect.isFalse(m2 is A); 79 Expect.isFalse(m2 is A);
77 Expect.isFalse(m2 is B); 80 Expect.isFalse(m2 is B);
78 Expect.isFalse(m2 is M1); 81 Expect.isFalse(m2 is M1);
79 Expect.isTrue(m2 is M2); 82 Expect.isTrue(m2 is M2);
80 } 83 }
OLDNEW
« no previous file with comments | « tests/compiler/dart2js_native/native_mixin_multiple3_test.dart ('k') | tests/compiler/dart2js_native/native_mixin_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698