dart-sdk/tests/isolate/browser/package_resolve_browser_hook_test.dart
Sigmund Cherem f460a8706d Add implementation of Isolate.resolvePackageUri for dart2js.
This uses 'packages/' as the default base to resolve uris from, but also exposes
a hook to allow users to overwrite it.

BUG= https://github.com/dart-lang/sdk/issues/25594
R=het@google.com, lrn@google.com

Review URL: https://codereview.chromium.org/2495383003 .
2016-11-14 15:11:49 -08:00

17 lines
605 B
Dart

// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'dart:isolate';
import 'package:unittest/unittest.dart';
import 'package:unittest/html_config.dart';
main() async {
useHtmlConfiguration();
test('defaultPackagesBase hook overrides package-uri resolution', () async {
var uri = await Isolate.resolvePackageUri(Uri.parse('package:foo/bar.txt'));
expect(uri, Uri.base.resolve('path/set/from/hook/foo/bar.txt'));
});
}