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 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 |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 Expect.isTrue(e is ArgumentError); | 106 Expect.isTrue(e is ArgumentError); |
107 Expect.isTrue(e.toString().contains(errorIncludes)); | 107 Expect.isTrue(e.toString().contains(errorIncludes)); |
108 server.close(); | 108 server.close(); |
109 asyncEnd(); | 109 asyncEnd(); |
110 }); | 110 }); |
111 asyncEnd(); | 111 asyncEnd(); |
112 }); | 112 }); |
113 } | 113 } |
114 | 114 |
115 main() { | 115 main() { |
| 116 if (!SecurityContext.alpnSupported) { |
| 117 return 0; |
| 118 } |
116 final longname256 = 'p' * 256; | 119 final longname256 = 'p' * 256; |
117 final String longname255 = 'p' * 255; | 120 final String longname255 = 'p' * 255; |
118 final String strangelongname255 = 'ø' + 'p' * 253; | 121 final String strangelongname255 = 'ø' + 'p' * 253; |
119 final String strangelongname256 = 'ø' + 'p' * 254; | 122 final String strangelongname256 = 'ø' + 'p' * 254; |
120 | 123 |
121 // This produces a message of (1 << 13) - 2 bytes. 2^12 -1 strings are each | 124 // This produces a message of (1 << 13) - 2 bytes. 2^12 -1 strings are each |
122 // encoded by 1 length byte and 1 ascii byte. | 125 // encoded by 1 length byte and 1 ascii byte. |
123 final List<String> manyProtocols = new Iterable.generate( | 126 final List<String> manyProtocols = new Iterable.generate( |
124 (1 << 12) - 1, (i) => '0').toList(); | 127 (1 << 12) - 1, (i) => '0').toList(); |
125 | 128 |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 // Issue https://github.com/dart-lang/sdk/issues/23580 | 198 // Issue https://github.com/dart-lang/sdk/issues/23580 |
196 // Chromium issue https://code.google.com/p/chromium/issues/detail?id=497770 | 199 // Chromium issue https://code.google.com/p/chromium/issues/detail?id=497770 |
197 testSuccessfulAlpnNegotiationConnection(['a'], ['b'], null); | 200 testSuccessfulAlpnNegotiationConnection(['a'], ['b'], null); |
198 | 201 |
199 // Test too short / too long protocol names. | 202 // Test too short / too long protocol names. |
200 testInvalidArgument([longname256], NAME_LENGTH_ERROR); | 203 testInvalidArgument([longname256], NAME_LENGTH_ERROR); |
201 testInvalidArgument([strangelongname256], NAME_LENGTH_ERROR); | 204 testInvalidArgument([strangelongname256], NAME_LENGTH_ERROR); |
202 testInvalidArgument([''], NAME_LENGTH_ERROR); | 205 testInvalidArgument([''], NAME_LENGTH_ERROR); |
203 testInvalidArgument(tooManyProtocols, MESSAGE_LENGTH_ERROR); | 206 testInvalidArgument(tooManyProtocols, MESSAGE_LENGTH_ERROR); |
204 } | 207 } |
OLD | NEW |