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

Side by Side Diff: tests/language_strong/conditional_import_test.dart

Issue 2578573003: Add dart:io stubs to ddc sdk, define dart.library.html (Closed)
Patch Set: Regen sum Created 4 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
(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_test.dart"
10 if (dart.library.io) "dart:io"
11 if (dart.library.html) "dart:html"
12 deferred as d show HttpRequest;
13
14 class HttpRequest {}
15
16 void main() {
17 asyncStart();
18 var io = const bool.fromEnvironment("dart.library.io");
19 var html = const bool.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) {
24 print("io");
25 Expect.throws(() => new d.HttpRequest()); // Class is abstract in dart:io
26 } else if (html) {
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698