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

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

Issue 1529063006: - Implement Platform.packageRoot and Platform.packageConfig based (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years 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) 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 var pkgRootString = Platform.packageRoot;
52 Directory packageRoot = new Directory.fromUri(Uri.parse(pkgRootString));
52 Expect.isTrue(packageRoot.existsSync()); 53 Expect.isTrue(packageRoot.existsSync());
53 Expect.isTrue(new Directory("${packageRoot.path}/expect").existsSync()); 54 Expect.isTrue(new Directory("${packageRoot.path}/expect").existsSync());
54 Expect.isTrue(Platform.executableArguments.any( 55 Expect.isTrue(Platform.executableArguments.any(
55 (arg) => arg.contains(Platform.packageRoot))); 56 (arg) {
57 if (!arg.startsWith("--package-root=")) {
58 return false;
59 }
60 // Cut out the '--package-root=' prefix.
61 arg = arg.substring(15);
62 return pkgRootString.contains(arg);
63 }
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

Powered by Google App Engine
This is Rietveld 408576698