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

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

Issue 2824083002: Fix 29264: remove access to the network on source-map unit test (Closed)
Patch Set: Created 3 years, 8 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 import 'dart:io'; 5 import 'dart:io';
6 6
7 import 'package:path/path.dart' as path; 7 import 'package:path/path.dart' as path;
8 import 'package:async_helper/async_helper.dart'; 8 import 'package:async_helper/async_helper.dart';
9 import 'package:expect/expect.dart'; 9 import 'package:expect/expect.dart';
10 import 'source_map_validator_helper.dart'; 10 import 'source_map_validator_helper.dart';
11 11
12 void main() { 12 void main() {
13 asyncTest(() async { 13 asyncTest(() async {
14 Directory tmpDir = await createTempDir(); 14 Directory tmpDir = await createTempDir();
15 try { 15 try {
16 Directory sunflowerDir = new Directory.fromUri( 16 Directory sunflowerDir = new Directory.fromUri(
17 Platform.script.resolve('../../../third_party/sunflower')); 17 Platform.script.resolve('../../../third_party/sunflower'));
18 18
19 print("Copying '${sunflowerDir.path}' to '${tmpDir.path}'."); 19 print("Copying '${sunflowerDir.path}' to '${tmpDir.path}'.");
20 copyDirectory(sunflowerDir, tmpDir); 20 copyDirectory(sunflowerDir, tmpDir);
21 String ext = Platform.isWindows ? '.bat' : ''; 21 String ext = Platform.isWindows ? '.bat' : '';
22 String command = path.normalize(path.join( 22 String command = path.normalize(path.join(
23 path.fromUri(Platform.script), '../../../../sdk/bin/pub${ext}')); 23 path.fromUri(Platform.script), '../../../../sdk/bin/pub${ext}'));
24 String file = path.join(tmpDir.path, 'build/web/sunflower.dart.js'); 24 String file = path.join(tmpDir.path, 'build/web/sunflower.dart.js');
25 25
26 print("Running '$command get' from '${tmpDir}'."); 26 // sunflower/pubspec.yaml only depends on package:browser for Dartium, we
27 ProcessResult getResult = 27 // override the file to remove this dependency and make pub-get --offline
28 await Process.run(command, ['get'], workingDirectory: tmpDir.path); 28 // trivially succeed.
29 print("Overriding '${tmpDir.path}/pubspec.yaml'.");
30 new File(path.join(tmpDir.path, "pubspec.yaml"))
31 .writeAsStringSync(_newPubspec);
32
33 print("Running '$command get --offline' from '${tmpDir}'.");
34 ProcessResult getResult = await Process.run(command, ['get', '--offline'],
35 workingDirectory: tmpDir.path);
29 print(getResult.stdout); 36 print(getResult.stdout);
30 print(getResult.stderr); 37 print(getResult.stderr);
31 Expect.equals(0, getResult.exitCode, 'Unexpected exitCode from pub get'); 38 Expect.equals(0, getResult.exitCode, 'Unexpected exitCode from pub get');
32 39
33 print("Running '$command build --mode=debug' from '${tmpDir}'."); 40 print("Running '$command build --mode=debug' from '${tmpDir}'.");
34 ProcessResult buildResult = await Process.run( 41 ProcessResult buildResult = await Process.run(
35 command, ['build', '--mode=debug'], 42 command, ['build', '--mode=debug'],
36 workingDirectory: tmpDir.path); 43 workingDirectory: tmpDir.path);
37 print(buildResult.stdout); 44 print(buildResult.stdout);
38 print(buildResult.stderr); 45 print(buildResult.stderr);
39 Expect.equals(0, buildResult.exitCode, 'Unexpected exitCode from pub'); 46 Expect.equals(0, buildResult.exitCode, 'Unexpected exitCode from pub');
40 validateSourceMap(new Uri.file(file, windows: Platform.isWindows)); 47 validateSourceMap(new Uri.file(file, windows: Platform.isWindows));
41 print("Deleting '${tmpDir.path}'."); 48 print("Deleting '${tmpDir.path}'.");
42 } finally { 49 } finally {
43 tmpDir.deleteSync(recursive: true); 50 tmpDir.deleteSync(recursive: true);
44 } 51 }
45 }); 52 });
46 } 53 }
54
55 String _newPubspec = '''
56 # Generated by test
57 name: sunflower
58 version: 0.0.0
59 ''';
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698