| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // BSD-style license that can be found in the LICENSE file. | |
| 4 | |
| 5 /** | |
| 6 * A RunClientServerTask is like a regular RunProcessTask except it starts | |
| 7 * an HTTP server before the task and stops it afterwards, so the task | |
| 8 * would typically be making HTTP client requests. | |
| 9 */ | |
| 10 class RunClientServerTask extends RunProcessTask { | |
| 11 RunProcessTask serverTask; | |
| 12 Process serverProcess; | |
| 13 | |
| 14 RunClientServerTask(String commandTemplate, List argumentTemplates, | |
| 15 int timeout) : super(commandTemplate, argumentTemplates, timeout) { | |
| 16 serverTask = new RunProcessTask( | |
| 17 config.dartPath, | |
| 18 ['$runnerDirectory${Platform.pathSeparator}' | |
| 19 'http_server_test_runner.dart', | |
| 20 '--port=${config.port}', | |
| 21 '--root=${config.staticRoot}'], | |
| 22 1000 * timeout); | |
| 23 } | |
| 24 | |
| 25 execute(Path testfile, List stdout, List stderr, | |
| 26 bool logging, Function exitHandler) { | |
| 27 serverProcess = serverTask.execute(testfile, stdout, stderr, logging, | |
| 28 (e) { serverProcess = null; }); | |
| 29 super.execute(testfile, stdout, stderr, logging, exitHandler); | |
| 30 } | |
| 31 | |
| 32 void cleanup(Path testfile, List stdout, List stderr, | |
| 33 bool verboseLogging, bool keepTestFiles) { | |
| 34 if (serverProcess != null) { | |
| 35 serverProcess.kill(); | |
| 36 } | |
| 37 } | |
| 38 } | |
| OLD | NEW |