| 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 import 'dart:async'; | 7 library drt_updater; |
| 8 import 'dart:io'; | |
| 9 | 8 |
| 10 import 'configuration.dart'; | 9 import "dart:async"; |
| 11 import 'test_suite.dart'; | 10 import "dart:io"; |
| 11 |
| 12 import "test_suite.dart"; |
| 12 | 13 |
| 13 typedef void Action(); | 14 typedef void Action(); |
| 14 | 15 |
| 15 class _DartiumUpdater { | 16 class _DartiumUpdater { |
| 16 String name; | 17 String name; |
| 17 String script; | 18 String script; |
| 18 String option; | 19 String option; |
| 19 | 20 |
| 20 bool isActive = false; | 21 bool isActive = false; |
| 21 bool updated = false; | 22 bool updated = false; |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 print(result.stderr); | 63 print(result.stderr); |
| 63 exit(1); | 64 exit(1); |
| 64 } | 65 } |
| 65 for (var callback in onUpdated) callback(); | 66 for (var callback in onUpdated) callback(); |
| 66 } | 67 } |
| 67 } | 68 } |
| 68 | 69 |
| 69 _DartiumUpdater _contentShellUpdater; | 70 _DartiumUpdater _contentShellUpdater; |
| 70 _DartiumUpdater _dartiumUpdater; | 71 _DartiumUpdater _dartiumUpdater; |
| 71 | 72 |
| 72 _DartiumUpdater runtimeUpdater( | 73 _DartiumUpdater runtimeUpdater(Map configuration) { |
| 73 Runtime runtime, String drtPath, String dartiumPath) { | 74 var runtime = configuration['runtime'] as String; |
| 74 if (runtime == Runtime.drt && drtPath == null) { | 75 if (runtime == 'drt' && configuration['drt'] == '') { |
| 75 // Download the default content shell from Google Storage. | 76 // Download the default content shell from Google Storage. |
| 76 if (_contentShellUpdater == null) { | 77 if (_contentShellUpdater == null) { |
| 77 _contentShellUpdater = | 78 _contentShellUpdater = |
| 78 new _DartiumUpdater('Content Shell', 'tools/get_archive.py', 'drt'); | 79 new _DartiumUpdater('Content Shell', 'tools/get_archive.py', 'drt'); |
| 79 } | 80 } |
| 80 return _contentShellUpdater; | 81 return _contentShellUpdater; |
| 81 } else if (runtime == Runtime.dartium && dartiumPath == null) { | 82 } else if (runtime == 'dartium' && configuration['dartium'] == '') { |
| 82 // Download the default Dartium from Google Storage. | 83 // Download the default Dartium from Google Storage. |
| 83 if (_dartiumUpdater == null) { | 84 if (_dartiumUpdater == null) { |
| 84 _dartiumUpdater = new _DartiumUpdater( | 85 _dartiumUpdater = new _DartiumUpdater( |
| 85 'Dartium Chrome', 'tools/get_archive.py', 'dartium'); | 86 'Dartium Chrome', 'tools/get_archive.py', 'dartium'); |
| 86 } | 87 } |
| 87 return _dartiumUpdater; | 88 return _dartiumUpdater; |
| 88 } else { | 89 } else { |
| 89 return null; | 90 return null; |
| 90 } | 91 } |
| 91 } | 92 } |
| OLD | NEW |