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

Side by Side Diff: tests/compiler/dart2js/library_env_test.dart

Issue 2897903003: Support loading binary data in dart2js (Closed)
Patch Set: Updated cf. comments Created 3 years, 7 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
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 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 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. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 /// Check that 'dart:' libraries have their corresponding dart.library.X 5 /// Check that 'dart:' libraries have their corresponding dart.library.X
6 /// environment variable set. 6 /// environment variable set.
7 7
8 import "memory_source_file_helper.dart"; 8 import 'dart:async';
9
10 import 'memory_source_file_helper.dart';
9 11
10 import "package:async_helper/async_helper.dart"; 12 import "package:async_helper/async_helper.dart";
11 13
12 import 'package:expect/expect.dart' show Expect; 14 import 'package:expect/expect.dart' show Expect;
13 15
14 import 'package:compiler/src/null_compiler_output.dart' show NullCompilerOutput; 16 import 'package:compiler/src/null_compiler_output.dart' show NullCompilerOutput;
15 17
16 import 'package:compiler/src/options.dart' show CompilerOptions; 18 import 'package:compiler/src/options.dart' show CompilerOptions;
17 19
20 import 'package:compiler/src/io/source_file.dart' show Binary;
21
18 import 'package:compiler/compiler_new.dart' 22 import 'package:compiler/compiler_new.dart'
19 show CompilerInput, CompilerDiagnostics; 23 show CompilerInput, CompilerDiagnostics, Input, InputKind;
20 24
21 const clientPlatform = r''' 25 const String clientPlatform = r'''
22 [dart-spec] 26 [dart-spec]
23 spec: 3rd edition. 27 spec: 3rd edition.
24 28
25 [features] 29 [features]
26 # No extra features 30 # No extra features
27 31
28 [libraries] 32 [libraries]
29 mock.client: mock1.dart 33 mock.client: mock1.dart
30 mock.shared: mock3.dart 34 mock.shared: mock3.dart
31 collection: collection/collection.dart 35 collection: collection/collection.dart
32 html: html/dart2js/html_dart2js.dart 36 html: html/dart2js/html_dart2js.dart
33 '''; 37 ''';
34 38
35 const serverPlatform = r''' 39 const String serverPlatform = r'''
36 [dart-spec] 40 [dart-spec]
37 spec: 3rd edition. 41 spec: 3rd edition.
38 42
39 [features] 43 [features]
40 # No extra features 44 # No extra features
41 45
42 [libraries] 46 [libraries]
43 mock.server: mock2.dart 47 mock.server: mock2.dart
44 mock.shared: mock3.dart 48 mock.shared: mock3.dart
45 collection: collection/collection.dart 49 collection: collection/collection.dart
46 io: io/io.dart 50 io: io/io.dart
47 '''; 51 ''';
48 52
49 class DummyCompilerInput implements CompilerInput { 53 class DummyCompilerInput implements CompilerInput {
50 const DummyCompilerInput(); 54 const DummyCompilerInput();
51 55
52 readFromUri(uri) async { 56 Future<Input> readFromUri(Uri uri,
57 {InputKind inputKind: InputKind.utf8}) async {
53 if (uri.toString().endsWith("dart_client.platform")) { 58 if (uri.toString().endsWith("dart_client.platform")) {
54 return clientPlatform; 59 return new Binary(uri, clientPlatform.codeUnits);
55 } else if (uri.toString().endsWith("dart_server.platform")) { 60 } else if (uri.toString().endsWith("dart_server.platform")) {
56 return serverPlatform; 61 return new Binary(uri, serverPlatform.codeUnits);
57 } else { 62 } else {
58 throw "should not be needed $uri"; 63 throw "should not be needed $uri";
59 } 64 }
60 } 65 }
61 } 66 }
62 67
63 class DummyCompilerDiagnostics implements CompilerDiagnostics { 68 class DummyCompilerDiagnostics implements CompilerDiagnostics {
64 const DummyCompilerDiagnostics(); 69 const DummyCompilerDiagnostics();
65 70
66 report(code, uri, begin, end, text, kind) { 71 report(code, uri, begin, end, text, kind) {
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 Expect.equals("false", compiler.fromEnvironment("dart.library.collection")); 129 Expect.equals("false", compiler.fromEnvironment("dart.library.collection"));
125 Expect.equals("foo", compiler.fromEnvironment("dart.library.mock.client")); 130 Expect.equals("foo", compiler.fromEnvironment("dart.library.mock.client"));
126 } 131 }
127 132
128 main() { 133 main() {
129 asyncStart(); 134 asyncStart();
130 runTest().then((_) { 135 runTest().then((_) {
131 asyncEnd(); 136 asyncEnd();
132 }); 137 });
133 } 138 }
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/import_test.dart ('k') | tests/compiler/dart2js/library_resolution_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698