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

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

Issue 11410003: Refactoring of the HTTP library (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed review 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 | « tests/standalone/io/http_connection_close_test.dart ('k') | tests/standalone/standalone.status » ('j') | 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 1145ec7af4fd584c50a26b8ae9ad86bb39cc8243..cf747bbfcd21aaeba3c07f339bad31b948afc452 100644
--- a/tests/standalone/io/http_parser_test.dart
+++ b/tests/standalone/io/http_parser_test.dart
@@ -37,7 +37,7 @@ class HttpParserTest {
int bytesReceived;
void reset() {
- httpParser = new _HttpParser();
+ httpParser = new _HttpParser.requestParser();
httpParser.requestStart = (m, u, v) { method = m; uri = u; version = v; };
httpParser.responseStart = (s, r, v) { Expect.fail("Expected request"); };
httpParser.headerReceived = (f, v) {
@@ -68,6 +68,7 @@ class HttpParserTest {
Expect.isFalse(close);
dataEndCalled = true;
};
+ httpParser.closed = () { };
headersCompleteCalled = false;
dataEndCalled = false;
@@ -86,7 +87,7 @@ class HttpParserTest {
int remaining = requestData.length - pos;
int writeLength = min(chunkSize, remaining);
written += writeLength;
- httpParser.writeList(requestData, pos, writeLength);
+ httpParser.streamData(requestData.getRange(pos, writeLength));
unparsed = httpParser.readUnparsedData().length;
if (httpParser.upgrade) {
unparsed += requestData.length - written;
@@ -121,11 +122,12 @@ class HttpParserTest {
bool errorCalled;
void reset() {
- httpParser = new _HttpParser();
+ httpParser = new _HttpParser.requestParser();
httpParser.responseStart = (s, r) { Expect.fail("Expected request"); };
httpParser.error = (e) {
errorCalled = true;
};
+ httpParser.closed = () { };
errorCalled = false;
}
@@ -138,7 +140,7 @@ class HttpParserTest {
pos += chunkSize) {
int remaining = requestData.length - pos;
int writeLength = min(chunkSize, remaining);
- httpParser.writeList(requestData, pos, writeLength);
+ httpParser.streamData(requestData.getRange(pos, writeLength));
}
Expect.isTrue(errorCalled);
}
@@ -176,7 +178,7 @@ class HttpParserTest {
int bytesReceived;
void reset() {
- httpParser = new _HttpParser();
+ httpParser = new _HttpParser.responseParser();
if (responseToMethod != null) {
httpParser.responseToMethod = responseToMethod;
}
@@ -213,6 +215,7 @@ class HttpParserTest {
dataEndCalled = true;
dataEndClose = close;
};
+ httpParser.closed = () { };
headersCompleteCalled = false;
dataEndCalled = false;
@@ -232,7 +235,7 @@ class HttpParserTest {
int remaining = requestData.length - pos;
int writeLength = min(chunkSize, remaining);
written += writeLength;
- httpParser.writeList(requestData, pos, writeLength);
+ httpParser.streamData(requestData.getRange(pos, writeLength));
unparsed = httpParser.readUnparsedData().length;
if (httpParser.upgrade) {
unparsed += requestData.length - written;
@@ -241,7 +244,7 @@ class HttpParserTest {
Expect.equals(0, unparsed);
}
}
- if (close) httpParser.connectionClosed();
+ if (close) httpParser.streamDone();
Expect.equals(expectedVersion, version);
Expect.equals(expectedStatusCode, statusCode);
Expect.equals(expectedReasonPhrase, reasonPhrase);
@@ -272,9 +275,10 @@ class HttpParserTest {
bool errorCalled;
void reset() {
- httpParser = new _HttpParser();
+ httpParser = new _HttpParser.responseParser();
httpParser.requestStart = (m, u) => Expect.fail("Expected response");
httpParser.error = (e) => errorCalled = true;
+ httpParser.closed = () { };
errorCalled = false;
}
@@ -287,9 +291,9 @@ class HttpParserTest {
pos += chunkSize) {
int remaining = requestData.length - pos;
int writeLength = min(chunkSize, remaining);
- httpParser.writeList(requestData, pos, writeLength);
+ httpParser.streamData(requestData.getRange(pos, writeLength));
}
- if (close) httpParser.connectionClosed();
+ if (close) httpParser.streamDone();
Expect.isTrue(errorCalled);
}
« no previous file with comments | « tests/standalone/io/http_connection_close_test.dart ('k') | tests/standalone/standalone.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698