| 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 library dart.io; | 10 library dart.io; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 | 22 |
| 23 | 23 |
| 24 const String webSocketGUID = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11"; | 24 const String webSocketGUID = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11"; |
| 25 const String CERT_NAME = 'localhost_cert'; | 25 const String CERT_NAME = 'localhost_cert'; |
| 26 const String HOST_NAME = 'localhost'; | 26 const String HOST_NAME = 'localhost'; |
| 27 | 27 |
| 28 String localFile(path) => Platform.script.resolve(path).toFilePath(); | 28 String localFile(path) => Platform.script.resolve(path).toFilePath(); |
| 29 List<int> readLocalFile(path) => (new File(localFile(path))).readAsBytesSync(); | 29 List<int> readLocalFile(path) => (new File(localFile(path))).readAsBytesSync(); |
| 30 | 30 |
| 31 SecurityContext serverContext = new SecurityContext() | 31 SecurityContext serverContext = new SecurityContext() |
| 32 ..useCertificateChain(localFile('certificates/server_chain.pem')) | 32 ..useCertificateChainBytes(readLocalFile('certificates/server_chain.pem')) |
| 33 ..usePrivateKeyAsBytes(readLocalFile('certificates/server_key.pem'), | 33 ..usePrivateKeyBytes(readLocalFile('certificates/server_key.pem'), |
| 34 password: 'dartdart'); | 34 password: 'dartdart'); |
| 35 | 35 |
| 36 SecurityContext clientContext = new SecurityContext() | 36 SecurityContext clientContext = new SecurityContext() |
| 37 ..setTrustedCertificates(file: localFile('certificates/trusted_certs.pem')); | 37 ..setTrustedCertificates(file: localFile('certificates/trusted_certs.pem')); |
| 38 | 38 |
| 39 /** | 39 /** |
| 40 * A SecurityConfiguration lets us run the tests over HTTP or HTTPS. | 40 * A SecurityConfiguration lets us run the tests over HTTP or HTTPS. |
| 41 */ | 41 */ |
| 42 class SecurityConfiguration { | 42 class SecurityConfiguration { |
| 43 final bool secure; | 43 final bool secure; |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 | 102 |
| 103 | 103 |
| 104 main() { | 104 main() { |
| 105 asyncStart(); | 105 asyncStart(); |
| 106 new SecurityConfiguration(secure: false).runTests(); | 106 new SecurityConfiguration(secure: false).runTests(); |
| 107 // TODO(whesse): WebSocket.connect needs an optional context: parameter | 107 // TODO(whesse): WebSocket.connect needs an optional context: parameter |
| 108 // new SecurityConfiguration(secure: true).runTests(); | 108 // new SecurityConfiguration(secure: true).runTests(); |
| 109 asyncEnd(); | 109 asyncEnd(); |
| 110 } | 110 } |
| 111 | 111 |
| OLD | NEW |