diff options
Diffstat (limited to 'LayoutTests/http/tests')
5 files changed, 75 insertions, 1 deletions
diff --git a/LayoutTests/http/tests/appcache/foreign-iframe-main-expected.txt b/LayoutTests/http/tests/appcache/foreign-iframe-main-expected.txt index 64d4de2..1661ad3 100644 --- a/LayoutTests/http/tests/appcache/foreign-iframe-main-expected.txt +++ b/LayoutTests/http/tests/appcache/foreign-iframe-main-expected.txt @@ -5,6 +5,7 @@ downloading progress progress progress +progress cached SUCCESS diff --git a/LayoutTests/http/tests/appcache/progress-counter-expected.txt b/LayoutTests/http/tests/appcache/progress-counter-expected.txt new file mode 100644 index 0000000..c9e3db2 --- /dev/null +++ b/LayoutTests/http/tests/appcache/progress-counter-expected.txt @@ -0,0 +1,2 @@ +This tests that the lengthComputable / loaded / total properties of the progress event are set correctly. +SUCCESS diff --git a/LayoutTests/http/tests/appcache/progress-counter.html b/LayoutTests/http/tests/appcache/progress-counter.html new file mode 100644 index 0000000..0f9d0b6 --- /dev/null +++ b/LayoutTests/http/tests/appcache/progress-counter.html @@ -0,0 +1,62 @@ +<html manifest="resources/progress-counter.manifest"> +<script> +if (window.layoutTestController) { + layoutTestController.dumpAsText() + layoutTestController.waitUntilDone(); +} + +var expectedTotal = 2 +var eventsReceived = 0; + +function done() { + if (window.layoutTestController) + layoutTestController.notifyDone(); +} + +function progress(event) +{ + if (!event.lengthComputable) { + document.getElementById('result').innerHTML = "FAILURE: expected progressEvent.lengthComputable to be true"; + done(); + return; + } + if (event.total != expectedTotal) { + document.getElementById('result').innerHTML = "FAILURE: expected progressEvent.total to be " + expectedTotal + " but was " + event.total; + done(); + return; + } + if (event.loaded != eventsReceived) { + document.getElementById('result').innerHTML = "FAILURE: expected progressEvent.loaded to be " + eventsReceived + " but was " + event.loaded; + done(); + return; + } + eventsReceived++; +} + +function cached() +{ + if (eventsReceived != 3) { + document.getElementById('result').innerHTML = "FAILURE: expected 3 progress events, but got " + eventsReceived; + done(); + return; + } + + document.getElementById('result').innerHTML = "SUCCESS"; + done(); +} + +function noupdate() +{ + document.getElementById('result').innerHTML = "FAILURE: unable to conduct test since the appcache already exists, please remove the appcache and try again"; + done(); +} + +applicationCache.addEventListener('cached', cached, false); +applicationCache.addEventListener('noupdate', noupdate, false); +applicationCache.addEventListener('progress', progress, false); + +</script> +<div>This tests that the lengthComputable / loaded / total properties of the progress event are set correctly.</div> + +<div id="result">FAILURE</div> +</html> diff --git a/LayoutTests/http/tests/appcache/resources/different-https-origin-resource.html b/LayoutTests/http/tests/appcache/resources/different-https-origin-resource.html index 674706a..7c24b07 100644 --- a/LayoutTests/http/tests/appcache/resources/different-https-origin-resource.html +++ b/LayoutTests/http/tests/appcache/resources/different-https-origin-resource.html @@ -20,8 +20,14 @@ function error() hadError = true; finish(); } +function progressHandler(e) +{ + // The only resource listed in the manifest file is in a different https origin and should be skipped. + if (e.loaded != 0 || e.total != 0) + fail(); +} -applicationCache.onprogress = function() { fail(); } +applicationCache.onprogress = progressHandler; applicationCache.onnoupdate = function() { finish(); } applicationCache.oncached = function() { finish(); } applicationCache.onerror = function() { error(); } diff --git a/LayoutTests/http/tests/appcache/resources/progress-counter.manifest b/LayoutTests/http/tests/appcache/resources/progress-counter.manifest new file mode 100644 index 0000000..7877cd8 --- /dev/null +++ b/LayoutTests/http/tests/appcache/resources/progress-counter.manifest @@ -0,0 +1,3 @@ +CACHE MANIFEST +simple.txt +empty.txt |