| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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:math'; | 5 import 'dart:math'; |
| 6 import 'dart:scalarlist'; | 6 import 'dart:scalarlist'; |
| 7 | 7 |
| 8 part '../../../sdk/lib/io/http.dart'; | 8 part '../../../sdk/lib/io/http.dart'; |
| 9 part '../../../sdk/lib/io/http_headers.dart'; | 9 part '../../../sdk/lib/io/http_headers.dart'; |
| 10 part '../../../sdk/lib/io/http_parser.dart'; | 10 part '../../../sdk/lib/io/http_parser.dart'; |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 httpParser.dataEnd = (close) { | 70 httpParser.dataEnd = (close) { |
| 71 Expect.isFalse(close); | 71 Expect.isFalse(close); |
| 72 dataEndCalled = true; | 72 dataEndCalled = true; |
| 73 }; | 73 }; |
| 74 httpParser.closed = () { }; | 74 httpParser.closed = () { }; |
| 75 | 75 |
| 76 headersCompleteCalled = false; | 76 headersCompleteCalled = false; |
| 77 dataEndCalled = false; | 77 dataEndCalled = false; |
| 78 method = null; | 78 method = null; |
| 79 uri = null; | 79 uri = null; |
| 80 headers = new Map(); | 80 headers = null; |
| 81 bytesReceived = 0; | 81 bytesReceived = 0; |
| 82 } | 82 } |
| 83 | 83 |
| 84 void testWrite(List<int> requestData, [int chunkSize = -1]) { | 84 void testWrite(List<int> requestData, [int chunkSize = -1]) { |
| 85 if (chunkSize == -1) chunkSize = requestData.length; | 85 if (chunkSize == -1) chunkSize = requestData.length; |
| 86 reset(); | 86 reset(); |
| 87 int written = 0; | 87 int written = 0; |
| 88 int unparsed; | 88 int unparsed; |
| 89 for (int pos = 0; pos < requestData.length; pos += chunkSize) { | 89 for (int pos = 0; pos < requestData.length; pos += chunkSize) { |
| 90 int remaining = requestData.length - pos; | 90 int remaining = requestData.length - pos; |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 dataEndCalled = true; | 215 dataEndCalled = true; |
| 216 dataEndClose = close; | 216 dataEndClose = close; |
| 217 }; | 217 }; |
| 218 httpParser.closed = () { }; | 218 httpParser.closed = () { }; |
| 219 | 219 |
| 220 headersCompleteCalled = false; | 220 headersCompleteCalled = false; |
| 221 dataEndCalled = false; | 221 dataEndCalled = false; |
| 222 dataEndClose = null; | 222 dataEndClose = null; |
| 223 statusCode = -1; | 223 statusCode = -1; |
| 224 reasonPhrase = null; | 224 reasonPhrase = null; |
| 225 headers = new Map(); | 225 headers = null; |
| 226 bytesReceived = 0; | 226 bytesReceived = 0; |
| 227 } | 227 } |
| 228 | 228 |
| 229 void testWrite(List<int> requestData, [int chunkSize = -1]) { | 229 void testWrite(List<int> requestData, [int chunkSize = -1]) { |
| 230 if (chunkSize == -1) chunkSize = requestData.length; | 230 if (chunkSize == -1) chunkSize = requestData.length; |
| 231 reset(); | 231 reset(); |
| 232 int written = 0; | 232 int written = 0; |
| 233 int unparsed; | 233 int unparsed; |
| 234 for (int pos = 0; pos < requestData.length; pos += chunkSize) { | 234 for (int pos = 0; pos < requestData.length; pos += chunkSize) { |
| 235 int remaining = requestData.length - pos; | 235 int remaining = requestData.length - pos; |
| (...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 853 0123456789012345678901234567890\r | 853 0123456789012345678901234567890\r |
| 854 0\r\n\r\n"""; | 854 0\r\n\r\n"""; |
| 855 _testParseInvalidResponse(response); | 855 _testParseInvalidResponse(response); |
| 856 } | 856 } |
| 857 } | 857 } |
| 858 | 858 |
| 859 | 859 |
| 860 void main() { | 860 void main() { |
| 861 HttpParserTest.runAllTests(); | 861 HttpParserTest.runAllTests(); |
| 862 } | 862 } |
| OLD | NEW |