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

Unified Diff: tests/standalone/io/web_socket_typed_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/web_socket_typed_data_test.dart
diff --git a/tests/standalone/io/web_socket_typed_data_test.dart b/tests/standalone/io/web_socket_typed_data_test.dart
index 571b57d70327d2662fc91c4d96ec7344e367b4b8..cf253af0677439008d7c05d5f28fe5b2955c97ba 100644
--- a/tests/standalone/io/web_socket_typed_data_test.dart
+++ b/tests/standalone/io/web_socket_typed_data_test.dart
@@ -15,35 +15,32 @@ import "dart:typed_data";
Future<HttpServer> createServer() => HttpServer.bind("127.0.0.1", 0);
-Future<WebSocket> createClient(int port, bool compression) =>
- compression ? WebSocket.connect('ws://127.0.0.1:$port/')
+Future<WebSocket> createClient(int port, bool compression) => compression
+ ? WebSocket.connect('ws://127.0.0.1:$port/')
: WebSocket.connect('ws://127.0.0.1:$port/',
compression: CompressionOptions.OFF);
void test(expected, testData, compression) {
createServer().then((server) {
var messageCount = 0;
- var transformer = compression ? new WebSocketTransformer()
+ var transformer = compression
+ ? new WebSocketTransformer()
: new WebSocketTransformer(compression: CompressionOptions.OFF);
server.transform(transformer).listen((webSocket) {
- webSocket.listen(
- (message) {
- Expect.listEquals(expected, message);
- webSocket.add(testData[messageCount]);
- messageCount++;
- },
- onDone: () => Expect.equals(testData.length, messageCount));
+ webSocket.listen((message) {
+ Expect.listEquals(expected, message);
+ webSocket.add(testData[messageCount]);
+ messageCount++;
+ }, onDone: () => Expect.equals(testData.length, messageCount));
});
createClient(server.port, compression).then((webSocket) {
var messageCount = 0;
- webSocket.listen(
- (message) {
- Expect.listEquals(expected, message);
- messageCount++;
- if (messageCount == testData.length) webSocket.close();
- },
- onDone: server.close);
+ webSocket.listen((message) {
+ Expect.listEquals(expected, message);
+ messageCount++;
+ if (messageCount == testData.length) webSocket.close();
+ }, onDone: server.close);
testData.forEach(webSocket.add);
});
});
@@ -77,7 +74,8 @@ testIntLists({bool compression: false}) {
void testOutOfRangeClient({bool compression: false}) {
createServer().then((server) {
var messageCount = 0;
- var transformer = compression ? new WebSocketTransformer()
+ var transformer = compression
+ ? new WebSocketTransformer()
: new WebSocketTransformer(compression: CompressionOptions.OFF);
server.transform(transformer).listen((webSocket) {
webSocket.listen((message) => Expect.fail("No message expected"));
@@ -101,7 +99,6 @@ void testOutOfRangeClient({bool compression: false}) {
return completer.future;
}
-
var futures = [];
var data;
data = new Uint16List(1);
@@ -172,16 +169,17 @@ void testOutOfRangeServer({bool compression: false}) {
var allDone = new Completer();
Future expectError(future) {
- var completer = new Completer();
- future
- .then((_) => completer.completeError("Message $data did not fail"))
- .catchError((e) => completer.complete(true));
- return completer.future;
+ var completer = new Completer();
+ future
+ .then((_) => completer.completeError("Message $data did not fail"))
+ .catchError((e) => completer.complete(true));
+ return completer.future;
}
createServer().then((server) {
var messageCount = 0;
- var transformer = compression ? new WebSocketTransformer()
+ var transformer = compression
+ ? new WebSocketTransformer()
: new WebSocketTransformer(compression: CompressionOptions.OFF);
server.transform(transformer).listen((webSocket) {
webSocket.listen((message) {
@@ -196,17 +194,17 @@ void testOutOfRangeServer({bool compression: false}) {
Future x(int i) {
var completer = new Completer();
createClient(server.port, compression).then((webSocket) {
- webSocket.listen((message) => Expect.fail("No message expected"),
- onDone: () => completer.complete(true),
- onError: (e) => completer.completeError(e));
- webSocket.add(new List()..add(i));
+ webSocket.listen((message) => Expect.fail("No message expected"),
+ onDone: () => completer.complete(true),
+ onError: (e) => completer.completeError(e));
+ webSocket.add(new List()..add(i));
});
return completer.future;
}
for (int i = 0; i < testData.length; i++) futures.add(x(i));
- allDone.future.then(
- (_) => Future.wait(futures).then((_) => server.close()));
+ allDone.future
+ .then((_) => Future.wait(futures).then((_) => server.close()));
});
}

Powered by Google App Engine
This is Rietveld 408576698