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

Side by Side Diff: tests/standalone/io/web_socket_error_test.dart

Issue 1665433002: Adds SecurityContext.setTrustedCertificatesBytes (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 10 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
OLDNEW
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;
11 11
12 import "dart:async"; 12 import "dart:async";
13 import "dart:io"; 13 import "dart:io";
14 import "dart:math"; 14 import "dart:math";
15 import "dart:typed_data"; 15 import "dart:typed_data";
16 16
17 import "package:async_helper/async_helper.dart"; 17 import "package:async_helper/async_helper.dart";
18 import "package:expect/expect.dart"; 18 import "package:expect/expect.dart";
19 import "package:path/path.dart"; 19 import "package:path/path.dart";
20 20
21 part "../../../sdk/lib/io/crypto.dart"; 21 part "../../../sdk/lib/io/crypto.dart";
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();
30 29
31 SecurityContext serverContext = new SecurityContext() 30 SecurityContext serverContext = new SecurityContext()
32 ..useCertificateChainBytes(readLocalFile('certificates/server_chain.pem')) 31 ..useCertificateChainSync(localFile('certificates/server_chain.pem'))
33 ..usePrivateKeyBytes(readLocalFile('certificates/server_key.pem'), 32 ..usePrivateKeySync(localFile('certificates/server_key.pem'),
34 password: 'dartdart'); 33 password: 'dartdart');
35 34
36 SecurityContext clientContext = new SecurityContext() 35 SecurityContext clientContext = new SecurityContext()
37 ..setTrustedCertificates(file: localFile('certificates/trusted_certs.pem')); 36 ..setTrustedCertificatesSync(localFile('certificates/trusted_certs.pem'));
38 37
39 /** 38 /**
40 * A SecurityConfiguration lets us run the tests over HTTP or HTTPS. 39 * A SecurityConfiguration lets us run the tests over HTTP or HTTPS.
41 */ 40 */
42 class SecurityConfiguration { 41 class SecurityConfiguration {
43 final bool secure; 42 final bool secure;
44 43
45 SecurityConfiguration({bool this.secure}); 44 SecurityConfiguration({bool this.secure});
46 45
47 Future<HttpServer> createServer({int backlog: 0}) => 46 Future<HttpServer> createServer({int backlog: 0}) =>
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 101
103 102
104 main() { 103 main() {
105 asyncStart(); 104 asyncStart();
106 new SecurityConfiguration(secure: false).runTests(); 105 new SecurityConfiguration(secure: false).runTests();
107 // TODO(whesse): WebSocket.connect needs an optional context: parameter 106 // TODO(whesse): WebSocket.connect needs an optional context: parameter
108 // new SecurityConfiguration(secure: true).runTests(); 107 // new SecurityConfiguration(secure: true).runTests();
109 asyncEnd(); 108 asyncEnd();
110 } 109 }
111 110
OLDNEW
« no previous file with comments | « tests/standalone/io/web_socket_compression_test.dart ('k') | tests/standalone/io/web_socket_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698