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