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

Unified Diff: third_party/WebKit/LayoutTests/http/tests/fetch/script-tests/body-mixin.js

Issue 1470893002: [Fetch] Always use utf-8 for decoding in text() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add fixes. Created 5 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
Index: third_party/WebKit/LayoutTests/http/tests/fetch/script-tests/body-mixin.js
diff --git a/third_party/WebKit/LayoutTests/http/tests/fetch/script-tests/body-mixin.js b/third_party/WebKit/LayoutTests/http/tests/fetch/script-tests/body-mixin.js
index ea9e07b8ccbcab8f3c15289ca0fb92c836ac2656..894a9fd7d18d4b5092ce733dbfdeaef093fcd166 100644
--- a/third_party/WebKit/LayoutTests/http/tests/fetch/script-tests/body-mixin.js
+++ b/third_party/WebKit/LayoutTests/http/tests/fetch/script-tests/body-mixin.js
@@ -127,6 +127,36 @@ promise_test(function(test) {
}, 'NonAsciiTextTest');
promise_test(function(test) {
+ return fetch('/fetch/resources/bom-utf-8.php')
+ .then(function(response) { return response.text(); })
+ .then(function(text) {
+ assert_equals(text, '\u4e09\u6751\u304b\u306a\u5b50',
+ 'utf-8 string with BOM is decoded as utf-8 and ' +
+ 'BOM is not included in the decoded result.');
+ })
+ }, 'BOMUTF8Test');
+
+promise_test(function(test) {
+ return fetch('/fetch/resources/bom-utf-16le.php')
+ .then(function(response) { return response.text(); })
+ .then(function(text) {
+ assert_equals(text, '\ufffd\ufffd\tNQgK0j0P[',
+ 'utf-16le string is decoded as if utf-8 ' +
+ 'even if the data has utf-16le BOM.');
+ })
+ }, 'BOMUTF16LETest');
+
+promise_test(function(test) {
+ return fetch('/fetch/resources/bom-utf-16be.php')
+ .then(function(response) { return response.text(); })
+ .then(function(text) {
+ assert_equals(text, '\ufffd\ufffdN\tgQ0K0j[P',
+ 'utf-16be string is decoded as if utf-8 ' +
+ 'even if the data has utf-16be BOM.');
+ })
+ }, 'BOMUTF16BETest');
+
+promise_test(function(test) {
var expected = '';
for (var i = 0; i < 100; ++i)
expected += i;

Powered by Google App Engine
This is Rietveld 408576698