Chromium Code Reviews| Index: tests/standalone/io/platform_test.dart |
| diff --git a/tests/standalone/io/platform_test.dart b/tests/standalone/io/platform_test.dart |
| index 1bcfbd7b9619f165ed1207973a031e8186f8d115..78c87a159cfd6f20379eeeef3168583dfe62806b 100644 |
| --- a/tests/standalone/io/platform_test.dart |
| +++ b/tests/standalone/io/platform_test.dart |
| @@ -5,48 +5,49 @@ |
| import "dart:async"; |
| import "dart:io"; |
|
Anders Johnsen
2013/10/24 08:30:08
Remove io import.
Bill Hesse
2013/10/24 13:43:43
Done.
|
| import "dart:isolate"; |
| +import "dart:platform" as platform; |
| import "package:async_helper/async_helper.dart"; |
| import "package:expect/expect.dart"; |
| test() { |
| - Expect.isTrue(Platform.numberOfProcessors > 0); |
| - var os = Platform.operatingSystem; |
| + Expect.isTrue(platform.numberOfProcessors > 0); |
| + var os = platform.operatingSystem; |
| Expect.isTrue(os == "android" || os == "linux" || os == "macos" || |
| os == "windows"); |
| - Expect.equals(Platform.isLinux, Platform.operatingSystem == "linux"); |
| - Expect.equals(Platform.isMacOS, Platform.operatingSystem == "macos"); |
| - Expect.equals(Platform.isWindows, Platform.operatingSystem == "windows"); |
| - Expect.equals(Platform.isAndroid, Platform.operatingSystem == "android"); |
| - var sep = Platform.pathSeparator; |
| + Expect.equals(platform.isLinux, platform.operatingSystem == "linux"); |
| + Expect.equals(platform.isMacOS, platform.operatingSystem == "macos"); |
| + Expect.equals(platform.isWindows, platform.operatingSystem == "windows"); |
| + Expect.equals(platform.isAndroid, platform.operatingSystem == "android"); |
| + var sep = platform.pathSeparator; |
| Expect.isTrue(sep == '/' || (os == 'windows' && sep == '\\')); |
| - var hostname = Platform.localHostname; |
| + var hostname = platform.localHostname; |
| Expect.isTrue(hostname is String && hostname != ""); |
| - var environment = Platform.environment; |
| + var environment = platform.environment; |
| Expect.isTrue(environment is Map<String, String>); |
| - Expect.isTrue(Platform.executable.contains('dart')); |
| - Expect.isTrue(Platform.script.replaceAll('\\', '/'). |
| + Expect.isTrue(platform.executable.contains('dart')); |
| + Expect.isTrue(platform.script.replaceAll('\\', '/'). |
| endsWith('tests/standalone/io/platform_test.dart')); |
| - Directory packageRoot = new Directory(Platform.packageRoot); |
| + Directory packageRoot = new Directory(platform.packageRoot); |
| Expect.isTrue(packageRoot.existsSync()); |
| Expect.isTrue(new Directory("${packageRoot.path}/expect").existsSync()); |
| - Expect.isTrue(Platform.executableArguments.any( |
| - (arg) => arg.contains(Platform.packageRoot))); |
| + Expect.isTrue(platform.executableArguments.any( |
| + (arg) => arg.contains(platform.packageRoot))); |
| } |
| void f() { |
| port.receive((msg, reply) { |
| - if (msg == "Platform.executable") { |
| - reply.send(Platform.executable); |
| + if (msg == "platform.executable") { |
| + reply.send(platform.executable); |
| } |
| - if (msg == "Platform.script") { |
| - reply.send(Platform.script); |
| + if (msg == "platform.script") { |
| + reply.send(platform.script); |
| } |
| - if (msg == "Platform.packageRoot") { |
| - reply.send(Platform.packageRoot); |
| + if (msg == "platform.packageRoot") { |
| + reply.send(platform.packageRoot); |
| } |
| - if (msg == "Platform.executableArguments") { |
| - reply.send(Platform.executableArguments); |
| + if (msg == "platform.executableArguments") { |
| + reply.send(platform.executableArguments); |
| } |
| if (msg == "close") { |
| reply.send("closed"); |
| @@ -58,17 +59,17 @@ void f() { |
| testIsolate() { |
| asyncStart(); |
| var sendPort = spawnFunction(f); |
| - Future.wait([sendPort.call("Platform.executable"), |
| - sendPort.call("Platform.script"), |
| - sendPort.call("Platform.packageRoot"), |
| - sendPort.call("Platform.executableArguments")]) |
| + Future.wait([sendPort.call("platform.executable"), |
| + sendPort.call("platform.script"), |
| + sendPort.call("platform.packageRoot"), |
| + sendPort.call("platform.executableArguments")]) |
| .then((results) { |
| - Expect.equals(Platform.executable, results[0]); |
| + Expect.equals(platform.executable, results[0]); |
| Uri uri = Uri.parse(results[1]); |
| Expect.equals("file", uri.scheme); |
| Expect.isTrue(uri.path.endsWith('tests/standalone/io/platform_test.dart')); |
| - Expect.equals(Platform.packageRoot, results[2]); |
| - Expect.listEquals(Platform.executableArguments, results[3]); |
| + Expect.equals(platform.packageRoot, results[2]); |
| + Expect.listEquals(platform.executableArguments, results[3]); |
| sendPort.call("close").then((_) => asyncEnd()); |
| }); |
| } |