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

Unified Diff: dart/tests/standalone/io/web_socket_test.dart

Issue 550173007: Version 1.6.1 (Closed) Base URL: http://dart.googlecode.com/svn/branches/1.6/
Patch Set: Created 6 years, 3 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
« no previous file with comments | « dart/tests/corelib/uri_test.dart ('k') | dart/tools/VERSION » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dart/tests/standalone/io/web_socket_test.dart
===================================================================
--- dart/tests/standalone/io/web_socket_test.dart (revision 40021)
+++ dart/tests/standalone/io/web_socket_test.dart (working copy)
@@ -43,9 +43,14 @@
void testRequestResponseClientCloses(int totalConnections,
int closeStatus,
- String closeReason) {
+ String closeReason,
+ int numberOfMessages) {
+ assert (numberOfMessages >= 1);
+
+ asyncStart();
createServer().then((server) {
server.transform(new WebSocketTransformer()).listen((webSocket) {
+ asyncStart();
webSocket.listen(
webSocket.add,
onDone: () {
@@ -55,20 +60,24 @@
Expect.equals(
closeReason == null ? ""
: closeReason, webSocket.closeReason);
+ asyncEnd();
});
+ }, onDone: () {
+ asyncEnd();
});
int closeCount = 0;
String messageText = "Hello, world!";
for (int i = 0; i < totalConnections; i++) {
- int messageCount = 0;
+ asyncStart();
createClient(server.port).then((webSocket) {
webSocket.add(messageText);
webSocket.listen(
(message) {
- messageCount++;
- if (messageCount < 1 ) {
- Expect.equals(messageText, message);
+ numberOfMessages--;
+ Expect.equals(messageText, message);
+
+ if (numberOfMessages > 0) {
webSocket.add(message);
} else {
webSocket.close(closeStatus, closeReason);
@@ -83,6 +92,7 @@
if (closeCount == totalConnections) {
server.close();
}
+ asyncEnd();
});
});
}
@@ -423,9 +433,9 @@
}
void runTests() {
- testRequestResponseClientCloses(2, null, null);
- testRequestResponseClientCloses(2, 3001, null);
- testRequestResponseClientCloses(2, 3002, "Got tired");
+ testRequestResponseClientCloses(2, null, null, 1);
+ testRequestResponseClientCloses(2, 3001, null, 2);
+ testRequestResponseClientCloses(2, 3002, "Got tired", 3);
testRequestResponseServerCloses(2, null, null);
testRequestResponseServerCloses(2, 3001, null);
testRequestResponseServerCloses(2, 3002, "Got tired");
@@ -455,9 +465,7 @@
main() {
- asyncStart();
new SecurityConfiguration(secure: false).runTests();
initializeSSL();
new SecurityConfiguration(secure: true).runTests();
- asyncEnd();
}
« no previous file with comments | « dart/tests/corelib/uri_test.dart ('k') | dart/tools/VERSION » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698