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

Side by Side Diff: tests/standalone/io/platform_test.dart

Issue 1307183002: Add access to the isolate package-root/package-map in Platform. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: replace packageRoot getter, remove C++ imp. Created 5 years, 3 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
« no previous file with comments | « sdk/lib/io/platform_impl.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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:async"; 5 import "dart:async";
6 import "dart:io"; 6 import "dart:io";
7 import "dart:isolate"; 7 import "dart:isolate";
8 8
9 import "package:async_helper/async_helper.dart"; 9 import "package:async_helper/async_helper.dart";
10 import "package:expect/expect.dart"; 10 import "package:expect/expect.dart";
(...skipping 30 matching lines...) Expand all
41 Expect.equals(Platform.resolvedExecutable.substring(1, 3), ':\\'); 41 Expect.equals(Platform.resolvedExecutable.substring(1, 3), ':\\');
42 } 42 }
43 // Move directory to be sure script is correct. 43 // Move directory to be sure script is correct.
44 var oldDir = Directory.current; 44 var oldDir = Directory.current;
45 Directory.current = Directory.current.parent; 45 Directory.current = Directory.current.parent;
46 Expect.isTrue(Platform.script.path. 46 Expect.isTrue(Platform.script.path.
47 endsWith('tests/standalone/io/platform_test.dart')); 47 endsWith('tests/standalone/io/platform_test.dart'));
48 Expect.isTrue(Platform.script.toFilePath().startsWith(oldDir.path)); 48 Expect.isTrue(Platform.script.toFilePath().startsWith(oldDir.path));
49 // Restore dir. 49 // Restore dir.
50 Directory.current = oldDir; 50 Directory.current = oldDir;
51 Directory packageRoot = new Directory(Platform.packageRoot); 51 Uri packageRoot = Platform.packageRoot;
52 Expect.isTrue(packageRoot.existsSync()); 52 Map packageMap = Platform.packageMap;
53 Expect.isTrue(new Directory("${packageRoot.path}/expect").existsSync()); 53 // One of packageRoot or packageMap is non-null.
54 Expect.isTrue(Platform.executableArguments.any( 54 Expect.isTrue((packageRoot == null) != (packageMap == null));
55 (arg) => arg.contains(Platform.packageRoot))); 55 if (packageRoot != null) {
56 Directory packageDir = new Directory.fromUri(packageRoot);
57 Expect.isTrue(packageRoot.existsSync());
58 Expect.isTrue(new Directory("${packageRoot.path}/expect").existsSync());
59 } else {
60 Uri expectUri = packageMap["expect"];
61 Expect.isNotNull(expectUri);
62 Directory expectDir = new Directory.fromUri(expectUri);
63 Expect.isTrue(expectDir.existsSync());
64 }
56 } 65 }
57 66
58 void f(reply) { 67 void f(reply) {
59 reply.send({"Platform.executable": Platform.executable, 68 reply.send({"Platform.executable": Platform.executable,
60 "Platform.script": Platform.script, 69 "Platform.script": Platform.script,
61 "Platform.packageRoot": Platform.packageRoot, 70 "Platform.packageRoot": Platform.packageRoot,
62 "Platform.executableArguments": Platform.executableArguments}); 71 "Platform.executableArguments": Platform.executableArguments});
63 } 72 }
64 73
65 testIsolate() { 74 testIsolate() {
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 Expect.throws(() => checkValidVersion('x.y.z')); 141 Expect.throws(() => checkValidVersion('x.y.z'));
133 } 142 }
134 143
135 main() { 144 main() {
136 // This tests assumes paths relative to dart main directory 145 // This tests assumes paths relative to dart main directory
137 Directory.current = Platform.script.resolve('../../..').toFilePath(); 146 Directory.current = Platform.script.resolve('../../..').toFilePath();
138 test(); 147 test();
139 testIsolate(); 148 testIsolate();
140 testVersion(); 149 testVersion();
141 } 150 }
OLDNEW
« no previous file with comments | « sdk/lib/io/platform_impl.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698