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

Unified Diff: LayoutTests/http/tests/xmlhttprequest/response-blob-size.html

Issue 183333005: [XHR] Reset m_downloadedBlobLength (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 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
« no previous file with comments | « no previous file | LayoutTests/http/tests/xmlhttprequest/response-blob-size-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/http/tests/xmlhttprequest/response-blob-size.html
diff --git a/LayoutTests/http/tests/xmlhttprequest/response-blob-size.html b/LayoutTests/http/tests/xmlhttprequest/response-blob-size.html
index 8e3d1dc3b7a45bb5e3c10cb85e624bb4f2160307..6bc9c4d54673dee2b585dbb0f8042e58e93a6ce9 100644
--- a/LayoutTests/http/tests/xmlhttprequest/response-blob-size.html
+++ b/LayoutTests/http/tests/xmlhttprequest/response-blob-size.html
@@ -1,36 +1,30 @@
<html>
<body>
-<p>Test Blob.size of response blob received for XMLHttpRequest</p>
-<pre id="console"></pre>
+<script src="../resources/testharness.js"></script>
+<script src="../resources/testharnessreport.js"></script>
<script>
-if (window.testRunner) {
- testRunner.dumpAsText();
- testRunner.waitUntilDone();
-}
-
-function log(text)
-{
- var console = document.getElementById('console');
- console.appendChild(document.createTextNode(text + '\n'));
-}
-
-function test(expect, actual)
-{
- log((expect == actual ? 'PASS' : 'FAIL') + ': "' + expect + '" == "' + actual + '"');
-}
-
-var req = new XMLHttpRequest;
-req.responseType = 'blob';
-req.open('GET', '../resources/test.ogv', true);
-req.onreadystatechange = function() {
- if (req.readyState == 4) {
- test(200, req.status);
- test(103746, req.response.size)
- if (window.testRunner)
- testRunner.notifyDone();
- }
-};
-req.send(null);
-
+var t = async_test("Test Blob.size of response blob received for XMLHttpRequest");
+t.step(function() {
+ var req = new XMLHttpRequest;
+ var i = 0;
+ // Run the test multiple times using the same XMLHttpRequest instance to
+ // check if all states are cleared correctly.
+ var doRequest = function() {
+ req.open('GET', '../resources/test.ogv', true);
+ req.responseType = 'blob';
+ req.onreadystatechange = t.step_func(function() {
+ if (req.readyState == req.DONE) {
+ assert_equals(200, req.status, "Status");
+ assert_equals(103746, req.response.size, "Size");
+ if (++i < 3)
+ doRequest();
+ else
+ t.done();
+ }
+ });
+ req.send(null);
+ };
+ doRequest();
+});
</script>
</body>
« no previous file with comments | « no previous file | LayoutTests/http/tests/xmlhttprequest/response-blob-size-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698