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

Side by Side Diff: tests/isolate/package_root_test.dart

Issue 1334353002: - Add getters for the current packageRoot or packageMap. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Updated documentation comment. Created 5 years, 2 months 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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:io'; 5 import 'dart:io';
6 import 'dart:isolate'; 6 import 'dart:isolate';
7 7
8 final SPAWN_PACKAGE_ROOT = Uri.parse("otherPackageRoot"); 8 final SPAWN_PACKAGE_ROOT = Uri.parse("file:///otherPackageRoot/");
9 9
10 void main([args, port]) { 10 main([args, port]) async {
11 if (port != null) { 11 if (port != null) {
12 testPackageRoot(args); 12 testPackageRoot(args);
13 return; 13 return;
14 } 14 }
15 var p = new ReceivePort(); 15 var p = new ReceivePort();
16 Isolate.spawnUri(Platform.script, 16 Isolate.spawnUri(Platform.script,
17 [p.sendPort, Platform.packageRoot], 17 [p.sendPort, (await Platform.packageRoot).toString()],
18 {}, 18 {},
19 packageRoot: SPAWN_PACKAGE_ROOT); 19 packageRoot: SPAWN_PACKAGE_ROOT);
20 p.listen((msg) { 20 p.listen((msg) {
21 p.close(); 21 p.close();
22 }); 22 });
23 } 23 }
24 24
25 25
26 void testPackageRoot(args) { 26 testPackageRoot(args) async {
27 var parentPackageRoot = args[1]; 27 var parentPackageRoot = args[1];
28 if (parentPackageRoot == Platform.packageRoot) { 28 var packageRoot = await Platform.packageRoot;
29 if (parentPackageRoot == packageRoot.toString()) {
29 throw "Got parent package root"; 30 throw "Got parent package root";
30 } 31 }
31 if (Uri.parse(Platform.packageRoot) != SPAWN_PACKAGE_ROOT) { 32 if (packageRoot != SPAWN_PACKAGE_ROOT) {
32 throw "Wrong package root"; 33 throw "Wrong package root: $packageRoot";
33 } 34 }
34 args[0].send(null); 35 args[0].send(null);
35 } 36 }
36
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698