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

Unified Diff: LayoutTests/http/tests/xmlhttprequest/upload-request-error-event-order.html

Issue 20560007: On request error, always fire events on the XMLHttpRequestUpload before the XMLHttpRequest (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 5 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: LayoutTests/http/tests/xmlhttprequest/upload-request-error-event-order.html
diff --git a/LayoutTests/http/tests/xmlhttprequest/upload-request-error-event-order.html b/LayoutTests/http/tests/xmlhttprequest/upload-request-error-event-order.html
new file mode 100644
index 0000000000000000000000000000000000000000..3e11b5a9bf1da31b640f0f53239320bf16a64944
--- /dev/null
+++ b/LayoutTests/http/tests/xmlhttprequest/upload-request-error-event-order.html
@@ -0,0 +1,44 @@
+<!DOCTYPE html>
+<html>
+<head>
+<link rel="help" href="http://www.w3.org/TR/2012/WD-XMLHttpRequest-20121206/#request-error"/>
+<script src="../resources/js-test-pre.js"></script>
+</head>
+<body>
+<script>
+description("Test to validate the order in which the events are fired in case of a request error.");
+window.jsTestIsAsync = true;
+
+expectedOrder = "rsdone,upload.onerror,upload.onloadend,onerror,onloadend,";
+actualOrder = "";
+
+var xhr = new XMLHttpRequest();
+xhr.open("POST", "http://localhost:8000/xmlhttprequest/resources/cross-site-progress-events.cgi", true);
+xhr.setRequestHeader("Content-Type", "text/plain");
+
+xhr.onreadystatechange = function () {
+ if (xhr.readyState == XMLHttpRequest.DONE) {
+ actualOrder += "rsdone,";
+ }
+};
+xhr.upload.onerror = function (evt) {
+ actualOrder += "upload.onerror,";
+};
+xhr.upload.onloadend = function () {
+ actualOrder += "upload.onloadend,";
+};
+xhr.onerror = function (evt) {
+ actualOrder += "onerror,";
+};
+xhr.onloadend = function () {
+ actualOrder += "onloadend,";
+ shouldBeEqualToString('actualOrder', '' + expectedOrder);
+ finishJSTest();
+};
+
+xhr.send("test");
+
+</script>
+<script src="../resources/js-test-post.js"></script>
+</body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698