OLD | NEW |
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 "package:expect/expect.dart"; | 5 import 'native_testing.dart'; |
6 import 'dart:_js_helper' show Native, Creates, setNativeSubclassDispatchRecord; | 6 import 'dart:_js_helper' show setNativeSubclassDispatchRecord; |
7 import 'dart:_interceptors' show Interceptor, findInterceptorForType; | 7 import 'dart:_interceptors' show Interceptor, findInterceptorForType; |
8 | 8 |
9 // Test calling convention on subclasses of native classes. | 9 // Test calling convention on subclasses of native classes. |
10 | 10 |
11 class M { | 11 class M { |
12 miz() => 'M'; | 12 miz() => 'M'; |
13 } | 13 } |
14 | 14 |
15 @Native("N") | 15 @Native("N") |
16 class N {} | 16 class N {} |
(...skipping 15 matching lines...) Expand all Loading... |
32 @Creates('=Object') | 32 @Creates('=Object') |
33 getBPrototype() native ; | 33 getBPrototype() native ; |
34 | 34 |
35 void setup() native r""" | 35 void setup() native r""" |
36 function B() {} | 36 function B() {} |
37 makeB = function(){return new B;}; | 37 makeB = function(){return new B;}; |
38 getBPrototype = function(){return B.prototype;}; | 38 getBPrototype = function(){return B.prototype;}; |
39 """; | 39 """; |
40 | 40 |
41 main() { | 41 main() { |
| 42 nativeTesting(); |
42 setup(); | 43 setup(); |
43 | 44 |
44 setNativeSubclassDispatchRecord(getBPrototype(), findInterceptorForType(B)); | 45 setNativeSubclassDispatchRecord(getBPrototype(), findInterceptorForType(B)); |
45 | 46 |
46 B b = makeB(); | 47 B b = makeB(); |
47 Expect.equals('M', b.callMiz()); | 48 Expect.equals('M', b.callMiz()); |
48 } | 49 } |
OLD | NEW |