[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

tkent at chromium.org tkent at chromium.org
Wed Dec 22 15:43:45 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 3170764f31bce9476bddb784972150b54e76e8a2
Author: tkent at chromium.org <tkent at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Nov 11 08:25:36 2010 +0000

    Add a test for form submission by <input type=image>
    https://bugs.webkit.org/show_bug.cgi?id=49302
    
    Reviewed by Shinichiro Hamaji.
    
    * fast/forms/input-image-submit-expected.txt: Added.
    * fast/forms/input-image-submit.html: Added.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@71799 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 911d512..ab3a940 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,13 @@
+2010-11-11  Kent Tamura  <tkent at chromium.org>
+
+        Reviewed by Shinichiro Hamaji.
+
+        Add a test for form submission by <input type=image>
+        https://bugs.webkit.org/show_bug.cgi?id=49302
+
+        * fast/forms/input-image-submit-expected.txt: Added.
+        * fast/forms/input-image-submit.html: Added.
+
 2010-11-10  Ryosuke Niwa  <rniwa at webkit.org>
 
         Reviewed by Adam Barth.
diff --git a/LayoutTests/fast/forms/input-image-submit-expected.txt b/LayoutTests/fast/forms/input-image-submit-expected.txt
new file mode 100644
index 0000000..17fe7db
--- /dev/null
+++ b/LayoutTests/fast/forms/input-image-submit-expected.txt
@@ -0,0 +1,3 @@
+
+PASS All tests passed.
+
diff --git a/LayoutTests/fast/forms/input-image-submit.html b/LayoutTests/fast/forms/input-image-submit.html
new file mode 100644
index 0000000..17b622d
--- /dev/null
+++ b/LayoutTests/fast/forms/input-image-submit.html
@@ -0,0 +1,130 @@
+<!DOCTYPE html>
+<html>
+<head>
+<link rel="stylesheet" href="../../fast/js/resources/js-test-style.css">
+<script src="../../fast/js/resources/js-test-pre.js"></script>
+</head>
+<body onload="startTests()">
+
+<form action="input-image-submit.html" method=GET id=form>
+<input type=hidden name=state id=state value=step1>
+<input type=image name=image id=image src=resources/apple.gif value=value>
+</form>
+
+<div id="console"></div>
+<script>
+function gc() {
+    if (window.GCController)
+        return GCController.collect();
+
+    for (var i = 0; i < 10000; i++)
+        var s = new String("");
+}
+
+function notifyDone() {
+    if (window.layoutTestController)
+        layoutTestController.notifyDone();
+}
+
+function failAndDone(message) {
+    testFailed(message);
+    notifyDone();
+}
+
+function handleSubmit() {
+    if (state.value == 'to-text-on-submit') {
+        image.type = 'text';
+    } else if (state.value == 'to-image-on-submit') {
+        image.type = 'image';
+    } else if (state.value == 'remove-input-on-submit') {
+        image.parentNode.removeChild(image);
+        image = null;
+        // Try to clear the reference count of the element.
+        gc();
+    }
+}
+
+function handleClick() {
+    if (state.value == 'to-image-on-click') {
+        image.type = 'image'
+    }
+}
+
+if (window.layoutTestController)
+    layoutTestController.waitUntilDone();
+
+var state = document.getElementById('state');
+var image = document.getElementById('image');
+image.addEventListener('click', handleClick, false);
+var form = document.getElementById('form');
+form.addEventListener('submit', handleSubmit, false);
+
+function startTests() {
+    var x = image.offsetLeft + 7;
+    var y = image.offsetTop + 11;
+    var clickEvent = document.createEvent('MouseEvent');
+    clickEvent.initMouseEvent('click', true, false, document.defaultView, 1, x, y, x, y, false, false, false, false, 0, document);
+    var enterEvent = document.createEvent('TextEvent');
+    enterEvent.initTextEvent("textInput", true, true, document.defaultView, "\n");
+    var query = window.location.search;
+
+    if (query.indexOf('state=') == -1) {
+        // Step 1: Normal submission with type=image
+        state.value = 'normal';
+        image.dispatchEvent(clickEvent);
+    } else if (query.indexOf('state=normal') != -1) {
+        // Should have image.x=7&image.y=11&image=value.
+        if (query.indexOf('image.x=7&image.y=11&image=value') == -1) {
+            failAndDone('Normal submission failed: ' + query);
+            return;
+        }
+
+        // Step 2: Change the type to text on 'submit' event
+        state.value = 'to-text-on-submit';
+        image.dispatchEvent(clickEvent);
+    } else if (query.indexOf('state=to-text-on-submit') != -1) {
+        // Should have only image=value.
+        if (query.indexOf('image=value') == -1) {
+            failAndDone('Changing to text on submit failed: ' + query);
+            return;
+        }
+
+        // Step 3: Change the type to image on 'submit' event
+        state.value = 'to-image-on-submit';
+        image.type = 'text';
+        image.focus();
+        image.dispatchEvent(enterEvent);
+    } else if (query.indexOf('state=to-image-on-submit') != -1) {
+        // Should have image.x and image.y, but their values are 0.
+        if (query.indexOf('image.x=0&image.y=0&image=value') == -1) {
+            failAndDone('Changing to image on submit failed: ' + query);
+            return;
+        }
+
+        // Step 4: Change the type to image on 'click' event
+        state.value = 'to-image-on-click';
+        image.type = 'text';
+        image.dispatchEvent(clickEvent);
+    } else if (query.indexOf('state=to-image-on-click') != -1) {
+        // Same as the normal submission.
+        if (query.indexOf('image.x=7&image.y=11&image=value') == -1) {
+            failAndDone('Changing to image on click failed: ' + query);
+            return;
+        }
+
+        // Step 5: Removed the image button on 'submit' event
+        state.value = 'remove-input-on-submit';
+        image.dispatchEvent(clickEvent);
+    } else if (query.indexOf('state=remove-input-on-submit') != -1) {
+        // Should have nothing about image.
+        if (query.indexOf('image.x=') != -1 || query.indexOf('image=value') != -1)
+            testFailed('Removing the input on submit failed: ' + query);
+        else
+            testPassed('All tests passed.');
+        notifyDone();
+    }
+}
+</script>
+</body>
+</html>
+

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list