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

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: Reflect comments. Created 5 years 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 b02f9b307a91d2950d3e2507f9d5570527ead290..bf42d0cddae6b1e4c2748890a49cec8bf17d8361 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
@@ -164,6 +164,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');
+
test(t => {
var req = new Request('/');
assert_false(req.bodyUsed);

Powered by Google App Engine
This is Rietveld 408576698