OLD | NEW |
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 // OtherResources=certificates/server_chain.pem | 5 // OtherResources=certificates/server_chain.pem |
6 // OtherResources=certificates/server_key.pem | 6 // OtherResources=certificates/server_key.pem |
7 // OtherResources=certificates/trusted_certs.pem | 7 // OtherResources=certificates/trusted_certs.pem |
8 | 8 |
9 import 'dart:io'; | 9 import 'dart:io'; |
10 import 'dart:convert'; | 10 import 'dart:convert'; |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 Expect.isTrue(e is ArgumentError); | 118 Expect.isTrue(e is ArgumentError); |
119 Expect.isTrue(e.toString().contains(errorIncludes)); | 119 Expect.isTrue(e.toString().contains(errorIncludes)); |
120 server.close(); | 120 server.close(); |
121 asyncEnd(); | 121 asyncEnd(); |
122 }); | 122 }); |
123 asyncEnd(); | 123 asyncEnd(); |
124 }); | 124 }); |
125 } | 125 } |
126 | 126 |
127 main() { | 127 main() { |
128 if (!SecurityContext.alpnSupported) { | |
129 return 0; | |
130 } | |
131 final longname256 = 'p' * 256; | 128 final longname256 = 'p' * 256; |
132 final String longname255 = 'p' * 255; | 129 final String longname255 = 'p' * 255; |
133 final String strangelongname255 = 'ø' + 'p' * 253; | 130 final String strangelongname255 = 'ø' + 'p' * 253; |
134 final String strangelongname256 = 'ø' + 'p' * 254; | 131 final String strangelongname256 = 'ø' + 'p' * 254; |
135 | 132 |
136 // This produces a message of (1 << 13) - 2 bytes. 2^12 -1 strings are each | 133 // This produces a message of (1 << 13) - 2 bytes. 2^12 -1 strings are each |
137 // encoded by 1 length byte and 1 ascii byte. | 134 // encoded by 1 length byte and 1 ascii byte. |
138 final List<String> manyProtocols = | 135 final List<String> manyProtocols = |
139 new Iterable.generate((1 << 12) - 1, (i) => '0').toList(); | 136 new Iterable.generate((1 << 12) - 1, (i) => '0').toList(); |
140 | 137 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 // Issue https://github.com/dart-lang/sdk/issues/23580 | 182 // Issue https://github.com/dart-lang/sdk/issues/23580 |
186 // Chromium issue https://code.google.com/p/chromium/issues/detail?id=497770 | 183 // Chromium issue https://code.google.com/p/chromium/issues/detail?id=497770 |
187 testSuccessfulAlpnNegotiationConnection(['a'], ['b'], null); | 184 testSuccessfulAlpnNegotiationConnection(['a'], ['b'], null); |
188 | 185 |
189 // Test too short / too long protocol names. | 186 // Test too short / too long protocol names. |
190 testInvalidArgument([longname256], NAME_LENGTH_ERROR); | 187 testInvalidArgument([longname256], NAME_LENGTH_ERROR); |
191 testInvalidArgument([strangelongname256], NAME_LENGTH_ERROR); | 188 testInvalidArgument([strangelongname256], NAME_LENGTH_ERROR); |
192 testInvalidArgument([''], NAME_LENGTH_ERROR); | 189 testInvalidArgument([''], NAME_LENGTH_ERROR); |
193 testInvalidArgument(tooManyProtocols, MESSAGE_LENGTH_ERROR); | 190 testInvalidArgument(tooManyProtocols, MESSAGE_LENGTH_ERROR); |
194 } | 191 } |
OLD | NEW |