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

Side by Side Diff: pkg/http_server/test/utils.dart

Issue 102743004: pkg/http_server: messed up one test, fixed whitespace (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | pkg/http_server/test/virtual_directory_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 library utils; 5 library utils;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:convert'; 8 import 'dart:convert';
9 import 'dart:io'; 9 import 'dart:io';
10 10
11 Future<int> getStatusCode(int port, 11 Future<int> getStatusCode(int port,
12 String path, 12 String path,
13 {String host, 13 {String host,
14 bool secure: false, 14 bool secure: false,
15 DateTime ifModifiedSince, 15 DateTime ifModifiedSince,
16 bool rawPath: false}) { 16 bool rawPath: false}) {
17 Uri uri; 17 Uri uri;
18 if (rawPath) { 18 if (rawPath) {
19 uri = new Uri(scheme: secure ? 'https' : 'http', 19 uri = new Uri(scheme: secure ? 'https' : 'http',
20 host: 'localhost', 20 host: 'localhost',
21 port: port, 21 port: port,
22 path: path); 22 path: path);
23 } else { 23 } else {
24 uri = (secure ? 24 uri = (secure ?
25 new Uri.https('localhost:$port', path) : 25 new Uri.https('localhost:$port', path) :
26 new Uri.http('localhost:$port', path)); 26 new Uri.http('localhost:$port', path));
27 } 27 }
28 28
29 return new HttpClient().getUrl(uri) 29 return new HttpClient().getUrl(uri)
30 .then((request) { 30 .then((request) {
31 if (host != null) request.headers.host = host; 31 if (host != null) request.headers.host = host;
32 if (ifModifiedSince != null) { 32 if (ifModifiedSince != null) {
33 request.headers.ifModifiedSince = ifModifiedSince; 33 request.headers.ifModifiedSince = ifModifiedSince;
34 } 34 }
35 return request.close(); 35 return request.close();
36 }) 36 })
37 .then((response) => response.drain().then( 37 .then((response) => response.drain().then(
38 (_) => response.statusCode)); 38 (_) => response.statusCode));
(...skipping 17 matching lines...) Expand all
56 56
57 57
58 const CERTIFICATE = "localhost_cert"; 58 const CERTIFICATE = "localhost_cert";
59 59
60 60
61 void setupSecure() { 61 void setupSecure() {
62 String certificateDatabase = Platform.script.resolve('pkcert').toFilePath(); 62 String certificateDatabase = Platform.script.resolve('pkcert').toFilePath();
63 SecureSocket.initialize(database: certificateDatabase, 63 SecureSocket.initialize(database: certificateDatabase,
64 password: 'dartdart'); 64 password: 'dartdart');
65 } 65 }
OLDNEW
« no previous file with comments | « no previous file | pkg/http_server/test/virtual_directory_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698