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

Unified Diff: tests/standalone/io/http_parser_test.dart

Issue 11359085: Refactor HTTP parser to hold current buffer (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed more comments Created 8 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sdk/lib/io/http_parser.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/standalone/io/http_parser_test.dart
diff --git a/tests/standalone/io/http_parser_test.dart b/tests/standalone/io/http_parser_test.dart
index 858e5ad2af6f8c659d1a111c71372abcab417619..1145ec7af4fd584c50a26b8ae9ad86bb39cc8243 100644
--- a/tests/standalone/io/http_parser_test.dart
+++ b/tests/standalone/io/http_parser_test.dart
@@ -86,8 +86,8 @@ class HttpParserTest {
int remaining = requestData.length - pos;
int writeLength = min(chunkSize, remaining);
written += writeLength;
- int parsed = httpParser.writeList(requestData, pos, writeLength);
- unparsed = writeLength - parsed;
+ httpParser.writeList(requestData, pos, writeLength);
+ unparsed = httpParser.readUnparsedData().length;
if (httpParser.upgrade) {
unparsed += requestData.length - written;
break;
@@ -133,7 +133,9 @@ class HttpParserTest {
void testWrite(List<int> requestData, [int chunkSize = -1]) {
if (chunkSize == -1) chunkSize = requestData.length;
reset();
- for (int pos = 0; pos < requestData.length; pos += chunkSize) {
+ for (int pos = 0;
+ pos < requestData.length && !errorCalled;
+ pos += chunkSize) {
int remaining = requestData.length - pos;
int writeLength = min(chunkSize, remaining);
httpParser.writeList(requestData, pos, writeLength);
@@ -230,8 +232,8 @@ class HttpParserTest {
int remaining = requestData.length - pos;
int writeLength = min(chunkSize, remaining);
written += writeLength;
- int parsed = httpParser.writeList(requestData, pos, writeLength);
- unparsed = writeLength - parsed;
+ httpParser.writeList(requestData, pos, writeLength);
+ unparsed = httpParser.readUnparsedData().length;
if (httpParser.upgrade) {
unparsed += requestData.length - written;
break;
@@ -280,7 +282,9 @@ class HttpParserTest {
void testWrite(List<int> requestData, [int chunkSize = -1]) {
if (chunkSize == -1) chunkSize = requestData.length;
reset();
- for (int pos = 0; pos < requestData.length; pos += chunkSize) {
+ for (int pos = 0;
+ pos < requestData.length && !errorCalled;
+ pos += chunkSize) {
int remaining = requestData.length - pos;
int writeLength = min(chunkSize, remaining);
httpParser.writeList(requestData, pos, writeLength);
« no previous file with comments | « sdk/lib/io/http_parser.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698