Index: content/test/data/loader/async_resource_handler.html |
diff --git a/content/test/data/loader/async_resource_handler.html b/content/test/data/loader/async_resource_handler.html |
index 0af609dc0272c89a196d837b95178cc8449645e9..5d34ea7f4793761a9ff32f384d27087ed74b0778 100644 |
--- a/content/test/data/loader/async_resource_handler.html |
+++ b/content/test/data/loader/async_resource_handler.html |
@@ -8,11 +8,14 @@ var asyncXHR; |
var lastSeenProgress = 0; |
// Build a long string, fast. |
// data.length = 2 * 3^15 = 28697814 |
- |
+var sent_data; |
+var smaller_data; |
var data = 'yo'; |
var iterations = 15; |
for (var i = 0; i < iterations; i++) { |
data = data + data + data; |
+ if (i === 13) |
+ smaller_data = data; |
} |
function sendResults(failures) { |
@@ -30,7 +33,7 @@ function progressListener(e) { |
failureList.push('Progress event occurred after load event.'); |
if (progress <= lastSeenProgress) |
failureList.push('No forward upload progress between events.'); |
- if (e.total != data.length) |
+ if (e.total != sent_data.length) |
failureList.push('Upload total does not match payload size.'); |
if (progress > e.total) |
failureList.push('Upload progress exceeds payload size.'); |
@@ -50,7 +53,7 @@ function onFinished(e) { |
var failureList = []; |
if (!ranProgressHandler) |
failureList.push('Finished upload without firing a progress event.'); |
- if (lastSeenProgress != data.length) |
+ if (lastSeenProgress != sent_data.length) |
failureList.push('Final progress event before data transfer completed.'); |
if (this.responseText != 'hello') { |
failureList.push( |
@@ -63,7 +66,7 @@ function onError(e) { |
sendResults(['Received an XHR error event.']); |
} |
-function WaitForAsyncXHR(url) { |
+function WaitForAsyncXHR(url, data_size) { |
asyncXHR = new XMLHttpRequest(); |
asyncXHR.addEventListener('load', onFinished); |
asyncXHR.addEventListener('error', onError); |
@@ -74,7 +77,11 @@ function WaitForAsyncXHR(url) { |
asyncXHR.open('POST', url, true); |
asyncXHR.setRequestHeader('Content-Type', 'text/plain'); |
- asyncXHR.send(data); |
+ if (data_size === "small") |
+ sent_data = smaller_data; |
+ else if (data_size === "large") |
+ sent_data = data; |
+ asyncXHR.send(sent_data); |
} |
</script> |
</head> |