Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | |
| 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. | |
| 4 | |
| 5 import "package:expect/expect.dart"; | |
| 6 import "package:async_helper/async_helper.dart"; | |
| 7 | |
| 8 // All three libraries have an HttpRequest class. | |
| 9 import "conditional_import_string_test.dart" | |
| 10 if (dart.library.io == "true") "dart:io" | |
|
vsm
2016/12/14 16:20:29
Brian: this test has a compile time error if dart
| |
| 11 if (dart.library.html == "true") "dart:html" | |
| 12 deferred as d show HttpRequest; | |
| 13 | |
| 14 class HttpRequest {} | |
| 15 | |
| 16 void main() { | |
| 17 asyncStart(); | |
| 18 var io = const String.fromEnvironment("dart.library.io"); | |
| 19 var html = const String.fromEnvironment("dart.library.html"); | |
| 20 () async { | |
| 21 // Shouldn't fail. Shouldn't time out. | |
| 22 await d.loadLibrary().timeout(const Duration(seconds: 5)); | |
| 23 if (io == "true") { | |
| 24 print("io"); | |
| 25 Expect.throws(() => new d.HttpRequest()); // Class is abstract in dart:io | |
| 26 } else if (html == "true") { | |
| 27 print("html"); | |
| 28 dynamic r = new d.HttpRequest(); // Shouldn't throw | |
| 29 var o = r.open; // Shouldn't fail, the open method is there. | |
| 30 } else { | |
| 31 print("none"); | |
| 32 dynamic r = new d.HttpRequest(); | |
| 33 Expect.isTrue(r is HttpRequest); | |
| 34 } | |
| 35 asyncEnd(); | |
| 36 }(); | |
| 37 } | |
| 38 | |
| OLD | NEW |