Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(407)

Unified Diff: utils/testrunner/client_server_task.dart

Issue 10966020: Added support for running an HTTP server during the test and being able to serve up static files. L… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | utils/testrunner/configuration.dart » ('j') | utils/testrunner/http_server_test_runner.dart » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: utils/testrunner/client_server_task.dart
===================================================================
--- utils/testrunner/client_server_task.dart (revision 0)
+++ utils/testrunner/client_server_task.dart (revision 0)
@@ -0,0 +1,38 @@
+// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+/**
+ * A RunClientServerTask is like a regular RunProcessTask except it starts
+ * an HTTP server before the task and stops it afterwards, so the task
+ * would typically be making HTTP client requests.
+ */
+class RunClientServerTask extends RunProcessTask {
+ RunProcessTask serverTask;
+ Process serverProcess;
+
+ RunClientServerTask(String commandTemplate, List argumentTemplates,
+ int timeout) : super(commandTemplate, argumentTemplates, timeout) {
+ serverTask = new RunProcessTask(
+ config.dartPath,
+ ['$runnerDirectory${Platform.pathSeparator}'
+ 'http_server_test_runner.dart',
+ '--port=${config.port}',
+ '--root=${config.staticRoot}'],
+ 1000 * timeout);
+ }
+
+ execute(Path testfile, List stdout, List stderr,
+ bool logging, Function exitHandler) {
+ serverProcess = serverTask.execute(testfile, stdout, stderr, logging,
+ (e) { serverProcess = null; });
+ super.execute(testfile, stdout, stderr, logging, exitHandler);
+ }
+
+ void cleanup(Path testfile, List stdout, List stderr,
+ bool verboseLogging, bool keepTestFiles) {
+ if (serverProcess != null) {
+ serverProcess.kill();
+ }
+ }
+}
« no previous file with comments | « no previous file | utils/testrunner/configuration.dart » ('j') | utils/testrunner/http_server_test_runner.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698