summaryrefslogtreecommitdiff
path: root/Tools/WebKitTestRunner
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2012-09-25 13:02:02 +0200
committerSimon Hausmann <simon.hausmann@digia.com>2012-09-25 13:02:02 +0200
commit715be629d51174233403237bfc563cf150087dc8 (patch)
tree4cff72df808db977624338b0a38d8b6d1bd73c57 /Tools/WebKitTestRunner
parentdc6262b587c71c14e30d93e57ed812e36a79a33e (diff)
downloadqtwebkit-715be629d51174233403237bfc563cf150087dc8.tar.gz
Imported WebKit commit ce614b0924ba46f78d4435e28ff93c8525fbb7cc (http://svn.webkit.org/repository/webkit/trunk@129485)
New snapshot that includes MingW build fixes
Diffstat (limited to 'Tools/WebKitTestRunner')
-rw-r--r--Tools/WebKitTestRunner/EventSenderProxy.h8
-rw-r--r--Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl3
-rw-r--r--Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp5
-rw-r--r--Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp10
-rw-r--r--Tools/WebKitTestRunner/InjectedBundle/TestRunner.h2
-rw-r--r--Tools/WebKitTestRunner/efl/EventSenderProxyEfl.cpp96
6 files changed, 106 insertions, 18 deletions
diff --git a/Tools/WebKitTestRunner/EventSenderProxy.h b/Tools/WebKitTestRunner/EventSenderProxy.h
index 2e84c571e..ce2c1a612 100644
--- a/Tools/WebKitTestRunner/EventSenderProxy.h
+++ b/Tools/WebKitTestRunner/EventSenderProxy.h
@@ -34,6 +34,7 @@
#include <gdk/gdk.h>
#include <wtf/Vector.h>
#elif PLATFORM(EFL)
+#include <WebKit2/EWebKit2.h>
#include <wtf/Deque.h>
#endif
@@ -50,6 +51,7 @@ struct WTREvent;
class EventSenderProxy {
public:
explicit EventSenderProxy(TestController*);
+ ~EventSenderProxy();
void mouseDown(unsigned button, WKEventModifiers);
void mouseUp(unsigned button, WKEventModifiers);
@@ -97,6 +99,9 @@ private:
#elif PLATFORM(EFL)
void sendOrQueueEvent(const WTREvent&);
void dispatchEvent(const WTREvent&);
+#if ENABLE(TOUCH_EVENTS)
+ void sendTouchEvent(Ewk_Touch_Event_Type);
+#endif
#endif
double m_time;
@@ -123,6 +128,9 @@ private:
#elif PLATFORM(EFL)
Deque<WTREvent> m_eventQueue;
unsigned m_mouseButton;
+#if ENABLE(TOUCH_EVENTS)
+ Eina_List* m_touchPoints;
+#endif
#endif
};
diff --git a/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl b/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl
index 5b177d5bc..35af514fe 100644
--- a/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl
+++ b/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl
@@ -160,8 +160,7 @@ module WTR {
// Cookies testing
void setAlwaysAcceptCookies(in boolean accept);
- // FIXME: handle non-boolean preferences.
- void overridePreference(in DOMString preference, in boolean value);
+ void overridePreference(in DOMString preference, in DOMString value);
// Page Visibility API
void setPageVisibility(in DOMString state);
diff --git a/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp b/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp
index 689e381c3..ab579c41b 100644
--- a/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp
+++ b/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp
@@ -1319,9 +1319,10 @@ WKBundlePagePolicyAction InjectedBundlePage::decidePolicyForNewWindowAction(WKBu
return WKBundlePagePolicyActionUse;
}
-WKBundlePagePolicyAction InjectedBundlePage::decidePolicyForResponse(WKBundlePageRef, WKBundleFrameRef, WKURLResponseRef, WKURLRequestRef, WKTypeRef*)
+WKBundlePagePolicyAction InjectedBundlePage::decidePolicyForResponse(WKBundlePageRef page, WKBundleFrameRef, WKURLResponseRef response, WKURLRequestRef, WKTypeRef*)
{
- return WKBundlePagePolicyActionUse;
+ WKRetainPtr<WKStringRef> mimeType = adoptWK(WKURLResponseCopyMIMEType(response));
+ return WKBundlePageCanShowMIMEType(page, mimeType.get()) ? WKBundlePagePolicyActionUse : WKBundlePagePolicyActionPassThrough;
}
void InjectedBundlePage::unableToImplementPolicy(WKBundlePageRef, WKBundleFrameRef, WKErrorRef, WKTypeRef*)
diff --git a/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp b/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp
index 13c18388b..e2ef1557c 100644
--- a/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp
+++ b/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp
@@ -649,9 +649,15 @@ void TestRunner::callSetBackingScaleFactorCallback()
callTestRunnerCallback(SetBackingScaleFactorCallbackID);
}
-void TestRunner::overridePreference(JSStringRef preference, bool value)
+static inline bool toBool(JSStringRef value)
{
- WKBundleOverrideBoolPreferenceForTestRunner(InjectedBundle::shared().bundle(), InjectedBundle::shared().pageGroup(), toWK(preference).get(), value);
+ return JSStringIsEqualToUTF8CString(value, "true") || JSStringIsEqualToUTF8CString(value, "1");
+}
+
+void TestRunner::overridePreference(JSStringRef preference, JSStringRef value)
+{
+ // FIXME: handle non-boolean preferences.
+ WKBundleOverrideBoolPreferenceForTestRunner(InjectedBundle::shared().bundle(), InjectedBundle::shared().pageGroup(), toWK(preference).get(), toBool(value));
}
void TestRunner::sendWebIntentResponse(JSStringRef reply)
diff --git a/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h b/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h
index 6300431ed..a44129938 100644
--- a/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h
+++ b/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h
@@ -228,7 +228,7 @@ public:
void callFocusWebViewCallback();
void callSetBackingScaleFactorCallback();
- void overridePreference(JSStringRef preference, bool value);
+ void overridePreference(JSStringRef preference, JSStringRef value);
// Web intents testing.
void sendWebIntentResponse(JSStringRef reply);
diff --git a/Tools/WebKitTestRunner/efl/EventSenderProxyEfl.cpp b/Tools/WebKitTestRunner/efl/EventSenderProxyEfl.cpp
index 0c732100e..fc225e3f4 100644
--- a/Tools/WebKitTestRunner/efl/EventSenderProxyEfl.cpp
+++ b/Tools/WebKitTestRunner/efl/EventSenderProxyEfl.cpp
@@ -45,6 +45,8 @@
namespace WTR {
+static const char* modifierNames[] = { "Shift", "Control", "Alt", "Meta" };
+
enum WTREventType {
WTREventTypeNone = 0,
WTREventTypeMouseDown,
@@ -133,7 +135,6 @@ static unsigned evasMouseButton(unsigned button)
static void setEvasModifiers(Evas* evas, WKEventModifiers wkModifiers)
{
- static const char* modifierNames[] = { "Shift", "Control", "Alt", "Meta" };
for (unsigned modifier = 0; modifier < (sizeof(modifierNames) / sizeof(char*)); ++modifier) {
if (wkModifiers & (1 << modifier))
evas_key_modifier_on(evas, modifierNames[modifier]);
@@ -293,9 +294,19 @@ EventSenderProxy::EventSenderProxy(TestController* testController)
, m_clickTime(0)
, m_clickButton(WTRMouseButtonNone)
, m_mouseButton(WTRMouseButtonNone)
+#if ENABLE(TOUCH_EVENTS)
+ , m_touchPoints(0)
+#endif
{
}
+EventSenderProxy::~EventSenderProxy()
+{
+#if ENABLE(TOUCH_EVENTS)
+ clearTouchPoints();
+#endif
+}
+
void EventSenderProxy::updateClickCountForButton(int button)
{
if (m_time - m_clickTime < 1 && m_position == m_clickPosition && button == m_clickButton) {
@@ -432,54 +443,117 @@ void EventSenderProxy::keyDown(WKStringRef keyRef, WKEventModifiers wkModifiers,
}
#if ENABLE(TOUCH_EVENTS)
+void EventSenderProxy::sendTouchEvent(Ewk_Touch_Event_Type eventType)
+{
+ ASSERT(m_touchPoints);
+
+ Evas_Object* ewkView = m_testController->mainWebView()->platformView();
+ ewk_view_feed_touch_event(ewkView, eventType, m_touchPoints, evas_key_modifier_get(evas_object_evas_get(ewkView)));
+
+ Eina_List* list;
+ Eina_List* listNext;
+ void* data;
+ EINA_LIST_FOREACH_SAFE(m_touchPoints, list, listNext, data) {
+ Ewk_Touch_Point* touchPoint = static_cast<Ewk_Touch_Point*>(data);
+ ASSERT(touchPoint);
+
+ if ((touchPoint->state == EVAS_TOUCH_POINT_UP) || (touchPoint->state == EVAS_TOUCH_POINT_CANCEL)) {
+ delete touchPoint;
+ m_touchPoints = eina_list_remove_list(m_touchPoints, list);
+ } else
+ touchPoint->state = EVAS_TOUCH_POINT_STILL;
+ }
+}
+
void EventSenderProxy::addTouchPoint(int x, int y)
{
- notImplemented();
+ int id = 0;
+ if (m_touchPoints) {
+ Eina_List* last = eina_list_last(m_touchPoints);
+ Ewk_Touch_Point* touchPoint = static_cast<Ewk_Touch_Point*>(eina_list_data_get(last));
+ ASSERT(touchPoint);
+
+ id = touchPoint->id + 1;
+ }
+
+ Ewk_Touch_Point* touchPoint = new Ewk_Touch_Point;
+ touchPoint->id = id;
+ touchPoint->x = x;
+ touchPoint->y = y;
+ touchPoint->state = EVAS_TOUCH_POINT_DOWN;
+
+ m_touchPoints = eina_list_append(m_touchPoints, touchPoint);
}
void EventSenderProxy::updateTouchPoint(int index, int x, int y)
{
- notImplemented();
+ ASSERT(index >= 0 && index < eina_list_count(m_touchPoints));
+
+ Ewk_Touch_Point* touchPoint = static_cast<Ewk_Touch_Point*>(eina_list_nth(m_touchPoints, index));
+ ASSERT(touchPoint);
+
+ touchPoint->x = x;
+ touchPoint->y = y;
+ touchPoint->state = EVAS_TOUCH_POINT_MOVE;
}
void EventSenderProxy::setTouchModifier(WKEventModifiers modifier, bool enable)
{
- notImplemented();
+ for (unsigned index = 0; index < (sizeof(modifierNames) / sizeof(char*)); ++index) {
+ if (modifier & (1 << index)) {
+ if (enable)
+ evas_key_modifier_on(evas_object_evas_get(m_testController->mainWebView()->platformView()), modifierNames[index]);
+ else
+ evas_key_modifier_off(evas_object_evas_get(m_testController->mainWebView()->platformView()), modifierNames[index]);
+ }
+ }
}
void EventSenderProxy::touchStart()
{
- notImplemented();
+ sendTouchEvent(EWK_TOUCH_START);
}
void EventSenderProxy::touchMove()
{
- notImplemented();
+ sendTouchEvent(EWK_TOUCH_MOVE);
}
void EventSenderProxy::touchEnd()
{
- notImplemented();
+ sendTouchEvent(EWK_TOUCH_END);
}
void EventSenderProxy::touchCancel()
{
- notImplemented();
+ sendTouchEvent(EWK_TOUCH_CANCEL);
}
void EventSenderProxy::clearTouchPoints()
{
- notImplemented();
+ void* data = 0;
+ EINA_LIST_FREE(m_touchPoints, data)
+ delete static_cast<Ewk_Touch_Point*>(data);
}
void EventSenderProxy::releaseTouchPoint(int index)
{
- notImplemented();
+ ASSERT(index >= 0 && index < eina_list_count(m_touchPoints));
+
+ Ewk_Touch_Point* touchPoint = static_cast<Ewk_Touch_Point*>(eina_list_nth(m_touchPoints, index));
+ ASSERT(touchPoint);
+
+ touchPoint->state = EVAS_TOUCH_POINT_UP;
}
void EventSenderProxy::cancelTouchPoint(int index)
{
- notImplemented();
+ ASSERT(index >= 0 && index < eina_list_count(m_touchPoints));
+
+ Ewk_Touch_Point* touchPoint = static_cast<Ewk_Touch_Point*>(eina_list_nth(m_touchPoints, index));
+ ASSERT(touchPoint);
+
+ touchPoint->state = EVAS_TOUCH_POINT_CANCEL;
}
void EventSenderProxy::setTouchPointRadius(int radiusX, int radiusY)