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

Unified Diff: tests/standalone/io/secure_socket_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/secure_socket_test.dart
diff --git a/tests/standalone/io/secure_socket_test.dart b/tests/standalone/io/secure_socket_test.dart
index 9a9275708e790356dc866491a91468203991ac24..c8ddccd29ecb62c1babec18307a4d6eb12247406 100644
--- a/tests/standalone/io/secure_socket_test.dart
+++ b/tests/standalone/io/secure_socket_test.dart
@@ -23,32 +23,29 @@ String localFile(path) => Platform.script.resolve(path).toFilePath();
SecurityContext serverContext(String certType, String password) =>
new SecurityContext()
- ..useCertificateChain(localFile('certificates/server_chain.$certType'),
- password: password)
- ..usePrivateKey(localFile('certificates/server_key.$certType'),
- password: password);
+ ..useCertificateChain(localFile('certificates/server_chain.$certType'),
+ password: password)
+ ..usePrivateKey(localFile('certificates/server_key.$certType'),
+ password: password);
SecurityContext clientContext(String certType, String password) =>
new SecurityContext()
- ..setTrustedCertificates(localFile('certificates/trusted_certs.$certType'),
- password: password);
+ ..setTrustedCertificates(
+ localFile('certificates/trusted_certs.$certType'),
+ password: password);
Future<HttpServer> startServer(String certType, String password) {
- return HttpServer.bindSecure(
- "localhost",
- 0,
- serverContext(certType, password),
- backlog: 5).then((server) {
+ return HttpServer
+ .bindSecure("localhost", 0, serverContext(certType, password), backlog: 5)
+ .then((server) {
server.listen((HttpRequest request) {
- request.listen(
- (_) { },
- onDone: () {
- request.response.contentLength = 100;
- for (int i = 0; i < 10; i++) {
- request.response.add([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]);
- }
- request.response.close();
- });
+ request.listen((_) {}, onDone: () {
+ request.response.contentLength = 100;
+ for (int i = 0; i < 10; i++) {
+ request.response.add([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]);
+ }
+ request.response.close();
+ });
});
return server;
});
@@ -58,28 +55,26 @@ Future test(String certType, String password) {
List<int> body = <int>[];
Completer completer = new Completer();
startServer(certType, password).then((server) {
- SecureSocket.connect(
- "localhost", server.port, context: clientContext(certType, password))
- .then((socket) {
+ SecureSocket
+ .connect("localhost", server.port,
+ context: clientContext(certType, password))
+ .then((socket) {
socket.write("GET / HTTP/1.0\r\nHost: localhost\r\n\r\n");
socket.close();
- socket.listen(
- (List<int> data) {
- body.addAll(data);
- },
- onDone: () {
- Expect.isTrue(body.length > 100, "$body\n${body.length}");
- Expect.equals(72, body[0]);
- Expect.equals(9, body[body.length - 1]);
- server.close();
- completer.complete(null);
- },
- onError: (e, trace) {
- String msg = "Unexpected error $e";
- if (trace != null) msg += "\nStackTrace: $trace";
- Expect.fail(msg);
- completer.complete(null);
- });
+ socket.listen((List<int> data) {
+ body.addAll(data);
+ }, onDone: () {
+ Expect.isTrue(body.length > 100, "$body\n${body.length}");
+ Expect.equals(72, body[0]);
+ Expect.equals(9, body[body.length - 1]);
+ server.close();
+ completer.complete(null);
+ }, onError: (e, trace) {
+ String msg = "Unexpected error $e";
+ if (trace != null) msg += "\nStackTrace: $trace";
+ Expect.fail(msg);
+ completer.complete(null);
+ });
});
});
return completer.future;

Powered by Google App Engine
This is Rietveld 408576698