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

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: whitespace Created 6 years, 11 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..90b46fdc5691f7cec05a7de82e10e0a6903aa674 100644
--- a/pkg/http_server/test/utils.dart
+++ b/pkg/http_server/test/utils.dart
@@ -14,7 +14,7 @@ Future<int> getStatusCode(int port,
bool secure: false,
DateTime ifModifiedSince,
bool rawPath: false}) {
- var uri;
+ Uri uri;
Siggi Cherem (dart-lang) 2014/01/06 17:40:23 note that we prefer 'var' for local variables. Was
kevmoo 2014/01/06 18:11:33 I'm a big fan of being explicit w/ the local var t
if (rawPath) {
uri = new Uri(scheme: secure ? 'https' : 'http',
host: 'localhost',
@@ -25,6 +25,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 +39,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