Stop importing dart:io from browser libraries (#782)

I forgot that this wasn't supported in Dart 1.24 😝.

Closes #781
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 18e5325..7ecfd44 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,7 @@
+## 0.12.32+1
+
+* Fix a bug that broke content shell on Dart 1.24.
+
 ## 0.12.32
 
 * Add an `include` configuration field which specifies the path to another
diff --git a/lib/src/backend/suite_platform.dart b/lib/src/backend/suite_platform.dart
index 5ac8e33..a4cb718 100644
--- a/lib/src/backend/suite_platform.dart
+++ b/lib/src/backend/suite_platform.dart
@@ -2,9 +2,6 @@
 // for details. All rights reserved. Use of this source code is governed by a
 // BSD-style license that can be found in the LICENSE file.
 
-// Prefix this import to avoid accidentally using IO stuff in cross-platform
-// contexts.
-import '../util/io.dart' as io;
 import 'operating_system.dart';
 import 'runtime.dart';
 
@@ -34,17 +31,6 @@
     }
   }
 
-  /// Creates a new platform with the given [runtime] and [os] and [inGoogle]
-  /// determined using `dart:io`.
-  ///
-  /// If [runtime] is a browser, this will set [os] to [OperatingSystem.none].
-  ///
-  /// Throws an [UnsupportedError] if called in a context where `dart:io` is
-  /// unavailable.
-  SuitePlatform.current(this.runtime)
-      : os = runtime.isBrowser ? OperatingSystem.none : io.currentOS,
-        inGoogle = io.inGoogle;
-
   /// Converts a JSON-safe representation generated by [serialize] back into a
   /// [SuitePlatform].
   factory SuitePlatform.deserialize(Object serialized) {
diff --git a/lib/src/runner.dart b/lib/src/runner.dart
index 236ab0f..02e6bef 100644
--- a/lib/src/runner.dart
+++ b/lib/src/runner.dart
@@ -131,8 +131,7 @@
     var unsupportedRuntimes = _config.suiteDefaults.runtimes
         .map(_loader.findRuntime)
         .where((runtime) =>
-            runtime != null &&
-            !testOn.evaluate(new SuitePlatform.current(runtime)))
+            runtime != null && !testOn.evaluate(currentPlatform(runtime)))
         .toList();
     if (unsupportedRuntimes.isEmpty) return;
 
@@ -147,8 +146,7 @@
     if (unsupportedBrowsers.isNotEmpty) {
       var supportsAnyBrowser = _loader.allRuntimes
           .where((runtime) => runtime.isBrowser)
-          .any(
-              (runtime) => testOn.evaluate(new SuitePlatform.current(runtime)));
+          .any((runtime) => testOn.evaluate(currentPlatform(runtime)));
 
       if (supportsAnyBrowser) {
         unsupportedNames
diff --git a/lib/src/runner/browser/browser_manager.dart b/lib/src/runner/browser/browser_manager.dart
index a2d80c4..834ffca 100644
--- a/lib/src/runner/browser/browser_manager.dart
+++ b/lib/src/runner/browser/browser_manager.dart
@@ -11,7 +11,7 @@
 import 'package:web_socket_channel/web_socket_channel.dart';
 
 import '../../backend/runtime.dart';
-import '../../backend/suite_platform.dart';
+import '../../util/io.dart';
 import '../../util/stack_trace_mapper.dart';
 import '../application_exception.dart';
 import '../configuration/suite.dart';
@@ -242,7 +242,7 @@
       });
 
       try {
-        controller = deserializeSuite(path, new SuitePlatform.current(_runtime),
+        controller = deserializeSuite(path, currentPlatform(_runtime),
             suiteConfig, await _environment, suiteChannel, message);
 
         controller.channel("test.browser.mapper").sink.add(mapper?.serialize());
diff --git a/lib/src/runner/load_suite.dart b/lib/src/runner/load_suite.dart
index 3743c8b..fc8b428 100644
--- a/lib/src/runner/load_suite.dart
+++ b/lib/src/runner/load_suite.dart
@@ -15,6 +15,7 @@
 import '../backend/suite_platform.dart';
 import '../backend/test.dart';
 import '../backend/runtime.dart';
+import '../util/io.dart';
 import '../utils.dart';
 import 'configuration/suite.dart';
 import 'load_exception.dart';
@@ -122,7 +123,7 @@
     return new LoadSuite(
         "loading ${exception.path}",
         config ?? SuiteConfiguration.empty,
-        platform ?? new SuitePlatform.current(Runtime.vm),
+        platform ?? currentPlatform(Runtime.vm),
         () => new Future.error(exception, stackTrace),
         path: exception.path);
   }
diff --git a/lib/src/runner/loader.dart b/lib/src/runner/loader.dart
index cb3cec2..61ce9e1 100644
--- a/lib/src/runner/loader.dart
+++ b/lib/src/runner/loader.dart
@@ -14,7 +14,6 @@
 import '../backend/group.dart';
 import '../backend/invoker.dart';
 import '../backend/runtime.dart';
-import '../backend/suite_platform.dart';
 import '../util/io.dart';
 import 'browser/platform.dart';
 import 'configuration.dart';
@@ -223,7 +222,7 @@
       var runtime = findRuntime(runtimeName);
       assert(runtime != null, 'Unknown platform "$runtimeName".');
 
-      var platform = new SuitePlatform.current(runtime);
+      var platform = currentPlatform(runtime);
       if (!suiteConfig.metadata.testOn.evaluate(platform)) {
         continue;
       }
diff --git a/lib/src/util/io.dart b/lib/src/util/io.dart
index c2883d2..e79eae0 100644
--- a/lib/src/util/io.dart
+++ b/lib/src/util/io.dart
@@ -10,6 +10,8 @@
 import 'package:path/path.dart' as p;
 
 import '../backend/operating_system.dart';
+import '../backend/runtime.dart';
+import '../backend/suite_platform.dart';
 import '../utils.dart';
 
 /// The ASCII code for a newline character.
@@ -50,6 +52,17 @@
   throw new UnsupportedError('Unsupported operating system "$name".');
 })();
 
+// TODO(nweiz): Make this `new SuitePlatform.current()` once we only support
+// Dart 2 and we can import `dart:io` from within cross-platform libraries. See
+// commit 4ffda6d2.
+/// Returns a [SuitePlatform] with the given [runtime], and with [os] and
+/// [inGoogle] determined automatically.
+///
+/// If [runtime] is a browser, this will set [os] to [OperatingSystem.none].
+SuitePlatform currentPlatform(Runtime runtime) => new SuitePlatform(runtime,
+    os: runtime.isBrowser ? OperatingSystem.none : currentOS,
+    inGoogle: inGoogle);
+
 /// A queue of lines of standard input.
 final stdinLines = new StreamQueue(lineSplitter.bind(stdin));
 
diff --git a/lib/src/utils.dart b/lib/src/utils.dart
index bb5f785..60d55e5 100644
--- a/lib/src/utils.dart
+++ b/lib/src/utils.dart
@@ -10,14 +10,12 @@
 import 'package:async/async.dart';
 import 'package:collection/collection.dart';
 import 'package:matcher/matcher.dart';
+import 'package:path/path.dart' as p;
 import 'package:stream_channel/stream_channel.dart';
 import 'package:term_glyph/term_glyph.dart' as glyph;
 
 import 'backend/invoker.dart';
 import 'backend/operating_system.dart';
-// Prefix this import to avoid accidentally using IO stuff in cross-platform
-// contexts.
-import 'util/io.dart' as io;
 
 /// A typedef for a possibly-asynchronous function.
 ///
@@ -51,16 +49,24 @@
 /// A regular expression matching a single vowel.
 final _vowel = new RegExp('[aeiou]');
 
-/// Returns the best guess for the current operating system without relying on
+/// Directories that are specific to OS X.
+///
+/// This is used to try to distinguish OS X and Linux in [currentOSGuess].
+final _macOSDirectories = new Set<String>.from(
+    ["/Applications", "/Library", "/Network", "/System", "/Users"]);
+
+/// Returns the best guess for the current operating system without using
 /// `dart:io`.
 ///
 /// This is useful for running test files directly and skipping tests as
-/// appropriate.
-final currentOSGuess = _ifSupported(() => io.currentOS, OperatingSystem.none);
-
-/// Returns the best guess for whether we're running on internal Google
-/// infrastructure without relying on `dart:io`.
-final inGoogleGuess = _ifSupported(() => io.inGoogle, false);
+/// appropriate. The only OS-specific information we have is the current path,
+/// which we try to use to figure out the OS.
+final OperatingSystem currentOSGuess = (() {
+  if (p.style == p.Style.url) return OperatingSystem.none;
+  if (p.style == p.Style.windows) return OperatingSystem.windows;
+  if (_macOSDirectories.any(p.current.startsWith)) return OperatingSystem.macOS;
+  return OperatingSystem.linux;
+})();
 
 /// A regular expression matching a hyphenated identifier.
 ///
@@ -90,16 +96,6 @@
   int get hashCode => first.hashCode ^ last.hashCode;
 }
 
-/// Returns [callback]'s return value, unless it throws an [UnsupportedError] in
-/// which case returns [fallback].
-T _ifSupported<T>(T callback(), T fallback) {
-  try {
-    return callback();
-  } on UnsupportedError {
-    return fallback;
-  }
-}
-
 /// Get a string description of an exception.
 ///
 /// Many exceptions include the exception class name at the beginning of their
diff --git a/lib/test.dart b/lib/test.dart
index 9dbafe3..cc84803 100644
--- a/lib/test.dart
+++ b/lib/test.dart
@@ -62,8 +62,7 @@
         const PluginEnvironment(),
         SuiteConfiguration.empty,
         _globalDeclarer.build(),
-        new SuitePlatform(Runtime.vm,
-            os: currentOSGuess, inGoogle: inGoogleGuess),
+        new SuitePlatform(Runtime.vm, os: currentOSGuess),
         path: p.prettyUri(Uri.base));
 
     var engine = new Engine();
diff --git a/pubspec.yaml b/pubspec.yaml
index 4e3ee3c..ad26187 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -1,5 +1,5 @@
 name: test
-version: 0.12.32
+version: 0.12.32+1
 author: Dart Team <misc@dartlang.org>
 description: A library for writing dart unit tests.
 homepage: https://github.com/dart-lang/test