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

Unified Diff: third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/access-control-preflight-data-saver.html

Issue 1698973002: Exempt Save-Data header from CORS preflight request check (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added layout test Created 4 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
Index: third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/access-control-preflight-data-saver.html
diff --git a/third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/access-control-preflight-request-invalid-status-400.html b/third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/access-control-preflight-data-saver.html
similarity index 79%
copy from third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/access-control-preflight-request-invalid-status-400.html
copy to third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/access-control-preflight-data-saver.html
index d59d53586e306e8e675d9ea6ae10e4847bfd311e..e8cbda9267d629f83c32ecc94dc762004528b05b 100644
--- a/third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/access-control-preflight-request-invalid-status-400.html
+++ b/third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/access-control-preflight-data-saver.html
@@ -1,8 +1,10 @@
<html>
<body>
-<p>Test that preflight requests with invalid status code results in error. Should print PASS.</p>
+<p>Test that 'Save-Data' header is treated as a simple header and preflight request is not created. Should print PASS.</p>
<div id="log"></div>
<script>
+window.internals.settings.setDataSaverEnabled(true);
+
function log(message) {
document.getElementById("log").innerHTML += message + "<br>";
}
@@ -14,17 +16,17 @@ if (window.layoutTestController) {
var xhr = new XMLHttpRequest();
xhr.open("GET", "http://localhost:8000/xmlhttprequest/resources/access-control-preflight-request-invalid-status.php?code=400");
-xhr.setRequestHeader("X-Custom-Header", "PASS");
xhr.onerror = function () {
- log("PASS");
+ log("FAIL");
if (window.layoutTestController)
layoutTestController.notifyDone();
};
xhr.onload = function () {
- log("FAIL");
+ log("PASS");
if (window.layoutTestController)
layoutTestController.notifyDone();
};
xhr.send();
</script>
+</body>
</html>

Powered by Google App Engine
This is Rietveld 408576698