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