| 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 12 matching lines...) Expand all Loading... |
| 23 | 23 |
| 24 String localFile(path) => Platform.script.resolve(path).toFilePath(); | 24 String localFile(path) => Platform.script.resolve(path).toFilePath(); |
| 25 List<int> readLocalFile(path) => (new File(localFile(path))).readAsBytesSync(); | 25 List<int> readLocalFile(path) => (new File(localFile(path))).readAsBytesSync(); |
| 26 | 26 |
| 27 SecurityContext serverContext = new SecurityContext() | 27 SecurityContext serverContext = new SecurityContext() |
| 28 ..useCertificateChainBytes(readLocalFile('certificates/server_chain.pem')) | 28 ..useCertificateChainBytes(readLocalFile('certificates/server_chain.pem')) |
| 29 ..usePrivateKeyBytes(readLocalFile('certificates/server_key.pem'), | 29 ..usePrivateKeyBytes(readLocalFile('certificates/server_key.pem'), |
| 30 password: 'dartdart'); | 30 password: 'dartdart'); |
| 31 | 31 |
| 32 SecurityContext clientContext = new SecurityContext() | 32 SecurityContext clientContext = new SecurityContext() |
| 33 ..setTrustedCertificates(file: localFile('certificates/trusted_certs.pem')); | 33 ..setTrustedCertificatesBytes( |
| 34 readLocalFile('certificates/trusted_certs.pem')); |
| 34 | 35 |
| 35 /** | 36 /** |
| 36 * A SecurityConfiguration lets us run the tests over HTTP or HTTPS. | 37 * A SecurityConfiguration lets us run the tests over HTTP or HTTPS. |
| 37 */ | 38 */ |
| 38 class SecurityConfiguration { | 39 class SecurityConfiguration { |
| 39 final bool secure; | 40 final bool secure; |
| 40 | 41 |
| 41 SecurityConfiguration({bool this.secure}); | 42 SecurityConfiguration({bool this.secure}); |
| 42 | 43 |
| 43 Future<HttpServer> createServer({int backlog: 0}) => | 44 Future<HttpServer> createServer({int backlog: 0}) => |
| (...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 590 testBasicAuthentication(); | 591 testBasicAuthentication(); |
| 591 } | 592 } |
| 592 } | 593 } |
| 593 | 594 |
| 594 | 595 |
| 595 main() { | 596 main() { |
| 596 new SecurityConfiguration(secure: false).runTests(); | 597 new SecurityConfiguration(secure: false).runTests(); |
| 597 // TODO(whesse): Make WebSocket.connect() take an optional context: parameter. | 598 // TODO(whesse): Make WebSocket.connect() take an optional context: parameter. |
| 598 // new SecurityConfiguration(secure: true).runTests(); | 599 // new SecurityConfiguration(secure: true).runTests(); |
| 599 } | 600 } |
| OLD | NEW |