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 library drt_updater; | 5 library drt_updater; |
6 | 6 |
7 import "dart:async"; | 7 import "dart:async"; |
8 import "dart:io"; | 8 import "dart:io"; |
9 | 9 |
10 import "test_suite.dart"; | 10 import "test_suite.dart"; |
(...skipping 12 matching lines...) Expand all Loading... |
23 _DartiumUpdater(this.name, this.script, [this.option = null]); | 23 _DartiumUpdater(this.name, this.script, [this.option = null]); |
24 | 24 |
25 void update() { | 25 void update() { |
26 if (!isActive) { | 26 if (!isActive) { |
27 isActive = true; | 27 isActive = true; |
28 print('Updating $name.'); | 28 print('Updating $name.'); |
29 onUpdated = [() {updated = true;} ]; | 29 onUpdated = [() {updated = true;} ]; |
30 _updatingProcess = Process.run('python', _getUpdateCommand); | 30 _updatingProcess = Process.run('python', _getUpdateCommand); |
31 _updatingProcess.then(_onUpdatedHandler).catchError((e) { | 31 _updatingProcess.then(_onUpdatedHandler).catchError((e) { |
32 print("Error starting $script process: $e"); | 32 print("Error starting $script process: $e"); |
| 33 // TODO(floitsch): should we print the stacktrace? |
33 return false; | 34 return false; |
34 }); | 35 }); |
35 } | 36 } |
36 } | 37 } |
37 | 38 |
38 List<String> get _getUpdateCommand { | 39 List<String> get _getUpdateCommand { |
39 Path testScriptPath = new Path(TestUtils.testScriptPath); | 40 Path testScriptPath = new Path(TestUtils.testScriptPath); |
40 Path updateScriptPath = testScriptPath.directoryPath.append(script); | 41 Path updateScriptPath = testScriptPath.directoryPath.append(script); |
41 List<String> command = [updateScriptPath.toNativePath()]; | 42 List<String> command = [updateScriptPath.toNativePath()]; |
42 if (null != option) { | 43 if (null != option) { |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 // Download the default Dartium from Google Storage. | 76 // Download the default Dartium from Google Storage. |
76 if (_dartiumUpdater == null) { | 77 if (_dartiumUpdater == null) { |
77 _dartiumUpdater = new _DartiumUpdater('Dartium Chrome', 'get_archive.py', | 78 _dartiumUpdater = new _DartiumUpdater('Dartium Chrome', 'get_archive.py', |
78 'dartium'); | 79 'dartium'); |
79 } | 80 } |
80 return _dartiumUpdater; | 81 return _dartiumUpdater; |
81 } else { | 82 } else { |
82 return null; | 83 return null; |
83 } | 84 } |
84 } | 85 } |
OLD | NEW |