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