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

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

Issue 1665433002: Adds SecurityContext.setTrustedCertificatesBytes (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Adds MemBIOScope 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 "dart:async"; 10 import "dart:async";
11 import "dart:io"; 11 import "dart:io";
12 12
13 import "package:async_helper/async_helper.dart"; 13 import "package:async_helper/async_helper.dart";
14 import "package:expect/expect.dart"; 14 import "package:expect/expect.dart";
15 15
16 InternetAddress HOST; 16 InternetAddress HOST;
17 String localFile(path) => Platform.script.resolve(path).toFilePath(); 17 String localFile(path) => Platform.script.resolve(path).toFilePath();
18 List<int> readLocalFile(path) => (new File(localFile(path))).readAsBytesSync(); 18 List<int> readLocalFile(path) => (new File(localFile(path))).readAsBytesSync();
19 19
20 SecurityContext serverContext = new SecurityContext() 20 SecurityContext serverContext = new SecurityContext()
21 ..useCertificateChainBytes(readLocalFile('certificates/server_chain.pem')) 21 ..useCertificateChainBytes(readLocalFile('certificates/server_chain.pem'))
22 ..usePrivateKeyBytes(readLocalFile('certificates/server_key.pem'), 22 ..usePrivateKeyBytes(readLocalFile('certificates/server_key.pem'),
23 password: 'dartdart'); 23 password: 'dartdart');
24 24
25 SecurityContext clientContext = new SecurityContext() 25 SecurityContext clientContext = new SecurityContext()
26 ..setTrustedCertificates(file: localFile('certificates/trusted_certs.pem')); 26 ..setTrustedCertificatesBytes(
27 readLocalFile('certificates/trusted_certs.pem'));
27 28
28 // This test creates a server and a client connects. After connecting 29 // This test creates a server and a client connects. After connecting
29 // and an optional initial handshake the connection is secured by 30 // and an optional initial handshake the connection is secured by
30 // upgrading to a secure connection The client then writes and the 31 // upgrading to a secure connection The client then writes and the
31 // server echos. When the server has finished its echo it 32 // server echos. When the server has finished its echo it
32 // half-closes. When the client gets the close event is closes fully. 33 // half-closes. When the client gets the close event is closes fully.
33 // 34 //
34 // The test can be run in different configurations based on 35 // The test can be run in different configurations based on
35 // the boolean arguments: 36 // the boolean arguments:
36 // 37 //
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 test(false, false); 232 test(false, false);
232 // TODO(whesse): Enable the test with all argument combinations: 233 // TODO(whesse): Enable the test with all argument combinations:
233 // test(true, false); 234 // test(true, false);
234 // test(false, true); 235 // test(false, true);
235 // test(true, true); 236 // test(true, true);
236 // test(false, true, true); 237 // test(false, true, true);
237 // test(true, true, true); 238 // test(true, true, true);
238 asyncEnd(); 239 asyncEnd();
239 }); 240 });
240 } 241 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698