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

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

Issue 2383273002: Revert "Add native_testing library to mock @Native classes" (Closed)
Patch Set: Created 4 years, 2 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 "dart:_js_helper";
6 import "package:expect/expect.dart";
6 7
7 // Test that native classes can use ordinary Dart classes as mixins. 8 // Test that native classes can use ordinary Dart classes as mixins.
8 9
9 @Native("A") 10 @Native("A")
10 class A { 11 class A {
11 foo() => "A-foo"; 12 foo() => "A-foo";
12 baz() => "A-baz"; 13 baz() => "A-baz";
13 } 14 }
14 15
15 @Native("B") 16 @Native("B")
(...skipping 11 matching lines...) Expand all
27 } 28 }
28 29
29 A makeA() native ; 30 A makeA() native ;
30 B makeB() native ; 31 B makeB() native ;
31 32
32 void setup() native """ 33 void setup() native """
33 function A() {} 34 function A() {}
34 function B() {} 35 function B() {}
35 makeA = function(){return new A;}; 36 makeA = function(){return new A;};
36 makeB = function(){return new B;}; 37 makeB = function(){return new B;};
37
38 self.nativeConstructor(A);
39 self.nativeConstructor(B);
40 """; 38 """;
41 39
42 main() { 40 main() {
43 nativeTesting();
44 setup(); 41 setup();
45 A a = makeA(); 42 A a = makeA();
46 Expect.equals("A-foo", a.foo()); 43 Expect.equals("A-foo", a.foo());
47 Expect.throws(() => a.bar(), (error) => error is NoSuchMethodError); 44 Expect.throws(() => a.bar(), (error) => error is NoSuchMethodError);
48 Expect.equals("A-baz", a.baz()); 45 Expect.equals("A-baz", a.baz());
49 Expect.isTrue(a is A); 46 Expect.isTrue(a is A);
50 Expect.isFalse(a is B); 47 Expect.isFalse(a is B);
51 Expect.isFalse(a is M1); 48 Expect.isFalse(a is M1);
52 Expect.isFalse(a is M2); 49 Expect.isFalse(a is M2);
53 50
(...skipping 17 matching lines...) Expand all
71 68
72 M2 m2 = new M2(); 69 M2 m2 = new M2();
73 Expect.equals("M2-foo", m2.foo()); 70 Expect.equals("M2-foo", m2.foo());
74 Expect.throws(() => m2.bar(), (error) => error is NoSuchMethodError); 71 Expect.throws(() => m2.bar(), (error) => error is NoSuchMethodError);
75 Expect.throws(() => m2.baz(), (error) => error is NoSuchMethodError); 72 Expect.throws(() => m2.baz(), (error) => error is NoSuchMethodError);
76 Expect.isFalse(m2 is A); 73 Expect.isFalse(m2 is A);
77 Expect.isFalse(m2 is B); 74 Expect.isFalse(m2 is B);
78 Expect.isFalse(m2 is M1); 75 Expect.isFalse(m2 is M1);
79 Expect.isTrue(m2 is M2); 76 Expect.isTrue(m2 is M2);
80 } 77 }
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