| 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 /** | 5 /** |
| 6 * The DartWrapTask generates a Dart wrapper for a test file, that has a | 6 * The DartWrapTask generates a Dart wrapper for a test file, that has a |
| 7 * test Configuration customized for the options specified by the user. | 7 * test Configuration customized for the options specified by the user. |
| 8 */ | 8 */ |
| 9 class DartWrapTask extends PipelineTask { | 9 class DartWrapTask extends PipelineTask { |
| 10 final String _sourceFileTemplate; | 10 final String _sourceFileTemplate; |
| 11 final String _tempDartFileTemplate; | 11 final String _tempDartFileTemplate; |
| 12 | 12 |
| 13 DartWrapTask(this._sourceFileTemplate, this._tempDartFileTemplate); | 13 DartWrapTask(this._sourceFileTemplate, this._tempDartFileTemplate); |
| 14 | 14 |
| 15 void execute(Path testfile, List stdout, List stderr, bool logging, | 15 execute(Path testfile, List stdout, List stderr, bool logging, |
| 16 Function exitHandler) { | 16 Function exitHandler) { |
| 17 // Get the source test file and canonicalize the path. | 17 // Get the source test file and canonicalize the path. |
| 18 var sourceName = makePathAbsolute( | 18 var sourceName = makePathAbsolute( |
| 19 expandMacros(_sourceFileTemplate, testfile)); | 19 expandMacros(_sourceFileTemplate, testfile)); |
| 20 // Get the destination file. | 20 // Get the destination file. |
| 21 var destFile = expandMacros(_tempDartFileTemplate, testfile); | 21 var destFile = expandMacros(_tempDartFileTemplate, testfile); |
| 22 | 22 |
| 23 if (config.layoutText || config.layoutPixel) { | 23 if (config.layoutText || config.layoutPixel) { |
| 24 makeLayoutTestWrappers(sourceName, destFile, runnerDirectory); | 24 makeLayoutTestWrappers(sourceName, destFile, runnerDirectory); |
| 25 } else { | 25 } else { |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 if (config.listTests) { | 73 if (config.listTests) { |
| 74 action = 'listTests'; | 74 action = 'listTests'; |
| 75 } else if (config.listGroups) { | 75 } else if (config.listGroups) { |
| 76 action = 'listGroups'; | 76 action = 'listGroups'; |
| 77 } else if (config.runIsolated) { | 77 } else if (config.runIsolated) { |
| 78 action = 'runIsolateTests'; | 78 action = 'runIsolateTests'; |
| 79 } else { | 79 } else { |
| 80 action = 'null'; | 80 action = 'null'; |
| 81 } | 81 } |
| 82 var wrapper = """ | 82 var wrapper = """ |
| 83 #library('layout_test'); | 83 #library('standard_test'); |
| 84 $extraImports | 84 $extraImports |
| 85 #import('${config.unittestPath}', prefix:'unittest'); | 85 #import('${config.unittestPath}', prefix:'unittest'); |
| 86 #import('$sourceName', prefix: 'test'); | 86 #import('$sourceName', prefix: 'test'); |
| 87 #source('$libDirectory/standard_test_runner.dart'); | 87 #source('$libDirectory/standard_test_runner.dart'); |
| 88 | 88 |
| 89 main() { | 89 main() { |
| 90 action = null; | 90 action = null; |
| 91 immediate = ${config.immediateOutput}; | 91 immediate = ${config.immediateOutput}; |
| 92 includeTime = ${config.includeTime}; | 92 includeTime = ${config.includeTime}; |
| 93 passFormat = '${config.passFormat}'; | 93 passFormat = '${config.passFormat}'; |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 regenerate = ${config.regenerate}; | 155 regenerate = ${config.regenerate}; |
| 156 sourceDir = '$expectedDirectory'; | 156 sourceDir = '$expectedDirectory'; |
| 157 testfile = '$sourceName'; | 157 testfile = '$sourceName'; |
| 158 summarize = ${config.produceSummary}; | 158 summarize = ${config.produceSummary}; |
| 159 baseUrl = 'file://$htmlFile'; | 159 baseUrl = 'file://$htmlFile'; |
| 160 run${config.layoutText?'Text':'Pixel'}LayoutTest(0); | 160 run${config.layoutText?'Text':'Pixel'}LayoutTest(0); |
| 161 } | 161 } |
| 162 """; | 162 """; |
| 163 } | 163 } |
| 164 } | 164 } |
| OLD | NEW |