Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(586)

Unified Diff: tests/isolate/browser/package_resolve_browser_hook2_test.dart

Issue 2495383003: Add implementation of Isolate.resolvePackageUri for dart2js. (Closed)
Patch Set: cl comments Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: tests/isolate/browser/package_resolve_browser_hook2_test.dart
diff --git a/tests/isolate/browser/package_resolve_browser_hook2_test.dart b/tests/isolate/browser/package_resolve_browser_hook2_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..77683381e84288acb904c52ab59b349af6d986f3
--- /dev/null
+++ b/tests/isolate/browser/package_resolve_browser_hook2_test.dart
@@ -0,0 +1,28 @@
+// 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:js';
+import 'dart:isolate';
+import 'package:unittest/unittest.dart';
+import 'package:unittest/html_config.dart';
+
+main() async {
+ useHtmlConfiguration();
+
+ setUp(() {
+ context['defaultPackagesBase'] = 'path1/';
+ });
+
+ test('hook overrides package-uri resolution', () async {
+ var uri = await Isolate.resolvePackageUri(Uri.parse('package:foo/bar.txt'));
+ expect(uri, Uri.base.resolve('path1/foo/bar.txt'));
+ });
+
+ test('hook is read once, on the first use of resolvePackageUri', () async {
+ await Isolate.resolvePackageUri(Uri.parse('package:foo/bar.txt'));
+ context['defaultPackagesBase'] = 'path2/';
+ var uri = await Isolate.resolvePackageUri(Uri.parse('package:foo/bar.txt'));
+ expect(uri, Uri.base.resolve('path1/foo/bar.txt'));
+ });
+}
« no previous file with comments | « sdk/lib/_internal/js_runtime/lib/isolate_patch.dart ('k') | tests/isolate/browser/package_resolve_browser_hook_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698