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

Unified Diff: pkg/http_server/test/utils.dart

Issue 124693002: pkg/http_server: virtual dir test cleanup (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 12 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
Index: pkg/http_server/test/utils.dart
diff --git a/pkg/http_server/test/utils.dart b/pkg/http_server/test/utils.dart
index 5d3b56a4f6837e883d1b089129ade69df04ca1ef..ad2f9854777c2a33d3884cd9fd81d9e49df2a0c2 100644
--- a/pkg/http_server/test/utils.dart
+++ b/pkg/http_server/test/utils.dart
@@ -8,13 +8,10 @@ import 'dart:async';
import 'dart:convert';
import 'dart:io';
-Future<int> getStatusCode(int port,
- String path,
- {String host,
- bool secure: false,
- DateTime ifModifiedSince,
- bool rawPath: false}) {
- var uri;
+Future<int> getStatusCode(int port, String path, {String host,
Anders Johnsen 2014/01/05 19:36:08 Please don't change this, this is not the style us
+ bool secure: false, DateTime ifModifiedSince, bool rawPath: false}) {
+
+ Uri uri;
if (rawPath) {
uri = new Uri(scheme: secure ? 'https' : 'http',
host: 'localhost',
@@ -25,6 +22,7 @@ Future<int> getStatusCode(int port,
new Uri.https('localhost:$port', path) :
new Uri.http('localhost:$port', path));
}
+
return new HttpClient().getUrl(uri)
.then((request) {
if (host != null) request.headers.host = host;
@@ -38,25 +36,26 @@ Future<int> getStatusCode(int port,
}
-Future<HttpHeaders> getHeaders(int port, String path) {
- return new HttpClient().get('localhost', port, path)
+Future<HttpHeaders> getHeaders(int port, String path) =>
+ new HttpClient()
+ .get('localhost', port, path)
.then((request) => request.close())
.then((response) => response.drain().then(
(_) => response.headers));
-}
-Future<String> getAsString(int port, String path) {
- return new HttpClient().get('localhost', port, path)
+
+Future<String> getAsString(int port, String path) =>
+ new HttpClient()
+ .get('localhost', port, path)
.then((request) => request.close())
.then((response) => UTF8.decodeStream(response));
-}
const CERTIFICATE = "localhost_cert";
-setupSecure() {
+void setupSecure() {
String certificateDatabase = Platform.script.resolve('pkcert').toFilePath();
SecureSocket.initialize(database: certificateDatabase,
password: 'dartdart');
« no previous file with comments | « no previous file | pkg/http_server/test/virtual_directory_test.dart » ('j') | pkg/http_server/test/virtual_directory_test.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698