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

Side by Side Diff: tests/standalone/io/raw_secure_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
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 "package:expect/expect.dart"; 10 import "package:expect/expect.dart";
11 import "package:path/path.dart"; 11 import "package:path/path.dart";
12 import "dart:async"; 12 import "dart:async";
13 import "dart:io"; 13 import "dart:io";
14 import "dart:isolate"; 14 import "dart:isolate";
15 15
16 String localFile(path) => Platform.script.resolve(path).toFilePath(); 16 String localFile(path) => Platform.script.resolve(path).toFilePath();
17 List<int> readLocalFile(path) => (new File(localFile(path))).readAsBytesSync();
18 17
19 SecurityContext serverContext = new SecurityContext() 18 SecurityContext serverContext = new SecurityContext()
20 ..useCertificateChainBytes(readLocalFile('certificates/server_chain.pem')) 19 ..useCertificateChainSync(localFile('certificates/server_chain.pem'))
21 ..usePrivateKeyBytes(readLocalFile('certificates/server_key.pem'), 20 ..usePrivateKeySync(localFile('certificates/server_key.pem'),
22 password: 'dartdart'); 21 password: 'dartdart');
23 22
24 SecurityContext clientContext = new SecurityContext() 23 SecurityContext clientContext = new SecurityContext()
25 ..setTrustedCertificates(file: localFile('certificates/trusted_certs.pem')); 24 ..setTrustedCertificatesSync(localFile('certificates/trusted_certs.pem'));
26 25
27 main() async { 26 main() async {
28 List<int> message = "GET / HTTP/1.0\r\nHost: localhost\r\n\r\n".codeUnits; 27 List<int> message = "GET / HTTP/1.0\r\nHost: localhost\r\n\r\n".codeUnits;
29 int written = 0; 28 int written = 0;
30 List<int> body = <int>[]; 29 List<int> body = <int>[];
31 var server = await HttpServer.bindSecure( 30 var server = await HttpServer.bindSecure(
32 "localhost", 31 "localhost",
33 0, 32 0,
34 serverContext, 33 serverContext,
35 backlog: 5); 34 backlog: 5);
(...skipping 29 matching lines...) Expand all
65 server.close(); 64 server.close();
66 break; 65 break;
67 default: throw "Unexpected event $event"; 66 default: throw "Unexpected event $event";
68 } 67 }
69 }, onError: (e, trace) { 68 }, onError: (e, trace) {
70 String msg = "onError handler of RawSecureSocket stream hit $e"; 69 String msg = "onError handler of RawSecureSocket stream hit $e";
71 if (trace != null) msg += "\nStackTrace: $trace"; 70 if (trace != null) msg += "\nStackTrace: $trace";
72 Expect.fail(msg); 71 Expect.fail(msg);
73 }); 72 });
74 } 73 }
OLDNEW
« no previous file with comments | « tests/standalone/io/raw_secure_socket_pause_test.dart ('k') | tests/standalone/io/regress_21160_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698