Add partial load tests for PNG images
authornoel.gordon@gmail.com <noel.gordon@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 19 Sep 2012 03:08:37 +0000 (03:08 +0000)
committernoel.gordon@gmail.com <noel.gordon@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 19 Sep 2012 03:08:37 +0000 (03:08 +0000)
https://bugs.webkit.org/show_bug.cgi?id=95707

Reviewed by Adam Barth.

Partial load test: receive a partial number of image bytes and stall forever. The
partial image should be decoded and drawn and the blue <img> background should be
visible.

Progressive load test: receive a partial number of image bytes, stall for 1 second
and then continue to receive all the image bytes. The entire test image should be
decoded and drawn and the blue <img> background should be visible.

* fast/images/resources/dice.png: Added: test image has alpha transparency.
* http/tests/images/png-partial-load-expected.png: Added.
* http/tests/images/png-partial-load-expected.txt: Added.
* http/tests/images/png-partial-load.html: Added.
* http/tests/images/png-progressive-load-expected.png: Added.
* http/tests/images/png-progressive-load-expected.txt: Added.
* http/tests/images/png-progressive-load.html: Added.
* platform/chromium/http/tests/images/png-partial-load-expected.png: Added.
* platform/mac/http/tests/images/png-partial-load-expected.png: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@128961 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/fast/images/resources/dice.png [new file with mode: 0644]
LayoutTests/http/tests/images/png-partial-load-expected.png [new file with mode: 0644]
LayoutTests/http/tests/images/png-partial-load-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/images/png-partial-load.html [new file with mode: 0644]
LayoutTests/http/tests/images/png-progressive-load-expected.png [new file with mode: 0644]
LayoutTests/http/tests/images/png-progressive-load-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/images/png-progressive-load.html [new file with mode: 0644]
LayoutTests/platform/chromium/http/tests/images/png-partial-load-expected.png [new file with mode: 0644]
LayoutTests/platform/mac/http/tests/images/png-partial-load-expected.png [new file with mode: 0644]

index 65e923e106c40a4a551d09b54870bb36ad47d3ee..b89d94aefcf962cb7b1d34323d0f37409b57a5a4 100644 (file)
@@ -1,3 +1,28 @@
+2012-09-18  Noel Gordon  <noel.gordon@gmail.com>
+
+        Add partial load tests for PNG images
+        https://bugs.webkit.org/show_bug.cgi?id=95707
+
+        Reviewed by Adam Barth.
+
+        Partial load test: receive a partial number of image bytes and stall forever. The
+        partial image should be decoded and drawn and the blue <img> background should be
+        visible.
+
+        Progressive load test: receive a partial number of image bytes, stall for 1 second
+        and then continue to receive all the image bytes. The entire test image should be
+        decoded and drawn and the blue <img> background should be visible.
+
+        * fast/images/resources/dice.png: Added: test image has alpha transparency.
+        * http/tests/images/png-partial-load-expected.png: Added.
+        * http/tests/images/png-partial-load-expected.txt: Added.
+        * http/tests/images/png-partial-load.html: Added.
+        * http/tests/images/png-progressive-load-expected.png: Added.
+        * http/tests/images/png-progressive-load-expected.txt: Added.
+        * http/tests/images/png-progressive-load.html: Added.
+        * platform/chromium/http/tests/images/png-partial-load-expected.png: Added.
+        * platform/mac/http/tests/images/png-partial-load-expected.png: Added.
+
 2012-09-18  Kentaro Hara  <haraken@chromium.org>
 
         [V8] Notification.requestPermission(function() {alert();}) crashes
diff --git a/LayoutTests/fast/images/resources/dice.png b/LayoutTests/fast/images/resources/dice.png
new file mode 100644 (file)
index 0000000..c82d015
Binary files /dev/null and b/LayoutTests/fast/images/resources/dice.png differ
diff --git a/LayoutTests/http/tests/images/png-partial-load-expected.png b/LayoutTests/http/tests/images/png-partial-load-expected.png
new file mode 100644 (file)
index 0000000..e839902
Binary files /dev/null and b/LayoutTests/http/tests/images/png-partial-load-expected.png differ
diff --git a/LayoutTests/http/tests/images/png-partial-load-expected.txt b/LayoutTests/http/tests/images/png-partial-load-expected.txt
new file mode 100644 (file)
index 0000000..8b13789
--- /dev/null
@@ -0,0 +1 @@
+
diff --git a/LayoutTests/http/tests/images/png-partial-load.html b/LayoutTests/http/tests/images/png-partial-load.html
new file mode 100644 (file)
index 0000000..46b3104
--- /dev/null
@@ -0,0 +1,31 @@
+<img style="background-color: blue" >
+<script>
+if (window.testRunner) {
+    testRunner.dumpAsText(true);
+    testRunner.waitUntilDone();
+}
+
+function loadAndStall()
+{
+    return "http://127.0.0.1:8000/resources/load-and-stall.php";
+}
+
+function pngImage()
+{
+    return "?name=../../../fast/images/resources/dice.png&mimeType=image%2Fpng";
+}
+
+function testDone()
+{
+    if (window.testRunner)
+        testRunner.notifyDone();
+}
+
+function runTest()
+{
+    document.querySelector("img").src = loadAndStall() + pngImage() + "&stallAt=45057&stallFor=60";
+    setTimeout(testDone, 500);
+}
+
+setTimeout(runTest, 0);
+</script>
diff --git a/LayoutTests/http/tests/images/png-progressive-load-expected.png b/LayoutTests/http/tests/images/png-progressive-load-expected.png
new file mode 100644 (file)
index 0000000..6413b87
Binary files /dev/null and b/LayoutTests/http/tests/images/png-progressive-load-expected.png differ
diff --git a/LayoutTests/http/tests/images/png-progressive-load-expected.txt b/LayoutTests/http/tests/images/png-progressive-load-expected.txt
new file mode 100644 (file)
index 0000000..8b13789
--- /dev/null
@@ -0,0 +1 @@
+
diff --git a/LayoutTests/http/tests/images/png-progressive-load.html b/LayoutTests/http/tests/images/png-progressive-load.html
new file mode 100644 (file)
index 0000000..6e249f4
--- /dev/null
@@ -0,0 +1,31 @@
+<img style="background-color: blue" >
+<script>
+if (window.testRunner) {
+    testRunner.dumpAsText(true);
+    testRunner.waitUntilDone();
+}
+
+function loadAndStall()
+{
+    return "http://127.0.0.1:8000/resources/load-and-stall.php";
+}
+
+function pngImage()
+{
+    return "?name=../../../fast/images/resources/dice.png&mimeType=image%2Fpng";
+}
+
+function testDone()
+{
+    if (window.testRunner)
+        testRunner.notifyDone();
+}
+
+function runTest()
+{
+    document.querySelector("img").src = loadAndStall() + pngImage() + "&stallAt=43008&stallFor=1";
+    setTimeout(testDone, 3000);
+}
+
+setTimeout(runTest, 0);
+</script>
diff --git a/LayoutTests/platform/chromium/http/tests/images/png-partial-load-expected.png b/LayoutTests/platform/chromium/http/tests/images/png-partial-load-expected.png
new file mode 100644 (file)
index 0000000..e839902
Binary files /dev/null and b/LayoutTests/platform/chromium/http/tests/images/png-partial-load-expected.png differ
diff --git a/LayoutTests/platform/mac/http/tests/images/png-partial-load-expected.png b/LayoutTests/platform/mac/http/tests/images/png-partial-load-expected.png
new file mode 100644 (file)
index 0000000..4392ab0
Binary files /dev/null and b/LayoutTests/platform/mac/http/tests/images/png-partial-load-expected.png differ