OLD | NEW |
---|---|
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 // VMOptions= | 5 // VMOptions= |
6 // VMOptions=--short_socket_read | 6 // VMOptions=--short_socket_read |
7 // VMOptions=--short_socket_write | 7 // VMOptions=--short_socket_write |
8 // VMOptions=--short_socket_read --short_socket_write | 8 // VMOptions=--short_socket_read --short_socket_write |
9 | 9 |
10 import "dart:async"; | 10 import "dart:async"; |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
180 webSocket.close(); | 180 webSocket.close(); |
181 }); | 181 }); |
182 | 182 |
183 createClient(server.port).then((webSocket) { | 183 createClient(server.port).then((webSocket) { |
184 webSocket.close(); | 184 webSocket.close(); |
185 }); | 185 }); |
186 }); | 186 }); |
187 } | 187 } |
188 | 188 |
189 | 189 |
190 void testCancelThenClose() { | |
191 createServer().then((server) { | |
192 server.transform(new WebSocketTransformer()).listen((webSocket) { | |
193 webSocket.listen(null).cancel(); | |
Anders Johnsen
2015/07/15 06:32:48
Can you add a test where you close before cancel?
nweiz
2015/07/15 20:29:34
Done.
Anders Johnsen
2015/07/20 11:59:21
Cool, thank you!
| |
194 webSocket.close(); | |
195 server.close(); | |
196 }); | |
197 | |
198 createClient(server.port).then((webSocket) { | |
199 webSocket.close(); | |
200 }); | |
201 }); | |
202 } | |
203 | |
204 | |
190 void testListenAfterClose() { | 205 void testListenAfterClose() { |
191 createServer().then((server) { | 206 createServer().then((server) { |
192 server.transform(new WebSocketTransformer()).listen((webSocket) { | 207 server.transform(new WebSocketTransformer()).listen((webSocket) { |
193 server.close(); | 208 server.close(); |
194 webSocket.close(); | 209 webSocket.close(); |
195 Expect.throws(() => webSocket.drain()); | 210 Expect.throws(() => webSocket.drain()); |
196 }); | 211 }); |
197 | 212 |
198 createClient(server.port).then((webSocket) { | 213 createClient(server.port).then((webSocket) { |
199 webSocket.close(); | 214 webSocket.close(); |
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
536 testRequestResponseClientCloses(2, 3002, "Got tired", 3); | 551 testRequestResponseClientCloses(2, 3002, "Got tired", 3); |
537 testRequestResponseServerCloses(2, null, null); | 552 testRequestResponseServerCloses(2, null, null); |
538 testRequestResponseServerCloses(2, 3001, null); | 553 testRequestResponseServerCloses(2, 3001, null); |
539 testRequestResponseServerCloses(2, 3002, "Got tired"); | 554 testRequestResponseServerCloses(2, 3002, "Got tired"); |
540 testMessageLength(125); | 555 testMessageLength(125); |
541 testMessageLength(126); | 556 testMessageLength(126); |
542 testMessageLength(127); | 557 testMessageLength(127); |
543 testMessageLength(65535); | 558 testMessageLength(65535); |
544 testMessageLength(65536); | 559 testMessageLength(65536); |
545 testCloseNoListen(); | 560 testCloseNoListen(); |
561 testCancelThenClose(); | |
546 testListenAfterClose(); | 562 testListenAfterClose(); |
547 testDoubleCloseClient(); | 563 testDoubleCloseClient(); |
548 testDoubleCloseServer(); | 564 testDoubleCloseServer(); |
549 testImmediateCloseServer(); | 565 testImmediateCloseServer(); |
550 testImmediateCloseClient(); | 566 testImmediateCloseClient(); |
551 testNoUpgrade(); | 567 testNoUpgrade(); |
552 testUsePOST(); | 568 testUsePOST(); |
553 testConnections(10, 3002, "Got tired"); | 569 testConnections(10, 3002, "Got tired"); |
554 testIndividualUpgrade(5); | 570 testIndividualUpgrade(5); |
555 testFromUpgradedSocket(); | 571 testFromUpgradedSocket(); |
556 testAdditionalHeaders(); | 572 testAdditionalHeaders(); |
557 testBasicAuthentication(); | 573 testBasicAuthentication(); |
558 } | 574 } |
559 } | 575 } |
560 | 576 |
561 | 577 |
562 void initializeSSL() { | 578 void initializeSSL() { |
563 var testPkcertDatabase = Platform.script.resolve('pkcert').toFilePath(); | 579 var testPkcertDatabase = Platform.script.resolve('pkcert').toFilePath(); |
564 SecureSocket.initialize(database: testPkcertDatabase, | 580 SecureSocket.initialize(database: testPkcertDatabase, |
565 password: "dartdart"); | 581 password: "dartdart"); |
566 } | 582 } |
567 | 583 |
568 | 584 |
569 main() { | 585 main() { |
570 new SecurityConfiguration(secure: false).runTests(); | 586 new SecurityConfiguration(secure: false).runTests(); |
571 initializeSSL(); | 587 initializeSSL(); |
572 new SecurityConfiguration(secure: true).runTests(); | 588 new SecurityConfiguration(secure: true).runTests(); |
573 } | 589 } |
OLD | NEW |