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

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

Issue 1757453002: Rolls back fix of SecurityContext method names. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 9 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) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 import 'dart:io'; 5 import 'dart:io';
6 import 'dart:convert'; 6 import 'dart:convert';
7 7
8 import 'package:expect/expect.dart'; 8 import 'package:expect/expect.dart';
9 import 'package:async_helper/async_helper.dart'; 9 import 'package:async_helper/async_helper.dart';
10 10
11 const String NAME_LENGTH_ERROR = 11 const String NAME_LENGTH_ERROR =
12 'Length of protocol must be between 1 and 255'; 12 'Length of protocol must be between 1 and 255';
13 13
14 const String MESSAGE_LENGTH_ERROR = 14 const String MESSAGE_LENGTH_ERROR =
15 'The maximum message length supported is 2^13-1'; 15 'The maximum message length supported is 2^13-1';
16 16
17 String localFile(path) => Platform.script.resolve(path).toFilePath(); 17 String localFile(path) => Platform.script.resolve(path).toFilePath();
18 18
19 SecurityContext clientContext() => new SecurityContext() 19 SecurityContext clientContext() => new SecurityContext()
20 ..setTrustedCertificatesSync(localFile('certificates/trusted_certs.pem')); 20 ..setTrustedCertificates(localFile('certificates/trusted_certs.pem'));
21 21
22 SecurityContext serverContext() => new SecurityContext() 22 SecurityContext serverContext() => new SecurityContext()
23 ..useCertificateChainSync(localFile('certificates/server_chain.pem')) 23 ..useCertificateChain(localFile('certificates/server_chain.pem'))
24 ..usePrivateKeySync(localFile('certificates/server_key.pem'), 24 ..usePrivateKey(localFile('certificates/server_key.pem'),
25 password: 'dartdart'); 25 password: 'dartdart');
26 26
27 // Tests that client/server with same protocol can securely establish a 27 // Tests that client/server with same protocol can securely establish a
28 // connection, negotiate the protocol and can send data to each other. 28 // connection, negotiate the protocol and can send data to each other.
29 void testSuccessfulAlpnNegotiationConnection(List<String> clientProtocols, 29 void testSuccessfulAlpnNegotiationConnection(List<String> clientProtocols,
30 List<String> serverProtocols, 30 List<String> serverProtocols,
31 String selectedProtocol) { 31 String selectedProtocol) {
32 asyncStart(); 32 asyncStart();
33 var sContext = serverContext()..setAlpnProtocols(serverProtocols, true); 33 var sContext = serverContext()..setAlpnProtocols(serverProtocols, true);
34 SecureServerSocket.bind('localhost', 0, sContext) 34 SecureServerSocket.bind('localhost', 0, sContext)
35 .then((SecureServerSocket server) { 35 .then((SecureServerSocket server) {
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 // Issue https://github.com/dart-lang/sdk/issues/23580 195 // Issue https://github.com/dart-lang/sdk/issues/23580
196 // Chromium issue https://code.google.com/p/chromium/issues/detail?id=497770 196 // Chromium issue https://code.google.com/p/chromium/issues/detail?id=497770
197 testSuccessfulAlpnNegotiationConnection(['a'], ['b'], null); 197 testSuccessfulAlpnNegotiationConnection(['a'], ['b'], null);
198 198
199 // Test too short / too long protocol names. 199 // Test too short / too long protocol names.
200 testInvalidArgument([longname256], NAME_LENGTH_ERROR); 200 testInvalidArgument([longname256], NAME_LENGTH_ERROR);
201 testInvalidArgument([strangelongname256], NAME_LENGTH_ERROR); 201 testInvalidArgument([strangelongname256], NAME_LENGTH_ERROR);
202 testInvalidArgument([''], NAME_LENGTH_ERROR); 202 testInvalidArgument([''], NAME_LENGTH_ERROR);
203 testInvalidArgument(tooManyProtocols, MESSAGE_LENGTH_ERROR); 203 testInvalidArgument(tooManyProtocols, MESSAGE_LENGTH_ERROR);
204 } 204 }
OLDNEW
« no previous file with comments | « tests/standalone/io/secure_session_resume_test.dart ('k') | tests/standalone/io/secure_socket_renegotiate_client.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698