OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2015, 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 'dart:js'; |
| 6 import 'dart:isolate'; |
| 7 import 'package:unittest/unittest.dart'; |
| 8 import 'package:unittest/html_config.dart'; |
| 9 |
| 10 main() async { |
| 11 useHtmlConfiguration(); |
| 12 |
| 13 setUp(() { |
| 14 context['defaultPackagesBase'] = 'path1/'; |
| 15 }); |
| 16 |
| 17 test('hook overrides package-uri resolution', () async { |
| 18 var uri = await Isolate.resolvePackageUri(Uri.parse('package:foo/bar.txt')); |
| 19 expect(uri, Uri.base.resolve('path1/foo/bar.txt')); |
| 20 }); |
| 21 |
| 22 test('hook is read once, on the first use of resolvePackageUri', () async { |
| 23 await Isolate.resolvePackageUri(Uri.parse('package:foo/bar.txt')); |
| 24 context['defaultPackagesBase'] = 'path2/'; |
| 25 var uri = await Isolate.resolvePackageUri(Uri.parse('package:foo/bar.txt')); |
| 26 expect(uri, Uri.base.resolve('path1/foo/bar.txt')); |
| 27 }); |
| 28 } |
OLD | NEW |