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

Unified Diff: tests/standalone/io/secure_socket_bad_data_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_bad_data_test.dart
diff --git a/tests/standalone/io/secure_socket_bad_data_test.dart b/tests/standalone/io/secure_socket_bad_data_test.dart
index 282610722fff1d9aed3ceba0d48e6df4b24823bf..1b8d386afaa57b0b95e86a8712f9dbc9482ee851 100644
--- a/tests/standalone/io/secure_socket_bad_data_test.dart
+++ b/tests/standalone/io/secure_socket_bad_data_test.dart
@@ -22,7 +22,6 @@ const CERTIFICATE = "localhost_cert";
// have a reference to the underlying socket. Then we send some
// unencrypted data on it, in the middle of an encrypted data transfer.
-
// This test creates a server and then connects a client to the server.
// After connecting, the connection is upgraded to a secure connection.
// The client writes data to the server, then writes unencrypted data
@@ -33,7 +32,6 @@ const CERTIFICATE = "localhost_cert";
const messageSize = 1000;
-
List<int> createTestData() {
List<int> data = new List<int>(messageSize);
for (int i = 0; i < messageSize; i++) {
@@ -42,7 +40,6 @@ List<int> createTestData() {
return data;
}
-
void verifyTestData(List<int> data) {
Expect.equals(messageSize, data.length);
List<int> expected = createTestData();
@@ -51,7 +48,6 @@ void verifyTestData(List<int> data) {
}
}
-
Future runServer(RawSocket client) {
final completer = new Completer();
final dataReceived = new List<int>(messageSize);
@@ -77,8 +73,7 @@ Future runServer(RawSocket client) {
completer.complete(null);
break;
}
- },
- onError: (e) {
+ }, onError: (e) {
Expect.isTrue(e is TlsException);
Expect.isTrue(e.toString().contains(
'received a record with an incorrect Message Authentication Code'));
@@ -87,7 +82,6 @@ Future runServer(RawSocket client) {
return completer.future;
}
-
Future<RawSocket> runClient(List sockets) {
final RawSocket baseSocket = sockets[0];
final RawSecureSocket socket = sockets[1];
@@ -108,7 +102,7 @@ Future<RawSocket> runClient(List sockets) {
break;
case RawSocketEvent.WRITE:
if (bytesWritten < data.length) {
- bytesWritten += socket.write(data, bytesWritten);
+ bytesWritten += socket.write(data, bytesWritten);
}
if (bytesWritten < data.length) {
socket.writeEventsEnabled = true;
@@ -122,41 +116,33 @@ Future<RawSocket> runClient(List sockets) {
tryComplete();
break;
}
- },
- onError: (e) {
+ }, onError: (e) {
Expect.isTrue(e is IOException);
tryComplete();
});
return completer.future;
}
-
Future<List> connectClient(int port, bool hostnameInConnect) =>
- RawSocket.connect(HOST, port)
- .then((socket) =>
- (hostnameInConnect ? RawSecureSocket.secure(socket)
- : RawSecureSocket.secure(socket, host: HOST))
- .then((secureSocket) => [socket, secureSocket]));
-
+ RawSocket.connect(HOST, port).then((socket) => (hostnameInConnect
+ ? RawSecureSocket.secure(socket)
+ : RawSecureSocket.secure(socket, host: HOST))
+ .then((secureSocket) => [socket, secureSocket]));
Future test(bool hostnameInConnect) {
return RawServerSocket.bind(HOST, 0).then((server) {
server.listen((client) {
- RawSecureSocket.secureServer(client, CERTIFICATE)
- .then((secureClient) {
- Expect.throws(() => client.add([0]));
- return runServer(secureClient);
- },
- onError: (e) {
- Expect.isTrue(e is HandshakeException);
- })
- .whenComplete(server.close);
+ RawSecureSocket.secureServer(client, CERTIFICATE).then((secureClient) {
+ Expect.throws(() => client.add([0]));
+ return runServer(secureClient);
+ }, onError: (e) {
+ Expect.isTrue(e is HandshakeException);
+ }).whenComplete(server.close);
});
return connectClient(server.port, hostnameInConnect).then(runClient);
});
}
-
main() {
asyncStart();
InternetAddress.lookup("localhost").then((hosts) {

Powered by Google App Engine
This is Rietveld 408576698