OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 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 | 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 // TODO(antonm): rename to something like test_runner_updater. | 5 // TODO(antonm): rename to something like test_runner_updater. |
6 | 6 |
7 library drt_updater; | 7 library drt_updater; |
8 | 8 |
9 import "dart:async"; | 9 import "dart:async"; |
10 import "dart:io"; | 10 import "dart:io"; |
11 | 11 |
12 import "test_suite.dart"; | 12 import "test_suite.dart"; |
13 | 13 |
| 14 typedef void Action(); |
| 15 |
14 class _DartiumUpdater { | 16 class _DartiumUpdater { |
15 String name; | 17 String name; |
16 String script; | 18 String script; |
17 String option; | 19 String option; |
18 | 20 |
19 bool isActive = false; | 21 bool isActive = false; |
20 bool updated = false; | 22 bool updated = false; |
21 List onUpdated; | 23 List<Action> onUpdated; |
22 | 24 |
23 Future<ProcessResult> _updatingProcess; | 25 Future<ProcessResult> _updatingProcess; |
24 | 26 |
25 _DartiumUpdater(this.name, this.script, [this.option = null]); | 27 _DartiumUpdater(this.name, this.script, [this.option = null]); |
26 | 28 |
27 void update() { | 29 void update() { |
28 if (!isActive) { | 30 if (!isActive) { |
29 isActive = true; | 31 isActive = true; |
30 print('Updating $name.'); | 32 print('Updating $name.'); |
31 onUpdated = [ | 33 onUpdated = [ |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 // Download the default Dartium from Google Storage. | 83 // Download the default Dartium from Google Storage. |
82 if (_dartiumUpdater == null) { | 84 if (_dartiumUpdater == null) { |
83 _dartiumUpdater = new _DartiumUpdater( | 85 _dartiumUpdater = new _DartiumUpdater( |
84 'Dartium Chrome', 'tools/get_archive.py', 'dartium'); | 86 'Dartium Chrome', 'tools/get_archive.py', 'dartium'); |
85 } | 87 } |
86 return _dartiumUpdater; | 88 return _dartiumUpdater; |
87 } else { | 89 } else { |
88 return null; | 90 return null; |
89 } | 91 } |
90 } | 92 } |
OLD | NEW |