| 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:io"); | 7 #import("dart:io"); |
| 8 | 8 |
| 9 #import("test_suite.dart"); | 9 #import("test_suite.dart"); |
| 10 | 10 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 return false; | 32 return false; |
| 33 }); | 33 }); |
| 34 _updatingProcess.then(_onUpdatedHandler); | 34 _updatingProcess.then(_onUpdatedHandler); |
| 35 } | 35 } |
| 36 } | 36 } |
| 37 | 37 |
| 38 List<String> get _getUpdateCommand { | 38 List<String> get _getUpdateCommand { |
| 39 Path testScriptPath = new Path.fromNative(TestUtils.testScriptPath); | 39 Path testScriptPath = new Path.fromNative(TestUtils.testScriptPath); |
| 40 Path updateScriptPath = testScriptPath.directoryPath.append(script); | 40 Path updateScriptPath = testScriptPath.directoryPath.append(script); |
| 41 List<String> command = [updateScriptPath.toNativePath()]; | 41 List<String> command = [updateScriptPath.toNativePath()]; |
| 42 if (null !== option) { | 42 if (null != option) { |
| 43 command.add(option); | 43 command.add(option); |
| 44 } | 44 } |
| 45 return command; | 45 return command; |
| 46 } | 46 } |
| 47 | 47 |
| 48 void _onUpdatedHandler(ProcessResult result) { | 48 void _onUpdatedHandler(ProcessResult result) { |
| 49 if (result.exitCode == 0) { | 49 if (result.exitCode == 0) { |
| 50 print('$name updated'); | 50 print('$name updated'); |
| 51 } else { | 51 } else { |
| 52 print('Failure updating $name'); | 52 print('Failure updating $name'); |
| 53 print(' Exit code: ${result.exitCode}'); | 53 print(' Exit code: ${result.exitCode}'); |
| 54 print(result.stdout); | 54 print(result.stdout); |
| 55 print(result.stderr); | 55 print(result.stderr); |
| 56 exit(1); | 56 exit(1); |
| 57 } | 57 } |
| 58 for (var callback in onUpdated ) callback(); | 58 for (var callback in onUpdated ) callback(); |
| 59 } | 59 } |
| 60 } | 60 } |
| 61 | 61 |
| 62 _DartiumUpdater _dumpRenderTreeUpdater; | 62 _DartiumUpdater _dumpRenderTreeUpdater; |
| 63 _DartiumUpdater _dartiumUpdater; | 63 _DartiumUpdater _dartiumUpdater; |
| 64 | 64 |
| 65 _DartiumUpdater runtimeUpdater(Map configuration) { | 65 _DartiumUpdater runtimeUpdater(Map configuration) { |
| 66 String runtime = configuration['runtime']; | 66 String runtime = configuration['runtime']; |
| 67 if (runtime == 'drt' && configuration['drt'] == '') { | 67 if (runtime == 'drt' && configuration['drt'] == '') { |
| 68 // Download the default DumpRenderTree from Google Storage. | 68 // Download the default DumpRenderTree from Google Storage. |
| 69 if (_dumpRenderTreeUpdater === null) { | 69 if (_dumpRenderTreeUpdater == null) { |
| 70 _dumpRenderTreeUpdater = new _DartiumUpdater('DumpRenderTree', | 70 _dumpRenderTreeUpdater = new _DartiumUpdater('DumpRenderTree', |
| 71 'get_archive.py', 'drt'); | 71 'get_archive.py', 'drt'); |
| 72 } | 72 } |
| 73 return _dumpRenderTreeUpdater; | 73 return _dumpRenderTreeUpdater; |
| 74 } else if (runtime == 'dartium' && configuration['dartium'] == '') { | 74 } else if (runtime == 'dartium' && configuration['dartium'] == '') { |
| 75 // Download the default Dartium from Google Storage. | 75 // Download the default Dartium from Google Storage. |
| 76 if (_dartiumUpdater === null) { | 76 if (_dartiumUpdater == null) { |
| 77 _dartiumUpdater = new _DartiumUpdater('Dartium Chrome', 'get_archive.py', | 77 _dartiumUpdater = new _DartiumUpdater('Dartium Chrome', 'get_archive.py', |
| 78 'dartium'); | 78 'dartium'); |
| 79 } | 79 } |
| 80 return _dartiumUpdater; | 80 return _dartiumUpdater; |
| 81 } else { | 81 } else { |
| 82 return null; | 82 return null; |
| 83 } | 83 } |
| 84 } | 84 } |
| OLD | NEW |