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 "native_testing.dart"; | 5 import "package:expect/expect.dart"; |
6 import 'dart:_js_helper' show setNativeSubclassDispatchRecord; | 6 import 'dart:_foreign_helper' show JS; |
| 7 import 'dart:_js_helper' show Native, Creates, setNativeSubclassDispatchRecord; |
7 import 'dart:_interceptors' | 8 import 'dart:_interceptors' |
8 show findInterceptorForType, findConstructorForNativeSubclassType; | 9 show findInterceptorForType, findConstructorForNativeSubclassType; |
9 | 10 |
10 // Test that subclasses of native classes can be initialized by calling the | 11 // Test that subclasses of native classes can be initialized by calling the |
11 // 'upgrade' constructor. | 12 // 'upgrade' constructor. |
12 | 13 |
13 var trace = []; | 14 var trace = []; |
14 | 15 |
15 var log; | 16 var log; |
16 | 17 |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 Expect.throws(action, (e) => true, "'$description must fail'"); | 151 Expect.throws(action, (e) => true, "'$description must fail'"); |
151 } | 152 } |
152 | 153 |
153 checkThrows(() => new B.one(), 'new B.one()'); | 154 checkThrows(() => new B.one(), 'new B.one()'); |
154 checkThrows(() => new B.two(), 'new B.two()'); | 155 checkThrows(() => new B.two(), 'new B.two()'); |
155 checkThrows(() => new B.three(), 'new B.three()'); | 156 checkThrows(() => new B.three(), 'new B.three()'); |
156 checkThrows(() => new B.three(1), 'new B.three(1)'); | 157 checkThrows(() => new B.three(1), 'new B.three(1)'); |
157 checkThrows(() => new B.three([]), 'new B.three([])'); | 158 checkThrows(() => new B.three([]), 'new B.three([])'); |
158 } | 159 } |
159 | 160 |
| 161 var inscrutable; |
| 162 |
160 main() { | 163 main() { |
161 nativeTesting(); | |
162 setup(); | 164 setup(); |
| 165 inscrutable = (x) => x; |
163 log = (message) { | 166 log = (message) { |
164 trace.add('$message'); | 167 trace.add('$message'); |
165 return message; | 168 return message; |
166 }; | 169 }; |
167 | 170 |
168 setNativeSubclassDispatchRecord(getBPrototype(), findInterceptorForType(B)); | 171 setNativeSubclassDispatchRecord(getBPrototype(), findInterceptorForType(B)); |
169 | 172 |
170 test_one(); | 173 test_one(); |
171 test_two(); | 174 test_two(); |
172 test_three(); | 175 test_three(); |
173 test_new(); | 176 test_new(); |
174 } | 177 } |
OLD | NEW |