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

Unified Diff: test/loader_http_test.dart

Issue 2671243002: Fix bug in readAsString when charset is LATIN-1 and content-length is set. (Closed)
Patch Set: Created 3 years, 10 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 | « pubspec.yaml ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/loader_http_test.dart
diff --git a/test/loader_http_test.dart b/test/loader_http_test.dart
index 7795f58c8c6d7f2ca70d158198ae1e1565931e3e..155613ed9180001c97c830a79c325d1ab9fa044d 100644
--- a/test/loader_http_test.dart
+++ b/test/loader_http_test.dart
@@ -30,6 +30,9 @@ main() {
var encoding = parseAcceptCharset(encodings);
request.response.headers.contentType =
new ContentType("text", "plain", charset: encoding.name);
+ if (request.uri.query.contains("length")) {
+ request.response.headers.contentLength = content.length;
+ }
request.response..write(content)
..close();
}).catchError(print);
@@ -47,6 +50,14 @@ main() {
expect(string, content);
});
+ test("Latin-1 encoding w/ length", () async {
+ // Regression test for issue #21.
+ var loader = ResourceLoader.defaultLoader;
+ var newUri = uri.replace(query: "length"); // Request length set.
+ String string = await loader.readAsString(newUri, encoding: LATIN1);
+ expect(string, content);
+ });
+
test("UTF-8 encoding", () async {
var loader = ResourceLoader.defaultLoader;
String string = await loader.readAsString(uri, encoding: UTF8);
« no previous file with comments | « pubspec.yaml ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698