| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file |
| 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. |
| 4 |
| 5 import 'package:async_helper/async_helper.dart'; |
| 6 import 'package:expect/expect.dart'; |
| 7 |
| 8 import 'deferred_custom_loader_lib.dart' deferred as def; |
| 9 |
| 10 void setup() native """ |
| 11 // In d8 we don't have any way to load the content of the file, so just use |
| 12 // the preamble's loader. |
| 13 if (!self.dartDeferredLibraryLoader) { |
| 14 self.dartDeferredLibraryLoader = function(uri, success, error) { |
| 15 var req = new XMLHttpRequest(); |
| 16 req.addEventListener("load", function() { |
| 17 eval(this.responseText); |
| 18 success(); |
| 19 }); |
| 20 req.open("GET", uri); |
| 21 req.send(); |
| 22 }; |
| 23 } |
| 24 """; |
| 25 |
| 26 |
| 27 runTest() async { |
| 28 setup(); |
| 29 await def.loadLibrary(); |
| 30 Expect.equals(499, def.foo()); |
| 31 } |
| 32 |
| 33 main() { |
| 34 asyncStart(); |
| 35 runTest().then((_) => asyncEnd()); |
| 36 } |
| OLD | NEW |