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

Side by Side Diff: tools/testing/dart/drt_updater.dart

Issue 2981223002: Remove Dartium support from test.dart. (Closed)
Patch Set: Remove "dartium" from status files. Created 3 years, 5 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 | « tools/testing/dart/configuration.dart ('k') | tools/testing/dart/options.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) 2012, 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 // TODO(antonm): rename to something like test_runner_updater.
6
7 import 'dart:async';
8 import 'dart:io';
9
10 import 'configuration.dart';
11 import 'utils.dart';
12
13 typedef void Action();
14
15 class _DartiumUpdater {
16 String name;
17 String script;
18 String option;
19
20 bool isActive = false;
21 bool updated = false;
22 List<Action> onUpdated;
23
24 Future<ProcessResult> _updatingProcess;
25
26 _DartiumUpdater(this.name, this.script, [this.option = null]);
27
28 void update() {
29 if (!isActive) {
30 isActive = true;
31 print('Updating $name.');
32 onUpdated = [
33 () {
34 updated = true;
35 }
36 ];
37 _updatingProcess = Process.run('python', _getUpdateCommand);
38 _updatingProcess.then(_onUpdatedHandler).catchError((e) {
39 print("Error starting $script process: $e");
40 // TODO(floitsch): should we print the stacktrace?
41 return false;
42 });
43 }
44 }
45
46 List<String> get _getUpdateCommand {
47 Uri updateScript = TestUtils.dartDirUri.resolve(script);
48 List<String> command = [updateScript.toFilePath()];
49 if (null != option) {
50 command.add(option);
51 }
52 return command;
53 }
54
55 void _onUpdatedHandler(ProcessResult result) {
56 if (result.exitCode == 0) {
57 print('$name updated');
58 } else {
59 print('Failure updating $name');
60 print(' Exit code: ${result.exitCode}');
61 print(result.stdout);
62 print(result.stderr);
63 exit(1);
64 }
65 for (var callback in onUpdated) callback();
66 }
67 }
68
69 _DartiumUpdater _contentShellUpdater;
70 _DartiumUpdater _dartiumUpdater;
71
72 _DartiumUpdater runtimeUpdater(
73 Runtime runtime, String drtPath, String dartiumPath) {
74 if (runtime == Runtime.drt && drtPath == null) {
75 // Download the default content shell from Google Storage.
76 if (_contentShellUpdater == null) {
77 _contentShellUpdater =
78 new _DartiumUpdater('Content Shell', 'tools/get_archive.py', 'drt');
79 }
80 return _contentShellUpdater;
81 } else if (runtime == Runtime.dartium && dartiumPath == null) {
82 // Download the default Dartium from Google Storage.
83 if (_dartiumUpdater == null) {
84 _dartiumUpdater = new _DartiumUpdater(
85 'Dartium Chrome', 'tools/get_archive.py', 'dartium');
86 }
87 return _dartiumUpdater;
88 } else {
89 return null;
90 }
91 }
OLDNEW
« no previous file with comments | « tools/testing/dart/configuration.dart ('k') | tools/testing/dart/options.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698