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

Side by Side Diff: pkg/http_parser/test/web_socket_test.dart

Issue 247893005: Fix analyzer errors in the http_parser web socket test. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library http_parser.web_socket_test; 5 library http_parser.web_socket_test;
6 6
7 import 'dart:io'; 7 import 'dart:io';
8 8
9 import 'package:http_parser/http_parser.dart'; 9 import 'package:http_parser/http_parser.dart';
10 import 'package:unittest/unittest.dart'; 10 import 'package:unittest/unittest.dart';
(...skipping 25 matching lines...) Expand all
36 var n = 0; 36 var n = 0;
37 return webSocket.listen((message) { 37 return webSocket.listen((message) {
38 if (n == 0) { 38 if (n == 0) {
39 expect(message, equals("hello!")); 39 expect(message, equals("hello!"));
40 webSocket.add("ping"); 40 webSocket.add("ping");
41 } else if (n == 1) { 41 } else if (n == 1) {
42 expect(message, equals("pong")); 42 expect(message, equals("pong"));
43 webSocket.close(); 43 webSocket.close();
44 server.close(); 44 server.close();
45 } else { 45 } else {
46 expect(false, reason: "Only expected two messages."); 46 fail("Only expected two messages.");
47 } 47 }
48 n++; 48 n++;
49 }).asFuture(); 49 }).asFuture();
50 }); 50 });
51 }); 51 });
52 }); 52 });
53 53
54 test("a server can communicate with a WebSocket client", () { 54 test("a server can communicate with a WebSocket client", () {
55 return HttpServer.bind("localhost", 0).then((server) { 55 return HttpServer.bind("localhost", 0).then((server) {
56 server.listen((request) { 56 server.listen((request) {
(...skipping 21 matching lines...) Expand all
78 var n = 0; 78 var n = 0;
79 return webSocket.listen((message) { 79 return webSocket.listen((message) {
80 if (n == 0) { 80 if (n == 0) {
81 expect(message, equals("hello!")); 81 expect(message, equals("hello!"));
82 webSocket.add("ping"); 82 webSocket.add("ping");
83 } else if (n == 1) { 83 } else if (n == 1) {
84 expect(message, equals("pong")); 84 expect(message, equals("pong"));
85 webSocket.close(); 85 webSocket.close();
86 server.close(); 86 server.close();
87 } else { 87 } else {
88 expect(false, reason: "Only expected two messages."); 88 fail("Only expected two messages.");
89 } 89 }
90 n++; 90 n++;
91 }).asFuture(); 91 }).asFuture();
92 }); 92 });
93 }); 93 });
94 }); 94 });
95 } 95 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698