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

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/response-legacystream.html

Issue 2467233002: Remove "legacy" experimental stream support (Closed)
Patch Set: fix Created 4 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 unified diff | Download patch
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <html>
3 <body>
4 <script src="../resources/testharness.js"></script>
5 <script src="../resources/testharnessreport.js"></script>
6 <script type="text/javascript">
7 var test = async_test("Test response of XMLHttpRequest with responseType set to 'legacystream' for various readyState.");
8
9 test.step(function()
10 {
11 var xhr = new XMLHttpRequest;
12
13 xhr.responseType = "legacystream";
14 assert_equals(xhr.responseType, "legacystream", "xhr.responseType");
15
16 assert_equals(xhr.readyState, xhr.UNSENT, "xhr.readyState");
17 assert_equals(xhr.response, null, "xhr.response during UNSENT");
18
19 var seenStates = [];
20
21 xhr.onreadystatechange = test.step_func(function() {
22 // onreadystatechange can be invoked multiple times in LOADING state.
23 if (seenStates.length == 0 || xhr.readyState != seenStates[seenStates.le ngth - 1])
24 seenStates.push(xhr.readyState);
25
26 switch (xhr.readyState) {
27 case xhr.UNSENT:
28 assert_unreached('Unexpected readyState: UNSENT');
29 return;
30
31 case xhr.OPENED:
32 assert_equals(xhr.response, null, "xhr.response during OPENED");
33 return;
34
35 case xhr.HEADERS_RECEIVED:
36 assert_equals(xhr.response, null, "xhr.response during HEADERS_RECEI VED");
37 return;
38
39 case xhr.LOADING:
40 assert_not_equals(xhr.response, null, "xhr.response during LOADING") ;
41 return;
42
43 case xhr.DONE:
44 assert_equals(xhr.status, 200, "xhr.status");
45
46 // Check that we saw all states.
47 assert_array_equals(seenStates,
48 [xhr.OPENED, xhr.HEADERS_RECEIVED, xhr.LOADING, xhr.DONE]);
49
50 test.done();
51 return;
52
53 default:
54 assert_unreached('Unexpected readyState: ' + xhr.readyState)
55 return;
56 }
57 });
58
59 xhr.open('GET', '../resources/test.ogv', true);
60 xhr.send();
61 });
62 </script>
63 </body>
64 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698