[ dart:io / tests ] Fixed issue where non_utf8* tests attempted to delete the current working directory which is not allowed on Windows.

Change-Id: I67801c1c544e0ee197386dd3aad82cc7507a98a1
Reviewed-on: https://dart-review.googlesource.com/61963
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
diff --git a/tests/standalone_2/io/non_utf8_directory_test.dart b/tests/standalone_2/io/non_utf8_directory_test.dart
index 553404c..1c58f3f 100644
--- a/tests/standalone_2/io/non_utf8_directory_test.dart
+++ b/tests/standalone_2/io/non_utf8_directory_test.dart
@@ -17,7 +17,6 @@
     try {
       tmp = await Directory.systemTemp
           .createTemp('non_utf8_directory_test_async');
-      Directory.current = tmp;
       final rawPath = new Uint8List.fromList([182]);
       asyncDir = new Directory.fromRawPath(rawPath);
       if (Platform.isMacOS || Platform.isIOS) {
@@ -33,7 +32,7 @@
       }
       expect(await asyncDir.exists(), isTrue);
 
-      await for (final e in Directory.current.list()) {
+      await for (final e in tmp.list()) {
         // FIXME(bkonyi): reenable when rawPath is exposed.
         /*
         if (Platform.isWindows) {
@@ -56,7 +55,6 @@
     Directory tmp;
     try {
       tmp = Directory.systemTemp.createTempSync('non_utf8_directory_test_sync');
-      Directory.current = tmp;
       final rawPath = new Uint8List.fromList([182]);
       syncDir = new Directory.fromRawPath(rawPath);
 
@@ -73,7 +71,7 @@
       }
       expect(syncDir.existsSync(), isTrue);
 
-      for (final e in Directory.current.listSync()) {
+      for (final e in tmp.listSync()) {
         // FIXME(bkonyi): reenable when rawPath is exposed.
         /*
         if (Platform.isWindows) {
diff --git a/tests/standalone_2/io/non_utf8_file_test.dart b/tests/standalone_2/io/non_utf8_file_test.dart
index 58612c5..3bdafa1 100644
--- a/tests/standalone_2/io/non_utf8_file_test.dart
+++ b/tests/standalone_2/io/non_utf8_file_test.dart
@@ -16,7 +16,6 @@
     Directory tmp;
     try {
       tmp = await Directory.systemTemp.createTemp('non_utf8_file_test_async');
-      Directory.current = tmp;
       final rawPath = new Uint8List.fromList([182]);
       asyncFile = new File.fromRawPath(rawPath);
       if (Platform.isMacOS || Platform.isIOS) {
@@ -32,7 +31,7 @@
       }
       expect(await asyncFile.exists(), isTrue);
 
-      for (final file in Directory.current.listSync()) {
+      for (final file in tmp.listSync()) {
         // FIXME(bkonyi): reenable when rawPath is exposed.
         /*
         if (Platform.isWindows) {
@@ -59,7 +58,6 @@
     Directory tmp;
     try {
       tmp = Directory.systemTemp.createTempSync('non_utf8_file_test_sync');
-      Directory.current = tmp;
       final rawPath = new Uint8List.fromList([182]);
       syncFile = new File.fromRawPath(rawPath);
 
@@ -76,7 +74,7 @@
       }
       expect(syncFile.existsSync(), isTrue);
 
-      for (final file in Directory.current.listSync()) {
+      for (final file in tmp.listSync()) {
         // FIXME(bkonyi): reenable when rawPath is exposed.
         /*
         if (Platform.isWindows) {
diff --git a/tests/standalone_2/io/non_utf8_link_test.dart b/tests/standalone_2/io/non_utf8_link_test.dart
index 86fe265..aadd30a 100644
--- a/tests/standalone_2/io/non_utf8_link_test.dart
+++ b/tests/standalone_2/io/non_utf8_link_test.dart
@@ -19,8 +19,8 @@
     Directory tmp =
         await Directory.systemTemp.createTemp('non_utf8_link_test_async');
     try {
-      Directory.current = await tmp.resolveSymbolicLinks();
-      final path = join(Directory.current.path, dirName);
+      tmp = new Directory(await tmp.resolveSymbolicLinks());
+      final path = join(tmp.path, dirName);
       final rawPath =
           utf8.encode(path).sublist(0, path.length - dirName.length).toList();
       rawPath.add(47);
@@ -46,7 +46,7 @@
       }
       expect(await asyncLink.exists(), isTrue);
 
-      await for (final e in Directory.current.list()) {
+      await for (final e in tmp.list()) {
         if (e is Link) {
           // FIXME(bkonyi): reenable when rawPath is exposed.
           /*
@@ -77,8 +77,8 @@
     Directory tmp =
         Directory.systemTemp.createTempSync('non_utf8_link_test_sync');
     try {
-      Directory.current = tmp.resolveSymbolicLinksSync();
-      final path = join(Directory.current.path, dirName);
+      tmp = new Directory(tmp.resolveSymbolicLinksSync());
+      final path = join(tmp.path, dirName);
       final rawPath =
           utf8.encode(path).sublist(0, path.length - dirName.length).toList();
       rawPath.add(47); // '/'
@@ -104,7 +104,7 @@
       }
       expect(syncLink.existsSync(), isTrue);
 
-      for (final e in Directory.current.listSync()) {
+      for (final e in tmp.listSync()) {
         if (e is Link) {
           // FIXME(bkonyi): reenable when rawPath is exposed.
           /*