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

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/upload-progress-events.html

Issue 1681923002: Remove XMLHttpRequestProgressEvent (position and totalSize) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update tests 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 unified diff | Download patch
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <script src="/js-test-resources/testharness.js"></script> 2 <script src="/js-test-resources/testharness.js"></script>
3 <script src="/js-test-resources/testharnessreport.js"></script> 3 <script src="/js-test-resources/testharnessreport.js"></script>
4 <p></p> 4 <p></p>
5 <script type="text/javascript"> 5 <script type="text/javascript">
6 var log = ""; 6 var log = "";
7 7
8 function recordEvent(eventName, evt) 8 function recordEvent(eventName, evt)
9 { 9 {
10 log += eventName + ": " + evt + "\n"; 10 log += eventName + ": " + evt + "\n";
11 } 11 }
12 12
13 var test = async_test("progress events are fired for XMLHttpRequestUpload object s in the correct order, loadstart, progress, load, and then loadend."); 13 var test = async_test("progress events are fired for XMLHttpRequestUpload object s in the correct order, loadstart, progress, load, and then loadend.");
14 test.step(function() { 14 test.step(function() {
15 var xhr = new XMLHttpRequest; 15 var xhr = new XMLHttpRequest;
16 16
17 xhr.upload.onprogress = function(evt) 17 xhr.upload.onprogress = function(evt)
18 { 18 {
19 log += "progress: " + evt + " (loaded=" + evt.loaded + ", total=" + evt. total + ")\n"; 19 log += "progress: " + evt + " (loaded=" + evt.loaded + ", total=" + evt. total + ")\n";
20 }; 20 };
21 xhr.upload.onloadstart = recordEvent.bind(undefined, "loadstart"); 21 xhr.upload.onloadstart = recordEvent.bind(undefined, "loadstart");
22 xhr.upload.onload = recordEvent.bind(undefined, "load"); 22 xhr.upload.onload = recordEvent.bind(undefined, "load");
23 xhr.upload.onloadend = recordEvent.bind(undefined, "loadend"); 23 xhr.upload.onloadend = recordEvent.bind(undefined, "loadend");
24 xhr.onreadystatechange = function(evt) 24 xhr.onreadystatechange = function(evt)
25 { 25 {
26 if (xhr.readyState == xhr.DONE) { 26 if (xhr.readyState == xhr.DONE) {
27 var expectedLog = 27 var expectedLog =
28 "loadstart: [object XMLHttpRequestProgressEvent]\n" + 28 "loadstart: [object ProgressEvent]\n" +
29 "progress: [object XMLHttpRequestProgressEvent] (loaded=4, total =4)\n" + 29 "progress: [object ProgressEvent] (loaded=4, total=4)\n" +
30 "load: [object XMLHttpRequestProgressEvent]\n" + 30 "load: [object ProgressEvent]\n" +
31 "loadend: [object XMLHttpRequestProgressEvent]\n" 31 "loadend: [object ProgressEvent]\n"
32 assert_equals(log, expectedLog); 32 assert_equals(log, expectedLog);
33 test.done(); 33 test.done();
34 } 34 }
35 }; 35 };
36 36
37 xhr.open("POST", "resources/post-echo.cgi", true); 37 xhr.open("POST", "resources/post-echo.cgi", true);
38 xhr.send("data"); 38 xhr.send("data");
39 }); 39 });
40 </script> 40 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698