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

Side by Side Diff: tests/language/conditional_import_string_test.dart

Issue 2321973002: Make dart2js not consider dart:io there if the library is unsupported. (Closed)
Patch Set: Address comment Created 4 years, 3 months 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
« no previous file with comments | « pkg/compiler/lib/src/apiimpl.dart ('k') | tests/language/conditional_import_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_string_test.dart"
10 if (dart.library.io == "true") "dart:io"
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
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/apiimpl.dart ('k') | tests/language/conditional_import_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698