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

Unified Diff: tests/standalone/io/https_server_test.dart

Issue 2771453003: Format all tests. (Closed)
Patch Set: Format files Created 3 years, 8 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: tests/standalone/io/https_server_test.dart
diff --git a/tests/standalone/io/https_server_test.dart b/tests/standalone/io/https_server_test.dart
index f49ac12d2150a2ac5b356fdcda1c85635bc34ff1..ad3cc51163d07e143d1b2cab06e3fd0d71cd63c5 100644
--- a/tests/standalone/io/https_server_test.dart
+++ b/tests/standalone/io/https_server_test.dart
@@ -19,68 +19,59 @@ String localFile(path) => Platform.script.resolve(path).toFilePath();
SecurityContext serverContext = new SecurityContext()
..useCertificateChain(localFile('certificates/server_chain.pem'))
..usePrivateKey(localFile('certificates/server_key.pem'),
- password: 'dartdart');
+ password: 'dartdart');
SecurityContext clientContext = new SecurityContext()
..setTrustedCertificates(localFile('certificates/trusted_certs.pem'));
void testListenOn() {
void test(void onDone()) {
- HttpServer.bindSecure(HOST,
- 0,
- serverContext,
- backlog: 5).then((server) {
+ HttpServer.bindSecure(HOST, 0, serverContext, backlog: 5).then((server) {
ReceivePort serverPort = new ReceivePort();
server.listen((HttpRequest request) {
- request.listen(
- (_) { },
- onDone: () {
- request.response.close();
- serverPort.close();
- });
+ request.listen((_) {}, onDone: () {
+ request.response.close();
+ serverPort.close();
+ });
});
HttpClient client = new HttpClient(context: clientContext);
ReceivePort clientPort = new ReceivePort();
- client.getUrl(Uri.parse("https://${HOST.host}:${server.port}/"))
- .then((HttpClientRequest request) {
- return request.close();
- })
- .then((HttpClientResponse response) {
- response.listen(
- (_) { },
- onDone: () {
- client.close();
- clientPort.close();
- server.close();
- Expect.throws(() => server.port);
- onDone();
- });
- })
- .catchError((e, trace) {
- String msg = "Unexpected error in Https client: $e";
- if (trace != null) msg += "\nStackTrace: $trace";
- Expect.fail(msg);
+ client
+ .getUrl(Uri.parse("https://${HOST.host}:${server.port}/"))
+ .then((HttpClientRequest request) {
+ return request.close();
+ }).then((HttpClientResponse response) {
+ response.listen((_) {}, onDone: () {
+ client.close();
+ clientPort.close();
+ server.close();
+ Expect.throws(() => server.port);
+ onDone();
});
+ }).catchError((e, trace) {
+ String msg = "Unexpected error in Https client: $e";
+ if (trace != null) msg += "\nStackTrace: $trace";
+ Expect.fail(msg);
+ });
});
}
// Test two servers in succession.
test(() {
- test(() { });
+ test(() {});
});
}
void testEarlyClientClose() {
- HttpServer.bindSecure(HOST,
- 0,
- serverContext).then((server) {
- server.listen(
- (request) {
- String name = Platform.script.toFilePath();
- new File(name).openRead().pipe(request.response)
- .catchError((e) { /* ignore */ });
- });
+ HttpServer.bindSecure(HOST, 0, serverContext).then((server) {
+ server.listen((request) {
+ String name = Platform.script.toFilePath();
+ new File(name)
+ .openRead()
+ .pipe(request.response)
+ .catchError((e) {/* ignore */});
+ });
var count = 0;
makeRequest() {
@@ -98,6 +89,7 @@ void testEarlyClientClose() {
});
});
}
+
makeRequest();
});
}

Powered by Google App Engine
This is Rietveld 408576698