Title: [130001] trunk
Revision
130001
Author
commit-qu...@webkit.org
Date
2012-09-30 18:57:07 -0700 (Sun, 30 Sep 2012)

Log Message

[chromium] Add a test to verify that a plugin does not receive touch-events unless it explicitly requests for them
https://bugs.webkit.org/show_bug.cgi?id=97975

Patch by Sadrul Habib Chowdhury <sad...@chromium.org> on 2012-09-30
Reviewed by Adam Barth.

Tools:

TestWebPlugin can now be configured to accept touch events or not. Use this
configurability to verify that a plugin does not receive touch events unless
it explicitly requests for them.

* DumpRenderTree/chromium/TestWebPlugin.cpp:
(TestWebPlugin::TestWebPlugin):
(TestWebPlugin::initialize):
(TestWebPlugin::parseBoolean):
* DumpRenderTree/chromium/TestWebPlugin.h:
(TestWebPlugin):

LayoutTests:

* platform/chromium/plugins/touch-events-expected.txt: Added.
* platform/chromium/plugins/touch-events.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (130000 => 130001)


--- trunk/LayoutTests/ChangeLog	2012-10-01 01:30:18 UTC (rev 130000)
+++ trunk/LayoutTests/ChangeLog	2012-10-01 01:57:07 UTC (rev 130001)
@@ -1,3 +1,13 @@
+2012-09-30  Sadrul Habib Chowdhury  <sad...@chromium.org>
+
+        [chromium] Add a test to verify that a plugin does not receive touch-events unless it explicitly requests for them
+        https://bugs.webkit.org/show_bug.cgi?id=97975
+
+        Reviewed by Adam Barth.
+
+        * platform/chromium/plugins/touch-events-expected.txt: Added.
+        * platform/chromium/plugins/touch-events.html: Added.
+
 2012-09-30  Kent Tamura  <tk...@chromium.org>
 
         [Chromium] Rebaseline for DateTimeNumericFieldElement should use Localizer functions.

Added: trunk/LayoutTests/platform/chromium/plugins/touch-events-expected.txt (0 => 130001)


--- trunk/LayoutTests/platform/chromium/plugins/touch-events-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/chromium/plugins/touch-events-expected.txt	2012-10-01 01:57:07 UTC (rev 130001)
@@ -0,0 +1,4 @@
+Plugin received event: TouchStart
+Plugin received event: TouchMove
+Plugin received event: TouchEnd
+

Added: trunk/LayoutTests/platform/chromium/plugins/touch-events.html (0 => 130001)


--- trunk/LayoutTests/platform/chromium/plugins/touch-events.html	                        (rev 0)
+++ trunk/LayoutTests/platform/chromium/plugins/touch-events.html	2012-10-01 01:57:07 UTC (rev 130001)
@@ -0,0 +1,39 @@
+<html>
+<head>
+<style>
+  #plugin {
+    width: 150px;
+    height: 150px;
+  }
+</style>
+</head>
+
+<body>
+<embed id="touch_plugin" type="application/x-webkit-test-webplugin" accepts-touch="true"></embed><embed id="plugin" type="application/x-webkit-test-webplugin"></embed>
+<script>
+
+    if (!window.testRunner || !window.eventSender) {
+        document.write("This test does not work in manual mode.");
+    } else {
+        testRunner.dumpAsText();
+
+        var positionX = plugin.offsetLeft + 10;
+        var positionY = plugin.offsetTop + 10;
+        eventSender.addTouchPoint(positionX, positionY);
+        eventSender.touchStart();
+        eventSender.releaseTouchPoint(0);
+        eventSender.touchEnd();
+
+        positionX = touch_plugin.offsetLeft + 10;
+        positionY = touch_plugin.offsetTop + 10;
+        eventSender.addTouchPoint(positionX, positionY);
+        eventSender.touchStart();
+        eventSender.updateTouchPoint(0, positionX + 10, positionY + 5);
+        eventSender.touchMove();
+        eventSender.releaseTouchPoint(0);
+        eventSender.touchEnd();
+    }
+
+</script>
+</body>
+</html>

Modified: trunk/Tools/ChangeLog (130000 => 130001)


--- trunk/Tools/ChangeLog	2012-10-01 01:30:18 UTC (rev 130000)
+++ trunk/Tools/ChangeLog	2012-10-01 01:57:07 UTC (rev 130001)
@@ -1,3 +1,21 @@
+2012-09-30  Sadrul Habib Chowdhury  <sad...@chromium.org>
+
+        [chromium] Add a test to verify that a plugin does not receive touch-events unless it explicitly requests for them
+        https://bugs.webkit.org/show_bug.cgi?id=97975
+
+        Reviewed by Adam Barth.
+
+        TestWebPlugin can now be configured to accept touch events or not. Use this
+        configurability to verify that a plugin does not receive touch events unless
+        it explicitly requests for them.
+
+        * DumpRenderTree/chromium/TestWebPlugin.cpp:
+        (TestWebPlugin::TestWebPlugin):
+        (TestWebPlugin::initialize):
+        (TestWebPlugin::parseBoolean):
+        * DumpRenderTree/chromium/TestWebPlugin.h:
+        (TestWebPlugin):
+
 2012-09-28  Mariusz Grzegorczyk  <marius...@samsung.com>
 
         [WK2][GTK][EFL] Share WebKit2-GTK plugin process implementation with EFL port

Modified: trunk/Tools/DumpRenderTree/chromium/TestWebPlugin.cpp (130000 => 130001)


--- trunk/Tools/DumpRenderTree/chromium/TestWebPlugin.cpp	2012-10-01 01:30:18 UTC (rev 130000)
+++ trunk/Tools/DumpRenderTree/chromium/TestWebPlugin.cpp	2012-10-01 01:57:07 UTC (rev 130001)
@@ -81,11 +81,13 @@
     : m_frame(frame)
     , m_container(0)
     , m_context(0)
+    , m_acceptsTouchEvent(false)
 {
     static const WebString kAttributePrimitive = WebString::fromUTF8("primitive");
     static const WebString kAttributeBackgroundColor = WebString::fromUTF8("background-color");
     static const WebString kAttributePrimitiveColor = WebString::fromUTF8("primitive-color");
     static const WebString kAttributeOpacity = WebString::fromUTF8("opacity");
+    static const WebString kAttributeAcceptsTouch = WebString::fromUTF8("accepts-touch");
 
     ASSERT(params.attributeNames.size() == params.attributeValues.size());
     size_t size = params.attributeNames.size();
@@ -101,6 +103,8 @@
             parseColor(attributeValue, m_scene.primitiveColor);
         else if (attributeName == kAttributeOpacity)
             m_scene.opacity = parseOpacity(attributeValue);
+        else if (attributeName == kAttributeAcceptsTouch)
+            m_acceptsTouchEvent = parseBoolean(attributeValue);
     }
 }
 
@@ -129,6 +133,7 @@
 
     m_container = container;
     m_container->setBackingTextureId(m_colorTexture);
+    m_container->setIsAcceptingTouchEvents(m_acceptsTouchEvent);
     return true;
 }
 
@@ -208,6 +213,12 @@
     return static_cast<float>(atof(string.utf8().data()));
 }
 
+bool TestWebPlugin::parseBoolean(const WebString& string)
+{
+    static const WebString kPrimitiveTrue = WebString::fromUTF8("true");
+    return string == kPrimitiveTrue;
+}
+
 bool TestWebPlugin::initScene()
 {
     float color[4];

Modified: trunk/Tools/DumpRenderTree/chromium/TestWebPlugin.h (130000 => 130001)


--- trunk/Tools/DumpRenderTree/chromium/TestWebPlugin.h	2012-10-01 01:30:18 UTC (rev 130000)
+++ trunk/Tools/DumpRenderTree/chromium/TestWebPlugin.h	2012-10-01 01:57:07 UTC (rev 130001)
@@ -42,6 +42,9 @@
 // background-color: black (default), red, green, blue.
 // primitive-color: black (default), red, green, blue.
 // opacity: [0.0 - 1.0]. Default is 1.0.
+//
+// Whether the plugin accepts touch events or not can be customized using the
+// 'accepts-touch' plugin parameter (defaults to false).
 class TestWebPlugin : public WebKit::WebPlugin {
 public:
     TestWebPlugin(WebKit::WebFrame*, const WebKit::WebPluginParams&);
@@ -104,6 +107,7 @@
     Primitive parsePrimitive(const WebKit::WebString&);
     void parseColor(const WebKit::WebString&, unsigned color[3]);
     float parseOpacity(const WebKit::WebString&);
+    bool parseBoolean(const WebKit::WebString&);
 
     // Functions for loading and drawing scene.
     bool initScene();
@@ -124,6 +128,8 @@
     unsigned m_colorTexture;
     unsigned m_framebuffer;
     Scene m_scene;
+
+    bool m_acceptsTouchEvent;
 };
 
 #endif // TestPepperPlugin_h
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to