| Index: LayoutTests/http/tests/xmlhttprequest/response-stream.html
|
| diff --git a/LayoutTests/http/tests/xmlhttprequest/response-json-and-readystate.html b/LayoutTests/http/tests/xmlhttprequest/response-stream.html
|
| similarity index 62%
|
| copy from LayoutTests/http/tests/xmlhttprequest/response-json-and-readystate.html
|
| copy to LayoutTests/http/tests/xmlhttprequest/response-stream.html
|
| index 2f97e3c3cc88c374bac0a7c8e29b79d783537c9e..cd445d978eff67faff671eab986e6486d30645be 100644
|
| --- a/LayoutTests/http/tests/xmlhttprequest/response-json-and-readystate.html
|
| +++ b/LayoutTests/http/tests/xmlhttprequest/response-stream.html
|
| @@ -4,22 +4,24 @@
|
| <script src="../resources/testharness.js"></script>
|
| <script src="../resources/testharnessreport.js"></script>
|
| <script type="text/javascript">
|
| -var test = async_test("Test response of XMLHttpRequest with responseType set to 'json' for various readyState.");
|
| +var test = async_test("Test response of XMLHttpRequest with responseType set to 'stream' for various readyState.");
|
|
|
| test.step(function()
|
| {
|
| var xhr = new XMLHttpRequest;
|
|
|
| - xhr.responseType = "json";
|
| - assert_equals(xhr.responseType, "json", "xhr.responseType");
|
| + xhr.responseType = "stream";
|
| + assert_equals(xhr.responseType, "stream", "xhr.responseType");
|
|
|
| assert_equals(xhr.readyState, xhr.UNSENT, "xhr.readyState");
|
| - assert_equals(xhr.response, null, "xhr.response");
|
| + assert_equals(xhr.response, null, "xhr.response during UNSENT");
|
|
|
| var seenStates = [];
|
|
|
| xhr.onreadystatechange = test.step_func(function() {
|
| - seenStates.push(xhr.readyState);
|
| + // onreadystatechange can be invoked multiple times in LOADING state.
|
| + if (seenStates.length == 0 || xhr.readyState != seenStates[seenStates.length - 1])
|
| + seenStates.push(xhr.readyState);
|
|
|
| switch (xhr.readyState) {
|
| case xhr.UNSENT:
|
| @@ -27,22 +29,19 @@ test.step(function()
|
| return;
|
|
|
| case xhr.OPENED:
|
| - assert_equals(xhr.response, null, "xhr.response");
|
| + assert_equals(xhr.response, null, "xhr.response during OPENED");
|
| return;
|
|
|
| case xhr.HEADERS_RECEIVED:
|
| - assert_equals(xhr.response, null, "xhr.response");
|
| + assert_equals(xhr.response, null, "xhr.response during HEADERS_RECEIVED");
|
| return;
|
|
|
| case xhr.LOADING:
|
| - assert_equals(xhr.response, null, "xhr.response");
|
| + assert_not_equals(xhr.response, null, "xhr.response during LOADING");
|
| return;
|
|
|
| case xhr.DONE:
|
| assert_equals(xhr.status, 200, "xhr.status");
|
| - assert_equals(JSON.stringify(xhr.response),
|
| - '["a","b",2,{"3":3}]',
|
| - "Stringify result of xhr.response");
|
|
|
| // Check that we saw all states.
|
| assert_array_equals(seenStates,
|
| @@ -57,7 +56,7 @@ test.step(function()
|
| }
|
| });
|
|
|
| - xhr.open('GET', 'resources/test.json', true);
|
| + xhr.open('GET', '../resources/test.ogv', true);
|
| xhr.send();
|
| });
|
| </script>
|
|
|