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

Unified Diff: tests/standalone/io/secure_socket_renegotiate_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_renegotiate_test.dart
diff --git a/tests/standalone/io/secure_socket_renegotiate_test.dart b/tests/standalone/io/secure_socket_renegotiate_test.dart
index e445ed414e408befdcc378c624d2cda247a62af5..2a3d965cce14f8183e97c70cf0c4c0d395d8ec0c 100644
--- a/tests/standalone/io/secure_socket_renegotiate_test.dart
+++ b/tests/standalone/io/secure_socket_renegotiate_test.dart
@@ -22,65 +22,62 @@ 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');
Future<SecureServerSocket> runServer() {
- return SecureServerSocket.bind(HOST_NAME, 0, serverContext)
- .then((SecureServerSocket server) {
- server.listen((SecureSocket socket) {
- Expect.isNull(socket.peerCertificate);
+ return SecureServerSocket
+ .bind(HOST_NAME, 0, serverContext)
+ .then((SecureServerSocket server) {
+ server.listen((SecureSocket socket) {
+ Expect.isNull(socket.peerCertificate);
- StreamIterator<String> input =
- new StreamIterator(socket.transform(UTF8.decoder)
- .transform(new LineSplitter()));
- input.moveNext().then((success) {
- Expect.isTrue(success);
- Expect.equals('first', input.current);
- socket.writeln('first reply');
- return input.moveNext();
- }).then((success) {
- Expect.isTrue(success);
- Expect.equals('renegotiated', input.current);
- Expect.isNull(socket.peerCertificate);
- socket.renegotiate(requestClientCertificate: true,
- requireClientCertificate: true,
- useSessionCache: false);
- socket.writeln('server renegotiated');
- return input.moveNext();
- }).then((success) {
- Expect.isTrue(success);
- Expect.equals('second', input.current);
- X509Certificate certificate = socket.peerCertificate;
- Expect.isNotNull(certificate);
- Expect.equals("CN=localhost", certificate.subject);
- Expect.equals("CN=myauthority", certificate.issuer);
- server.close();
- socket.close();
- });
+ StreamIterator<String> input = new StreamIterator(
+ socket.transform(UTF8.decoder).transform(new LineSplitter()));
+ input.moveNext().then((success) {
+ Expect.isTrue(success);
+ Expect.equals('first', input.current);
+ socket.writeln('first reply');
+ return input.moveNext();
+ }).then((success) {
+ Expect.isTrue(success);
+ Expect.equals('renegotiated', input.current);
+ Expect.isNull(socket.peerCertificate);
+ socket.renegotiate(
+ requestClientCertificate: true,
+ requireClientCertificate: true,
+ useSessionCache: false);
+ socket.writeln('server renegotiated');
+ return input.moveNext();
+ }).then((success) {
+ Expect.isTrue(success);
+ Expect.equals('second', input.current);
+ X509Certificate certificate = socket.peerCertificate;
+ Expect.isNotNull(certificate);
+ Expect.equals("CN=localhost", certificate.subject);
+ Expect.equals("CN=myauthority", certificate.issuer);
+ server.close();
+ socket.close();
});
- return server;
});
+ return server;
+ });
}
-
void main() {
- runServer()
- .then((SecureServerSocket server) {
- var clientScript = Platform.script
- .toFilePath()
- .replaceFirst("_test.dart", "_client.dart");
- Expect.isTrue(clientScript.endsWith("_client.dart"));
- Process.run(Platform.executable,
- [clientScript,
- server.port.toString()])
- .then((ProcessResult result) {
- if (result.exitCode != 0) {
- print("Client failed, stdout:");
- print(result.stdout);
- print(" stderr:");
- print(result.stderr);
- Expect.fail('Client subprocess exit code: ${result.exitCode}');
- }
- });
+ runServer().then((SecureServerSocket server) {
+ var clientScript =
+ Platform.script.toFilePath().replaceFirst("_test.dart", "_client.dart");
+ Expect.isTrue(clientScript.endsWith("_client.dart"));
+ Process
+ .run(Platform.executable, [clientScript, server.port.toString()]).then(
+ (ProcessResult result) {
+ if (result.exitCode != 0) {
+ print("Client failed, stdout:");
+ print(result.stdout);
+ print(" stderr:");
+ print(result.stderr);
+ Expect.fail('Client subprocess exit code: ${result.exitCode}');
+ }
});
+ });
}

Powered by Google App Engine
This is Rietveld 408576698