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

Unified Diff: tests/standalone/io/secure_socket_renegotiate_client.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_client.dart
diff --git a/tests/standalone/io/secure_socket_renegotiate_client.dart b/tests/standalone/io/secure_socket_renegotiate_client.dart
index 12f9245b82a0fb32deac5b2bdf2a644a8eeb9900..c4fe51a8f6ff518c9212533f1e439937eb115182 100644
--- a/tests/standalone/io/secure_socket_renegotiate_client.dart
+++ b/tests/standalone/io/secure_socket_renegotiate_client.dart
@@ -23,60 +23,51 @@ class ExpectException implements Exception {
String message;
}
-
void expectEquals(expected, actual) {
if (actual != expected) {
throw new ExpectException('Expected $expected, found $actual');
}
}
-
void expect(condition) {
if (!condition) {
throw new ExpectException('');
}
}
-
void runClient(int port) {
- SecureSocket.connect(HOST_NAME,
- port,
- context: clientContext)
- .then((SecureSocket socket) {
+ SecureSocket
+ .connect(HOST_NAME, port, context: clientContext)
+ .then((SecureSocket socket) {
+ X509Certificate certificate = socket.peerCertificate;
+ expect(certificate != null);
+ expectEquals('CN=localhost', certificate.subject);
+ expectEquals('CN=myauthority', certificate.issuer);
+ StreamIterator<String> input = new StreamIterator(
+ socket.transform(UTF8.decoder).transform(new LineSplitter()));
+ socket.writeln('first');
+ input.moveNext().then((success) {
+ expect(success);
+ expectEquals('first reply', input.current);
+ socket.renegotiate();
+ socket.writeln('renegotiated');
+ return input.moveNext();
+ }).then((success) {
+ expect(success);
+ expectEquals('server renegotiated', input.current);
X509Certificate certificate = socket.peerCertificate;
expect(certificate != null);
- expectEquals('CN=localhost', certificate.subject);
- expectEquals('CN=myauthority', certificate.issuer);
- StreamIterator<String> input = new StreamIterator(socket
- .transform(UTF8.decoder)
- .transform(new LineSplitter()));
- socket.writeln('first');
- input.moveNext()
- .then((success) {
- expect(success);
- expectEquals('first reply', input.current);
- socket.renegotiate();
- socket.writeln('renegotiated');
- return input.moveNext();
- })
- .then((success) {
- expect(success);
- expectEquals('server renegotiated', input.current);
- X509Certificate certificate = socket.peerCertificate;
- expect(certificate != null);
- expectEquals("CN=localhost", certificate.subject);
- expectEquals("CN=myauthority", certificate.issuer);
- socket.writeln('second');
- return input.moveNext();
- })
- .then((success) {
- expect(success != true);
- socket.close();
- });
+ expectEquals("CN=localhost", certificate.subject);
+ expectEquals("CN=myauthority", certificate.issuer);
+ socket.writeln('second');
+ return input.moveNext();
+ }).then((success) {
+ expect(success != true);
+ socket.close();
});
+ });
}
-
void main(List<String> args) {
runClient(int.parse(args[0]));
}

Powered by Google App Engine
This is Rietveld 408576698