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

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

Issue 15256002: Rewrite parts of http-parser, to better handle connection errors and pausing. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Cleanup. Created 7 years, 7 months 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 0030a7dff3d7bc81c73c5de2c10772291566c9d2..c0d4e1e17c32403b53b5aefa641e04e8de9f6be8 100644
--- a/tests/standalone/io/http_parser_test.dart
+++ b/tests/standalone/io/http_parser_test.dart
@@ -76,6 +76,15 @@ class HttpParserTest {
onDone: () {
Expect.isFalse(upgraded);
port2.close();
+ Expect.equals(expectedMethod, method);
+ Expect.stringEquals(expectedUri, uri.toString());
+ Expect.equals(expectedVersion, headers.protocolVersion);
+ if (upgrade) {
+ Expect.equals(0, bytesReceived);
+ // port1 is closed by the listener on the detached data.
+ } else {
+ Expect.equals(expectedBytesReceived, bytesReceived);
+ }
});
if (upgraded) {
@@ -93,15 +102,6 @@ class HttpParserTest {
incoming.dataDone.then((_) {
port1.close();
Expect.isFalse(upgraded);
- Expect.equals(expectedMethod, method);
- Expect.stringEquals(expectedUri, uri.toString());
- Expect.equals(expectedVersion, headers.protocolVersion);
- if (upgrade) {
- Expect.equals(0, bytesReceived);
- // port1 is closed by the listener on the detached data.
- } else {
- Expect.equals(expectedBytesReceived, bytesReceived);
- }
});
});
@@ -187,19 +187,19 @@ class HttpParserTest {
bool upgrade: false,
int unparsedLength: 0,
String expectedVersion: "1.1"}) {
- _HttpParser httpParser;
- bool headersCompleteCalled;
- bool dataEndCalled;
- bool dataEndClose;
- int statusCode;
- String reasonPhrase;
- HttpHeaders headers;
- int contentLength;
- int bytesReceived;
StreamController controller;
bool upgraded;
void reset() {
+ _HttpParser httpParser;
+ bool headersCompleteCalled;
+ bool dataEndCalled;
+ bool dataEndClose;
+ int statusCode;
+ String reasonPhrase;
+ HttpHeaders headers;
+ int contentLength;
+ int bytesReceived;
httpParser = new _HttpParser.responseParser();
controller = new StreamController();
var port = new ReceivePort();
@@ -338,7 +338,6 @@ class HttpParserTest {
_testParseRequest(request, method, "/index.html");
});
-
request = "GET / HTTP/1.0\r\n\r\n";
_testParseRequest(request, "GET", "/",
expectedVersion: "1.0",
@@ -403,6 +402,7 @@ X-Header-B: b\r
\t b\r
\r
""";
+
headers = new Map();
headers["header-a"] = "AAA";
headers["x-header-b"] = "bbb";
« 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