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

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

Issue 22872012: Remove Encoding-enum from dart:io and add interface in dart:convert. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix typo. Created 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « pkg/http_server/test/http_body_test.dart ('k') | pkg/scheduled_test/lib/scheduled_process.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:io'; 9 import 'dart:io';
9 import "package:path/path.dart"; 10 import "package:path/path.dart";
10 11
11 Future<int> getStatusCode(int port, 12 Future<int> getStatusCode(int port,
12 String path, 13 String path,
13 {String host, 14 {String host,
14 bool secure: false, 15 bool secure: false,
15 DateTime ifModifiedSince, 16 DateTime ifModifiedSince,
16 bool rawPath: false}) { 17 bool rawPath: false}) {
17 var uri; 18 var uri;
(...skipping 24 matching lines...) Expand all
42 return new HttpClient().get('localhost', port, path) 43 return new HttpClient().get('localhost', port, path)
43 .then((request) => request.close()) 44 .then((request) => request.close())
44 .then((response) => response.drain().then( 45 .then((response) => response.drain().then(
45 (_) => response.headers)); 46 (_) => response.headers));
46 } 47 }
47 48
48 49
49 Future<String> getAsString(int port, String path) { 50 Future<String> getAsString(int port, String path) {
50 return new HttpClient().get('localhost', port, path) 51 return new HttpClient().get('localhost', port, path)
51 .then((request) => request.close()) 52 .then((request) => request.close())
52 .then((response) => StringDecoder.decode(response)); 53 .then((response) => UTF8.decodeStream(response));
53 } 54 }
54 55
55 56
56 const CERTIFICATE = "localhost_cert"; 57 const CERTIFICATE = "localhost_cert";
57 58
58 59
59 setupSecure() { 60 setupSecure() {
60 String scriptDir = dirname(new Options().script); 61 String scriptDir = dirname(new Options().script);
61 String certificateDatabase = join(scriptDir, 'pkcert'); 62 String certificateDatabase = join(scriptDir, 'pkcert');
62 SecureSocket.initialize(database: certificateDatabase, 63 SecureSocket.initialize(database: certificateDatabase,
63 password: 'dartdart'); 64 password: 'dartdart');
64 } 65 }
OLDNEW
« no previous file with comments | « pkg/http_server/test/http_body_test.dart ('k') | pkg/scheduled_test/lib/scheduled_process.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698