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

Side by Side Diff: tests/standalone/io/web_socket_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
« no previous file with comments | « tests/standalone/io/web_socket_error_test.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 import "dart:async"; 10 import "dart:async";
11 import "dart:convert"; 11 import "dart:convert";
12 import "dart:io"; 12 import "dart:io";
13 import "dart:typed_data"; 13 import "dart:typed_data";
14 14
15 import "package:async_helper/async_helper.dart"; 15 import "package:async_helper/async_helper.dart";
16 import "package:crypto/crypto.dart"; 16 import "package:crypto/crypto.dart";
17 import "package:expect/expect.dart"; 17 import "package:expect/expect.dart";
18 import "package:path/path.dart"; 18 import "package:path/path.dart";
19 19
20 const WEB_SOCKET_GUID = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11"; 20 const WEB_SOCKET_GUID = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11";
21 21
22 const String HOST_NAME = 'localhost'; 22 const String HOST_NAME = 'localhost';
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();
26 25
27 SecurityContext serverContext = new SecurityContext() 26 SecurityContext serverContext = new SecurityContext()
28 ..useCertificateChainBytes(readLocalFile('certificates/server_chain.pem')) 27 ..useCertificateChainSync(localFile('certificates/server_chain.pem'))
29 ..usePrivateKeyBytes(readLocalFile('certificates/server_key.pem'), 28 ..usePrivateKeySync(localFile('certificates/server_key.pem'),
30 password: 'dartdart'); 29 password: 'dartdart');
31 30
32 SecurityContext clientContext = new SecurityContext() 31 SecurityContext clientContext = new SecurityContext()
33 ..setTrustedCertificates(file: localFile('certificates/trusted_certs.pem')); 32 ..setTrustedCertificatesSync(localFile('certificates/trusted_certs.pem'));
34 33
35 /** 34 /**
36 * A SecurityConfiguration lets us run the tests over HTTP or HTTPS. 35 * A SecurityConfiguration lets us run the tests over HTTP or HTTPS.
37 */ 36 */
38 class SecurityConfiguration { 37 class SecurityConfiguration {
39 final bool secure; 38 final bool secure;
40 39
41 SecurityConfiguration({bool this.secure}); 40 SecurityConfiguration({bool this.secure});
42 41
43 Future<HttpServer> createServer({int backlog: 0}) => 42 Future<HttpServer> createServer({int backlog: 0}) =>
(...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after
590 testBasicAuthentication(); 589 testBasicAuthentication();
591 } 590 }
592 } 591 }
593 592
594 593
595 main() { 594 main() {
596 new SecurityConfiguration(secure: false).runTests(); 595 new SecurityConfiguration(secure: false).runTests();
597 // TODO(whesse): Make WebSocket.connect() take an optional context: parameter. 596 // TODO(whesse): Make WebSocket.connect() take an optional context: parameter.
598 // new SecurityConfiguration(secure: true).runTests(); 597 // new SecurityConfiguration(secure: true).runTests();
599 } 598 }
OLDNEW
« no previous file with comments | « tests/standalone/io/web_socket_error_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698