| 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"; |
| 11 import "dart:io"; | 11 import "dart:io"; |
| 12 | 12 |
| 13 import "package:async_helper/async_helper.dart"; | 13 import "package:async_helper/async_helper.dart"; |
| 14 import "package:expect/expect.dart"; | 14 import "package:expect/expect.dart"; |
| 15 | 15 |
| 16 InternetAddress HOST; | 16 InternetAddress HOST; |
| 17 | 17 |
| 18 String localFile(path) => Platform.script.resolve(path).toFilePath(); | 18 String localFile(path) => Platform.script.resolve(path).toFilePath(); |
| 19 List<int> readLocalFile(path) => (new File(localFile(path))).readAsBytesSync(); |
| 19 | 20 |
| 20 SecurityContext serverContext = new SecurityContext() | 21 SecurityContext serverContext = new SecurityContext() |
| 21 ..useCertificateChain(localFile('certificates/server_chain.pem')) | 22 ..useCertificateChain(localFile('certificates/server_chain.pem')) |
| 22 ..usePrivateKey(localFile('certificates/server_key.pem'), | 23 ..usePrivateKeyAsBytes(readLocalFile('certificates/server_key.pem'), |
| 23 password: 'dartdart'); | 24 password: 'dartdart'); |
| 24 | 25 |
| 25 SecurityContext clientContext = new SecurityContext() | 26 SecurityContext clientContext = new SecurityContext() |
| 26 ..setTrustedCertificates(file: localFile('certificates/trusted_certs.pem')); | 27 ..setTrustedCertificates(file: localFile('certificates/trusted_certs.pem')); |
| 27 | 28 |
| 28 void testCloseOneEnd(String toClose) { | 29 void testCloseOneEnd(String toClose) { |
| 29 asyncStart(); | 30 asyncStart(); |
| 30 Completer serverDone = new Completer(); | 31 Completer serverDone = new Completer(); |
| 31 Completer serverEndDone = new Completer(); | 32 Completer serverEndDone = new Completer(); |
| 32 Completer clientEndDone = new Completer(); | 33 Completer clientEndDone = new Completer(); |
| 33 Future.wait([serverDone.future, serverEndDone.future, clientEndDone.future]) | 34 Future.wait([serverDone.future, serverEndDone.future, clientEndDone.future]) |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 | 176 |
| 176 runTests() { | 177 runTests() { |
| 177 testCloseOneEnd("client"); | 178 testCloseOneEnd("client"); |
| 178 testCloseOneEnd("server"); | 179 testCloseOneEnd("server"); |
| 179 testCloseBothEnds(); | 180 testCloseBothEnds(); |
| 180 testPauseServerSocket(); | 181 testPauseServerSocket(); |
| 181 testCloseServer(); | 182 testCloseServer(); |
| 182 // TODO(whesse): Add testPauseSocket from raw_socket_test.dart. | 183 // TODO(whesse): Add testPauseSocket from raw_socket_test.dart. |
| 183 // TODO(whesse): Add testCancelResubscribeSocket from raw_socket_test.dart. | 184 // TODO(whesse): Add testCancelResubscribeSocket from raw_socket_test.dart. |
| 184 } | 185 } |
| OLD | NEW |