summaryrefslogtreecommitdiff
path: root/Tools/WebKitTestRunner
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2012-09-24 13:09:44 +0200
committerSimon Hausmann <simon.hausmann@digia.com>2012-09-24 13:09:44 +0200
commitdc6262b587c71c14e30d93e57ed812e36a79a33e (patch)
tree03ff986e7aa38bba0c0ef374f44fda52aff93f01 /Tools/WebKitTestRunner
parent02e1fbbefd49229b102ef107bd70ce974a2d85fb (diff)
downloadqtwebkit-dc6262b587c71c14e30d93e57ed812e36a79a33e.tar.gz
Imported WebKit commit 6339232fec7f5d9984a33388aecfd2cbc7832053 (http://svn.webkit.org/repository/webkit/trunk@129343)
New snapshot with build fixes for latest qtbase
Diffstat (limited to 'Tools/WebKitTestRunner')
-rw-r--r--Tools/WebKitTestRunner/CMakeLists.txt1
-rw-r--r--Tools/WebKitTestRunner/GNUmakefile.am2
-rw-r--r--Tools/WebKitTestRunner/GeolocationProviderMock.cpp83
-rw-r--r--Tools/WebKitTestRunner/GeolocationProviderMock.h51
-rw-r--r--Tools/WebKitTestRunner/InjectedBundle/AccessibilityController.cpp1
-rw-r--r--Tools/WebKitTestRunner/InjectedBundle/AccessibilityController.h1
-rw-r--r--Tools/WebKitTestRunner/InjectedBundle/Bindings/AccessibilityController.idl1
-rw-r--r--Tools/WebKitTestRunner/InjectedBundle/Bindings/EventSendingController.idl1
-rw-r--r--Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl5
-rw-r--r--Tools/WebKitTestRunner/InjectedBundle/EventSendingController.cpp68
-rw-r--r--Tools/WebKitTestRunner/InjectedBundle/EventSendingController.h1
-rw-r--r--Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp28
-rw-r--r--Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.h4
-rw-r--r--Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp5
-rw-r--r--Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp16
-rw-r--r--Tools/WebKitTestRunner/InjectedBundle/TestRunner.h5
-rw-r--r--Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityCommonMac.h47
-rw-r--r--Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityCommonMac.mm52
-rw-r--r--Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityControllerMac.mm41
-rw-r--r--Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm30
-rw-r--r--Tools/WebKitTestRunner/Target.pri2
-rw-r--r--Tools/WebKitTestRunner/TestController.cpp49
-rw-r--r--Tools/WebKitTestRunner/TestController.h9
-rw-r--r--Tools/WebKitTestRunner/TestInvocation.cpp31
-rw-r--r--Tools/WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj10
-rw-r--r--Tools/WebKitTestRunner/efl/EventSenderProxyEfl.cpp18
-rw-r--r--Tools/WebKitTestRunner/gtk/PlatformWebViewGtk.cpp3
-rw-r--r--Tools/WebKitTestRunner/qt/EventSenderProxyQt.cpp4
-rw-r--r--Tools/WebKitTestRunner/win/WebKitTestRunner.vcproj8
29 files changed, 506 insertions, 71 deletions
diff --git a/Tools/WebKitTestRunner/CMakeLists.txt b/Tools/WebKitTestRunner/CMakeLists.txt
index a3ea88dca..9df362211 100644
--- a/Tools/WebKitTestRunner/CMakeLists.txt
+++ b/Tools/WebKitTestRunner/CMakeLists.txt
@@ -5,6 +5,7 @@ FILE(MAKE_DIRECTORY ${DERIVED_SOURCES_DIR}/InjectedBundle)
SET(WebKitTestRunner_SOURCES
${WEBKIT_TESTRUNNER_DIR}/CyclicRedundancyCheck.cpp
+ ${WEBKIT_TESTRUNNER_DIR}/GeolocationProviderMock.cpp
${WEBKIT_TESTRUNNER_DIR}/PixelDumpSupport.cpp
${WEBKIT_TESTRUNNER_DIR}/TestController.cpp
${WEBKIT_TESTRUNNER_DIR}/TestInvocation.cpp
diff --git a/Tools/WebKitTestRunner/GNUmakefile.am b/Tools/WebKitTestRunner/GNUmakefile.am
index c8daca2cc..2550702cc 100644
--- a/Tools/WebKitTestRunner/GNUmakefile.am
+++ b/Tools/WebKitTestRunner/GNUmakefile.am
@@ -19,6 +19,8 @@ Programs_WebKitTestRunner_SOURCES = \
Tools/WebKitTestRunner/cairo/TestInvocationCairo.cpp \
Tools/WebKitTestRunner/CyclicRedundancyCheck.cpp \
Tools/WebKitTestRunner/CyclicRedundancyCheck.h \
+ Tools/WebKitTestRunner/GeolocationProviderMock.cpp \
+ Tools/WebKitTestRunner/GeolocationProviderMock.h \
Tools/WebKitTestRunner/PixelDumpSupport.cpp \
Tools/WebKitTestRunner/PixelDumpSupport.h \
Tools/WebKitTestRunner/PlatformWebView.h \
diff --git a/Tools/WebKitTestRunner/GeolocationProviderMock.cpp b/Tools/WebKitTestRunner/GeolocationProviderMock.cpp
new file mode 100644
index 000000000..babbf6e0d
--- /dev/null
+++ b/Tools/WebKitTestRunner/GeolocationProviderMock.cpp
@@ -0,0 +1,83 @@
+/*
+ * Copyright (C) 2012 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "GeolocationProviderMock.h"
+
+#include <WebKit2/WKGeolocationManager.h>
+#include <wtf/Assertions.h>
+#include <wtf/CurrentTime.h>
+
+namespace WTR {
+
+static void startUpdatingCallback(WKGeolocationManagerRef geolocationManager, const void* clientInfo)
+{
+ GeolocationProviderMock* geolocationProvider = static_cast<GeolocationProviderMock*>(const_cast<void*>(clientInfo));
+ geolocationProvider->startUpdating(geolocationManager);
+}
+
+static void stopUpdatingCallback(WKGeolocationManagerRef geolocationManager, const void* clientInfo)
+{
+ GeolocationProviderMock* geolocationProvider = static_cast<GeolocationProviderMock*>(const_cast<void*>(clientInfo));
+ geolocationProvider->stopUpdating(geolocationManager);
+}
+
+GeolocationProviderMock::GeolocationProviderMock(WKContextRef context)
+ : m_isActive(false)
+{
+ m_geolocationManager = WKContextGetGeolocationManager(context);
+
+ WKGeolocationProvider providerCallback = {
+ kWKGeolocationProviderCurrentVersion,
+ this,
+ startUpdatingCallback,
+ stopUpdatingCallback };
+ WKGeolocationManagerSetProvider(m_geolocationManager, &providerCallback);
+}
+
+void GeolocationProviderMock::setMockGeolocationPosition(double latitude, double longitude, double accuracy)
+{
+ m_position.adopt(WKGeolocationPositionCreate(currentTime(), latitude, longitude, accuracy));
+ if (m_isActive)
+ WKGeolocationManagerProviderDidChangePosition(m_geolocationManager, m_position.get());
+}
+
+void GeolocationProviderMock::startUpdating(WKGeolocationManagerRef geolocationManager)
+{
+ ASSERT_UNUSED(geolocationManager, geolocationManager == m_geolocationManager);
+
+ m_isActive = true;
+ if (m_position)
+ WKGeolocationManagerProviderDidChangePosition(m_geolocationManager, m_position.get());
+}
+
+void GeolocationProviderMock::stopUpdating(WKGeolocationManagerRef geolocationManager)
+{
+ ASSERT_UNUSED(geolocationManager, geolocationManager == m_geolocationManager);
+
+ m_isActive = false;
+}
+
+} // namespace WTR
diff --git a/Tools/WebKitTestRunner/GeolocationProviderMock.h b/Tools/WebKitTestRunner/GeolocationProviderMock.h
new file mode 100644
index 000000000..0f6284a2f
--- /dev/null
+++ b/Tools/WebKitTestRunner/GeolocationProviderMock.h
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2012 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef GeolocationProviderMock_h
+#define GeolocationProviderMock_h
+
+#include <WebKit2/WKRetainPtr.h>
+
+namespace WTR {
+
+class GeolocationProviderMock {
+public:
+ GeolocationProviderMock(WKContextRef);
+
+ void setMockGeolocationPosition(double latitude, double longitude, double accuracy);
+
+ void startUpdating(WKGeolocationManagerRef);
+ void stopUpdating(WKGeolocationManagerRef);
+
+private:
+ WKGeolocationManagerRef m_geolocationManager;
+ bool m_isActive;
+
+ WKRetainPtr<WKGeolocationPositionRef> m_position;
+};
+
+} // namespace WTR
+
+#endif // GeolocationProviderMock_h
diff --git a/Tools/WebKitTestRunner/InjectedBundle/AccessibilityController.cpp b/Tools/WebKitTestRunner/InjectedBundle/AccessibilityController.cpp
index 2cd3049fe..c6f7d75cc 100644
--- a/Tools/WebKitTestRunner/InjectedBundle/AccessibilityController.cpp
+++ b/Tools/WebKitTestRunner/InjectedBundle/AccessibilityController.cpp
@@ -106,6 +106,7 @@ PassRefPtr<AccessibilityUIElement> AccessibilityController::elementAtPoint(int x
#if !PLATFORM(MAC)
bool AccessibilityController::addNotificationListener(JSValueRef) { return false; }
bool AccessibilityController::removeNotificationListener() { return false; }
+PassRefPtr<AccessibilityUIElement> AccessibilityController::accessibleElementById(JSStringRef attribute) { return 0; }
#endif
#if !PLATFORM(GTK)
diff --git a/Tools/WebKitTestRunner/InjectedBundle/AccessibilityController.h b/Tools/WebKitTestRunner/InjectedBundle/AccessibilityController.h
index 3c87cac5d..f02feac05 100644
--- a/Tools/WebKitTestRunner/InjectedBundle/AccessibilityController.h
+++ b/Tools/WebKitTestRunner/InjectedBundle/AccessibilityController.h
@@ -48,6 +48,7 @@ public:
PassRefPtr<AccessibilityUIElement> rootElement();
PassRefPtr<AccessibilityUIElement> focusedElement();
PassRefPtr<AccessibilityUIElement> elementAtPoint(int x, int y);
+ PassRefPtr<AccessibilityUIElement> accessibleElementById(JSStringRef idAttribute);
bool addNotificationListener(JSValueRef functionCallback);
bool removeNotificationListener();
diff --git a/Tools/WebKitTestRunner/InjectedBundle/Bindings/AccessibilityController.idl b/Tools/WebKitTestRunner/InjectedBundle/Bindings/AccessibilityController.idl
index 2df8c279f..bd05f1334 100644
--- a/Tools/WebKitTestRunner/InjectedBundle/Bindings/AccessibilityController.idl
+++ b/Tools/WebKitTestRunner/InjectedBundle/Bindings/AccessibilityController.idl
@@ -29,6 +29,7 @@ module WTR {
readonly attribute AccessibilityUIElement rootElement;
readonly attribute AccessibilityUIElement focusedElement;
AccessibilityUIElement elementAtPoint(in int x, in int y);
+ AccessibilityUIElement accessibleElementById(in DOMString id);
boolean addNotificationListener(in object functionCallback);
boolean removeNotificationListener();
diff --git a/Tools/WebKitTestRunner/InjectedBundle/Bindings/EventSendingController.idl b/Tools/WebKitTestRunner/InjectedBundle/Bindings/EventSendingController.idl
index 494dd2337..cff75f2c2 100644
--- a/Tools/WebKitTestRunner/InjectedBundle/Bindings/EventSendingController.idl
+++ b/Tools/WebKitTestRunner/InjectedBundle/Bindings/EventSendingController.idl
@@ -31,6 +31,7 @@ module WTR {
void mouseMoveTo(in long x, in long y);
void mouseScrollBy(in long x, in long y);
void continuousMouseScrollBy(in long x, in long y, in [Optional] boolean paged);
+ void scheduleAsynchronousClick();
void leapForward(in long milliseconds);
diff --git a/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl b/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl
index a0e3eeda8..5b177d5bc 100644
--- a/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl
+++ b/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl
@@ -60,7 +60,6 @@ module WTR {
void setAllowFileAccessFromFileURLs(in boolean value);
void setFrameFlatteningEnabled(in boolean value);
void setPluginsEnabled(in boolean value);
- void setGeolocationPermission(in boolean value);
void setJavaScriptCanAccessClipboard(in boolean value);
void setPrivateBrowsingEnabled(in boolean value);
void setPopupBlockingEnabled(in boolean value);
@@ -179,6 +178,10 @@ module WTR {
void removeAllWebNotificationPermissions();
void simulateWebNotificationClick(in object notification);
+ // Geolocation
+ void setGeolocationPermission(in boolean value);
+ void setMockGeolocationPosition(in double latitude, in double longitude, in double accuracy);
+
boolean callShouldCloseOnWebView();
};
diff --git a/Tools/WebKitTestRunner/InjectedBundle/EventSendingController.cpp b/Tools/WebKitTestRunner/InjectedBundle/EventSendingController.cpp
index b7e203cda..bf6d9bcb1 100644
--- a/Tools/WebKitTestRunner/InjectedBundle/EventSendingController.cpp
+++ b/Tools/WebKitTestRunner/InjectedBundle/EventSendingController.cpp
@@ -125,6 +125,30 @@ JSClassRef EventSendingController::wrapperClass()
return JSEventSendingController::eventSendingControllerClass();
}
+enum MouseState {
+ MouseUp,
+ MouseDown
+};
+
+static WKMutableDictionaryRef createMouseMessageBody(MouseState state, int button, WKEventModifiers modifiers)
+{
+ WKMutableDictionaryRef EventSenderMessageBody = WKMutableDictionaryCreate();
+
+ WKRetainPtr<WKStringRef> subMessageKey(AdoptWK, WKStringCreateWithUTF8CString("SubMessage"));
+ WKRetainPtr<WKStringRef> subMessageName(AdoptWK, WKStringCreateWithUTF8CString(state == MouseUp ? "MouseUp" : "MouseDown"));
+ WKDictionaryAddItem(EventSenderMessageBody, subMessageKey.get(), subMessageName.get());
+
+ WKRetainPtr<WKStringRef> buttonKey = adoptWK(WKStringCreateWithUTF8CString("Button"));
+ WKRetainPtr<WKUInt64Ref> buttonRef = adoptWK(WKUInt64Create(button));
+ WKDictionaryAddItem(EventSenderMessageBody, buttonKey.get(), buttonRef.get());
+
+ WKRetainPtr<WKStringRef> modifiersKey = adoptWK(WKStringCreateWithUTF8CString("Modifiers"));
+ WKRetainPtr<WKUInt64Ref> modifiersRef = adoptWK(WKUInt64Create(modifiers));
+ WKDictionaryAddItem(EventSenderMessageBody, modifiersKey.get(), modifiersRef.get());
+
+ return EventSenderMessageBody;
+}
+
void EventSendingController::mouseDown(int button, JSValueRef modifierArray)
{
WKBundlePageRef page = InjectedBundle::shared().page()->page();
@@ -137,19 +161,7 @@ void EventSendingController::mouseDown(int button, JSValueRef modifierArray)
WKBundlePageSimulateMouseDown(page, button, m_position, m_clickCount, modifiers, m_time);
#else
WKRetainPtr<WKStringRef> EventSenderMessageName(AdoptWK, WKStringCreateWithUTF8CString("EventSender"));
- WKRetainPtr<WKMutableDictionaryRef> EventSenderMessageBody(AdoptWK, WKMutableDictionaryCreate());
-
- WKRetainPtr<WKStringRef> subMessageKey(AdoptWK, WKStringCreateWithUTF8CString("SubMessage"));
- WKRetainPtr<WKStringRef> subMessageName(AdoptWK, WKStringCreateWithUTF8CString("MouseDown"));
- WKDictionaryAddItem(EventSenderMessageBody.get(), subMessageKey.get(), subMessageName.get());
-
- WKRetainPtr<WKStringRef> buttonKey = adoptWK(WKStringCreateWithUTF8CString("Button"));
- WKRetainPtr<WKUInt64Ref> buttonRef = adoptWK(WKUInt64Create(button));
- WKDictionaryAddItem(EventSenderMessageBody.get(), buttonKey.get(), buttonRef.get());
-
- WKRetainPtr<WKStringRef> modifiersKey = adoptWK(WKStringCreateWithUTF8CString("Modifiers"));
- WKRetainPtr<WKUInt64Ref> modifiersRef = adoptWK(WKUInt64Create(modifiers));
- WKDictionaryAddItem(EventSenderMessageBody.get(), modifiersKey.get(), modifiersRef.get());
+ WKRetainPtr<WKMutableDictionaryRef> EventSenderMessageBody(AdoptWK, createMouseMessageBody(MouseDown, button, modifiers));
WKBundlePostSynchronousMessage(InjectedBundle::shared().bundle(), EventSenderMessageName.get(), EventSenderMessageBody.get(), 0);
#endif
@@ -167,19 +179,7 @@ void EventSendingController::mouseUp(int button, JSValueRef modifierArray)
WKBundlePageSimulateMouseUp(page, button, m_position, m_clickCount, modifiers, m_time);
#else
WKRetainPtr<WKStringRef> EventSenderMessageName(AdoptWK, WKStringCreateWithUTF8CString("EventSender"));
- WKRetainPtr<WKMutableDictionaryRef> EventSenderMessageBody(AdoptWK, WKMutableDictionaryCreate());
-
- WKRetainPtr<WKStringRef> subMessageKey(AdoptWK, WKStringCreateWithUTF8CString("SubMessage"));
- WKRetainPtr<WKStringRef> subMessageName(AdoptWK, WKStringCreateWithUTF8CString("MouseUp"));
- WKDictionaryAddItem(EventSenderMessageBody.get(), subMessageKey.get(), subMessageName.get());
-
- WKRetainPtr<WKStringRef> buttonKey(AdoptWK, WKStringCreateWithUTF8CString("Button"));
- WKRetainPtr<WKUInt64Ref> buttonRef(AdoptWK, WKUInt64Create(button));
- WKDictionaryAddItem(EventSenderMessageBody.get(), buttonKey.get(), buttonRef.get());
-
- WKRetainPtr<WKStringRef> modifiersKey(AdoptWK, WKStringCreateWithUTF8CString("Modifiers"));
- WKRetainPtr<WKUInt64Ref> modifiersRef(AdoptWK, WKUInt64Create(modifiers));
- WKDictionaryAddItem(EventSenderMessageBody.get(), modifiersKey.get(), modifiersRef.get());
+ WKRetainPtr<WKMutableDictionaryRef> EventSenderMessageBody(AdoptWK, createMouseMessageBody(MouseUp, button, modifiers));
WKBundlePostSynchronousMessage(InjectedBundle::shared().bundle(), EventSenderMessageName.get(), EventSenderMessageBody.get(), 0);
#endif
@@ -231,6 +231,22 @@ void EventSendingController::leapForward(int milliseconds)
#endif
}
+void EventSendingController::scheduleAsynchronousClick()
+{
+ WKEventModifiers modifiers = 0;
+ int button = 0;
+
+ WKRetainPtr<WKStringRef> EventSenderMessageName(AdoptWK, WKStringCreateWithUTF8CString("EventSender"));
+
+ // Asynchronous mouse down.
+ WKRetainPtr<WKMutableDictionaryRef> mouseDownMessageBody(AdoptWK, createMouseMessageBody(MouseDown, button, modifiers));
+ WKBundlePostMessage(InjectedBundle::shared().bundle(), EventSenderMessageName.get(), mouseDownMessageBody.get());
+
+ // Asynchronous mouse up.
+ WKRetainPtr<WKMutableDictionaryRef> mouseUpMessageBody(AdoptWK, createMouseMessageBody(MouseUp, button, modifiers));
+ WKBundlePostMessage(InjectedBundle::shared().bundle(), EventSenderMessageName.get(), mouseUpMessageBody.get());
+}
+
void EventSendingController::keyDown(JSStringRef key, JSValueRef modifierArray, int location)
{
WKBundlePageRef page = InjectedBundle::shared().page()->page();
diff --git a/Tools/WebKitTestRunner/InjectedBundle/EventSendingController.h b/Tools/WebKitTestRunner/InjectedBundle/EventSendingController.h
index 543a42870..413b91cd1 100644
--- a/Tools/WebKitTestRunner/InjectedBundle/EventSendingController.h
+++ b/Tools/WebKitTestRunner/InjectedBundle/EventSendingController.h
@@ -53,6 +53,7 @@ public:
void mouseScrollBy(int x, int y);
void continuousMouseScrollBy(int x, int y, bool paged);
void leapForward(int milliseconds);
+ void scheduleAsynchronousClick();
void keyDown(JSStringRef key, JSValueRef modifierArray, int location);
diff --git a/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp b/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp
index 6c345c575..2b24240ef 100644
--- a/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp
+++ b/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp
@@ -358,4 +358,32 @@ void InjectedBundle::postSimulateWebNotificationClick(uint64_t notificationID)
WKBundlePostMessage(m_bundle, messageName.get(), messageBody.get());
}
+void InjectedBundle::setGeolocationPermission(bool enabled)
+{
+ WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("SetGeolocationPermission"));
+ WKRetainPtr<WKBooleanRef> messageBody(AdoptWK, WKBooleanCreate(enabled));
+ WKBundlePostMessage(m_bundle, messageName.get(), messageBody.get());
+}
+
+void InjectedBundle::setMockGeolocationPosition(double latitude, double longitude, double accuracy)
+{
+ WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("SetMockGeolocationPosition"));
+
+ WKRetainPtr<WKMutableDictionaryRef> messageBody(AdoptWK, WKMutableDictionaryCreate());
+
+ WKRetainPtr<WKStringRef> latitudeKeyWK(AdoptWK, WKStringCreateWithUTF8CString("latitude"));
+ WKRetainPtr<WKDoubleRef> latitudeWK(AdoptWK, WKDoubleCreate(latitude));
+ WKDictionaryAddItem(messageBody.get(), latitudeKeyWK.get(), latitudeWK.get());
+
+ WKRetainPtr<WKStringRef> longitudeKeyWK(AdoptWK, WKStringCreateWithUTF8CString("longitude"));
+ WKRetainPtr<WKDoubleRef> longitudeWK(AdoptWK, WKDoubleCreate(longitude));
+ WKDictionaryAddItem(messageBody.get(), longitudeKeyWK.get(), longitudeWK.get());
+
+ WKRetainPtr<WKStringRef> accuracyKeyWK(AdoptWK, WKStringCreateWithUTF8CString("accuracy"));
+ WKRetainPtr<WKDoubleRef> accuracyWK(AdoptWK, WKDoubleCreate(accuracy));
+ WKDictionaryAddItem(messageBody.get(), accuracyKeyWK.get(), accuracyWK.get());
+
+ WKBundlePostMessage(m_bundle, messageName.get(), messageBody.get());
+}
+
} // namespace WTR
diff --git a/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.h b/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.h
index 7e89ac4bc..673a4be34 100644
--- a/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.h
+++ b/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.h
@@ -90,6 +90,10 @@ public:
void postSetWindowIsKey(bool);
void postSimulateWebNotificationClick(uint64_t notificationID);
+ // Geolocation.
+ void setGeolocationPermission(bool);
+ void setMockGeolocationPosition(double latitude, double longitude, double accuracy);
+
private:
InjectedBundle();
~InjectedBundle();
diff --git a/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp b/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp
index 23c00f9ba..689e381c3 100644
--- a/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp
+++ b/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp
@@ -981,6 +981,11 @@ void InjectedBundlePage::didFailLoadWithErrorForFrame(WKBundleFrameRef frame, WK
if (!InjectedBundle::shared().isTestRunning())
return;
+ if (InjectedBundle::shared().testRunner()->shouldDumpFrameLoadCallbacks()) {
+ dumpFrameDescriptionSuitableForTestResult(frame);
+ InjectedBundle::shared().stringBuilder()->appendLiteral(" - didFailLoadWithError\n");
+ }
+
if (frame != InjectedBundle::shared().topLoadingFrame())
return;
InjectedBundle::shared().setTopLoadingFrame(0);
diff --git a/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp b/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp
index 6197a794f..13c18388b 100644
--- a/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp
+++ b/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp
@@ -393,11 +393,6 @@ void TestRunner::setPluginsEnabled(bool enabled)
WKBundleSetPluginsEnabled(InjectedBundle::shared().bundle(), InjectedBundle::shared().pageGroup(), enabled);
}
-void TestRunner::setGeolocationPermission(bool enabled)
-{
- WKBundleSetGeolocationPermission(InjectedBundle::shared().bundle(), InjectedBundle::shared().pageGroup(), enabled);
-}
-
void TestRunner::setJavaScriptCanAccessClipboard(bool enabled)
{
WKBundleSetJavaScriptCanAccessClipboard(InjectedBundle::shared().bundle(), InjectedBundle::shared().pageGroup(), enabled);
@@ -772,6 +767,17 @@ void TestRunner::simulateWebNotificationClick(JSValueRef notification)
InjectedBundle::shared().postSimulateWebNotificationClick(notificationID);
}
+void TestRunner::setGeolocationPermission(bool enabled)
+{
+ // FIXME: this should be done by frame.
+ InjectedBundle::shared().setGeolocationPermission(enabled);
+}
+
+void TestRunner::setMockGeolocationPosition(double latitude, double longitude, double accuracy)
+{
+ InjectedBundle::shared().setMockGeolocationPosition(latitude, longitude, accuracy);
+}
+
bool TestRunner::callShouldCloseOnWebView()
{
WKBundleFrameRef mainFrame = WKBundlePageGetMainFrame(InjectedBundle::shared().page()->page());
diff --git a/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h b/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h
index 62ac05f3b..6300431ed 100644
--- a/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h
+++ b/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h
@@ -98,7 +98,6 @@ public:
void setAllowFileAccessFromFileURLs(bool);
void setFrameFlatteningEnabled(bool);
void setPluginsEnabled(bool);
- void setGeolocationPermission(bool);
void setJavaScriptCanAccessClipboard(bool);
void setPrivateBrowsingEnabled(bool);
void setPopupBlockingEnabled(bool);
@@ -248,6 +247,10 @@ public:
void removeAllWebNotificationPermissions();
void simulateWebNotificationClick(JSValueRef notification);
+ // Geolocation.
+ void setGeolocationPermission(bool);
+ void setMockGeolocationPosition(double latitude, double longitude, double accuracy);
+
JSRetainPtr<JSStringRef> platformName();
void setPageVisibility(JSStringRef state);
diff --git a/Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityCommonMac.h b/Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityCommonMac.h
new file mode 100644
index 000000000..c8b91257f
--- /dev/null
+++ b/Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityCommonMac.h
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2012 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef AccessibilityCommonMac_h
+#define AccessibilityCommonMac_h
+
+#import <JavaScriptCore/JSStringRef.h>
+
+// If an unsupported attribute is passed in, it will raise an accessibility exception. These are usually caught by the Accessibility Runtime to inform
+// the AX client app of the error. However, DRT is the AX client app, so it must catch these exceptions.
+#define BEGIN_AX_OBJC_EXCEPTIONS @try {
+#define END_AX_OBJC_EXCEPTIONS } @catch(NSException *e) { if (![[e name] isEqualToString:NSAccessibilityException]) @throw; }
+
+
+@interface NSString (JSStringRefAdditions)
++ (NSString *)stringWithJSStringRef:(JSStringRef)jsStringRef;
+- (JSStringRef)createJSStringRef;
+@end
+
+#endif // AccessibilityCommonMac_h
diff --git a/Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityCommonMac.mm b/Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityCommonMac.mm
new file mode 100644
index 000000000..082c0f0cc
--- /dev/null
+++ b/Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityCommonMac.mm
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2012 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "config.h"
+#import "AccessibilityCommonMac.h"
+
+#import <JavaScriptCore/JSStringRefCF.h>
+
+@implementation NSString (JSStringRefAdditions)
+
++ (NSString *)stringWithJSStringRef:(JSStringRef)jsStringRef
+{
+ if (!jsStringRef)
+ return nil;
+
+ CFStringRef cfString = JSStringCopyCFString(kCFAllocatorDefault, jsStringRef);
+ return [(NSString *)cfString autorelease];
+}
+
+- (JSStringRef)createJSStringRef
+{
+ return JSStringCreateWithCFString((CFStringRef)self);
+}
+
+@end
diff --git a/Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityControllerMac.mm b/Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityControllerMac.mm
index 863e7407e..9e54908b9 100644
--- a/Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityControllerMac.mm
+++ b/Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityControllerMac.mm
@@ -29,8 +29,18 @@
*/
#import "config.h"
+#import "AccessibilityCommonMac.h"
#import "AccessibilityController.h"
#import "AccessibilityNotificationHandler.h"
+#import "InjectedBundle.h"
+#import "InjectedBundlePage.h"
+
+#import <JavaScriptCore/JSRetainPtr.h>
+#import <JavaScriptCore/JSStringRef.h>
+#import <JavaScriptCore/JSStringRefCF.h>
+#import <WebKit2/WKBundle.h>
+#import <WebKit2/WKBundlePage.h>
+#import <WebKit2/WKBundlePagePrivate.h>
namespace WTR {
@@ -59,4 +69,35 @@ bool AccessibilityController::removeNotificationListener()
return true;
}
+static id findAccessibleObjectById(id obj, NSString *idAttribute)
+{
+ BEGIN_AX_OBJC_EXCEPTIONS
+ id objIdAttribute = [obj accessibilityAttributeValue:@"AXDRTElementIdAttribute"];
+ if ([objIdAttribute isKindOfClass:[NSString class]] && [objIdAttribute isEqualToString:idAttribute])
+ return obj;
+ END_AX_OBJC_EXCEPTIONS
+
+ NSArray *children = [obj accessibilityAttributeValue:NSAccessibilityChildrenAttribute];
+ NSUInteger childrenCount = [children count];
+ for (NSUInteger i = 0; i < childrenCount; ++i) {
+ id result = findAccessibleObjectById([children objectAtIndex:i], idAttribute);
+ if (result)
+ return result;
+ }
+
+ return 0;
+}
+
+PassRefPtr<AccessibilityUIElement> AccessibilityController::accessibleElementById(JSStringRef idAttribute)
+{
+ WKBundlePageRef page = InjectedBundle::shared().page()->page();
+ id root = static_cast<PlatformUIElement>(WKAccessibilityRootObject(page));
+
+ id result = findAccessibleObjectById(root, [NSString stringWithJSStringRef:idAttribute]);
+ if (result)
+ return AccessibilityUIElement::create(result);
+
+ return 0;
+}
+
} // namespace WTR
diff --git a/Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm b/Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm
index 81a0310b1..24eef0837 100644
--- a/Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm
+++ b/Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm
@@ -24,6 +24,7 @@
*/
#import "config.h"
+#import "AccessibilityCommonMac.h"
#import "AccessibilityNotificationHandler.h"
#import "AccessibilityUIElement.h"
#import "InjectedBundle.h"
@@ -51,12 +52,6 @@
#define NSAccessibilityDropEffectsAttribute @"AXDropEffects"
#endif
-// If an unsupported attribute is passed in, it will raise an accessibility exception. These are usually caught by the Accessibility Runtime to inform
-// the AX client app of the error. However, DRT is the AX client app, so it must catch these exceptions.
-#define BEGIN_AX_OBJC_EXCEPTIONS @try {
-#define END_AX_OBJC_EXCEPTIONS } @catch(NSException *e) { if (![[e name] isEqualToString:NSAccessibilityException]) @throw; }
-
-
typedef void (*AXPostedNotificationCallback)(id element, NSString* notification, void* context);
@interface NSObject (WebKitAccessibilityAdditions)
@@ -65,29 +60,6 @@ typedef void (*AXPostedNotificationCallback)(id element, NSString* notification,
- (NSUInteger)accessibilityArrayAttributeCount:(NSString *)attribute;
@end
-@interface NSString (JSStringRefAdditions)
-+ (NSString *)stringWithJSStringRef:(JSStringRef)jsStringRef;
-- (JSStringRef)createJSStringRef;
-@end
-
-@implementation NSString (JSStringRefAdditions)
-
-+ (NSString *)stringWithJSStringRef:(JSStringRef)jsStringRef
-{
- if (!jsStringRef)
- return NULL;
-
- CFStringRef cfString = JSStringCopyCFString(kCFAllocatorDefault, jsStringRef);
- return [(NSString *)cfString autorelease];
-}
-
-- (JSStringRef)createJSStringRef
-{
- return JSStringCreateWithCFString((CFStringRef)self);
-}
-
-@end
-
namespace WTR {
AccessibilityUIElement::AccessibilityUIElement(PlatformUIElement element)
diff --git a/Tools/WebKitTestRunner/Target.pri b/Tools/WebKitTestRunner/Target.pri
index 93b68f33a..3c47cab38 100644
--- a/Tools/WebKitTestRunner/Target.pri
+++ b/Tools/WebKitTestRunner/Target.pri
@@ -10,6 +10,7 @@ TARGET = WebKitTestRunner
HEADERS += \
$${ROOT_WEBKIT_DIR}/Tools/DumpRenderTree/qt/QtInitializeTestFonts.h \
EventSenderProxy.h \
+ GeolocationProviderMock.h \
PlatformWebView.h \
StringFunctions.h \
TestController.h \
@@ -23,6 +24,7 @@ SOURCES += \
qt/PlatformWebViewQt.cpp \
qt/TestControllerQt.cpp \
qt/TestInvocationQt.cpp \
+ GeolocationProviderMock.cpp \
TestController.cpp \
TestInvocation.cpp \
WebNotificationProvider.cpp
diff --git a/Tools/WebKitTestRunner/TestController.cpp b/Tools/WebKitTestRunner/TestController.cpp
index 3da3880eb..9d63f035e 100644
--- a/Tools/WebKitTestRunner/TestController.cpp
+++ b/Tools/WebKitTestRunner/TestController.cpp
@@ -91,6 +91,7 @@ TestController::TestController(int argc, const char* argv[])
, m_didPrintWebProcessCrashedMessage(false)
, m_shouldExitWhenWebProcessCrashes(true)
, m_beforeUnloadReturnValue(true)
+ , m_isGeolocationPermissionAllowed(false)
#if PLATFORM(MAC) || PLATFORM(QT) || PLATFORM(GTK) || PLATFORM(EFL)
, m_eventSenderProxy(new EventSenderProxy(this))
#endif
@@ -170,6 +171,15 @@ static void unfocus(WKPageRef page, const void* clientInfo)
view->setWindowIsKey(false);
}
+static void decidePolicyForGeolocationPermissionRequest(WKPageRef, WKFrameRef, WKSecurityOriginRef, WKGeolocationPermissionRequestRef permissionRequest, const void* clientInfo)
+{
+ TestController* testController = static_cast<TestController*>(const_cast<void*>(clientInfo));
+ if (testController->isGeolocationPermissionAllowed())
+ WKGeolocationPermissionRequestAllow(permissionRequest);
+ else
+ WKGeolocationPermissionRequestDeny(permissionRequest);
+}
+
WKPageRef TestController::createOtherPage(WKPageRef oldPage, WKURLRequestRef, WKDictionaryRef, WKEventModifiers, WKEventMouseButton, const void*)
{
PlatformWebView* view = new PlatformWebView(WKPageGetContext(oldPage), WKPageGetPageGroup(oldPage));
@@ -209,7 +219,7 @@ WKPageRef TestController::createOtherPage(WKPageRef oldPage, WKURLRequestRef, WK
0, // pageDidScroll
exceededDatabaseQuota,
0, // runOpenPanel
- 0, // decidePolicyForGeolocationPermissionRequest
+ decidePolicyForGeolocationPermissionRequest,
0, // headerHeight
0, // footerHeight
0, // drawHeader
@@ -318,6 +328,7 @@ void TestController::initialize(int argc, const char* argv[])
m_pageGroup.adopt(WKPageGroupCreateWithIdentifier(pageGroupIdentifier.get()));
m_context.adopt(WKContextCreateWithInjectedBundlePath(injectedBundlePath()));
+ m_geolocationProvider = adoptPtr(new GeolocationProviderMock(m_context.get()));
const char* path = libraryPathForTesting();
if (path) {
@@ -379,7 +390,7 @@ void TestController::initialize(int argc, const char* argv[])
0, // pageDidScroll
exceededDatabaseQuota,
0, // runOpenPanel
- 0, // decidePolicyForGeolocationPermissionRequest
+ decidePolicyForGeolocationPermissionRequest,
0, // headerHeight
0, // footerHeight
0, // drawHeader
@@ -691,8 +702,37 @@ void TestController::didReceiveSynchronousMessageFromInjectedBundle(WKContextRef
void TestController::didReceiveMessageFromInjectedBundle(WKStringRef messageName, WKTypeRef messageBody)
{
+#if PLATFORM(MAC) || PLATFORM(QT) || PLATFORM(GTK) || PLATFORM(EFL)
+ if (WKStringIsEqualToUTF8CString(messageName, "EventSender")) {
+ ASSERT(WKGetTypeID(messageBody) == WKDictionaryGetTypeID());
+ WKDictionaryRef messageBodyDictionary = static_cast<WKDictionaryRef>(messageBody);
+
+ WKRetainPtr<WKStringRef> subMessageKey(AdoptWK, WKStringCreateWithUTF8CString("SubMessage"));
+ WKStringRef subMessageName = static_cast<WKStringRef>(WKDictionaryGetItemForKey(messageBodyDictionary, subMessageKey.get()));
+
+ if (WKStringIsEqualToUTF8CString(subMessageName, "MouseDown") || WKStringIsEqualToUTF8CString(subMessageName, "MouseUp")) {
+ WKRetainPtr<WKStringRef> buttonKey = adoptWK(WKStringCreateWithUTF8CString("Button"));
+ unsigned button = static_cast<unsigned>(WKUInt64GetValue(static_cast<WKUInt64Ref>(WKDictionaryGetItemForKey(messageBodyDictionary, buttonKey.get()))));
+
+ WKRetainPtr<WKStringRef> modifiersKey = adoptWK(WKStringCreateWithUTF8CString("Modifiers"));
+ WKEventModifiers modifiers = static_cast<WKEventModifiers>(WKUInt64GetValue(static_cast<WKUInt64Ref>(WKDictionaryGetItemForKey(messageBodyDictionary, modifiersKey.get()))));
+
+ // Forward to WebProcess
+ WKPageSetShouldSendEventsSynchronously(mainWebView()->page(), false);
+ if (WKStringIsEqualToUTF8CString(subMessageName, "MouseDown"))
+ m_eventSenderProxy->mouseDown(button, modifiers);
+ else
+ m_eventSenderProxy->mouseUp(button, modifiers);
+
+ return;
+ }
+ ASSERT_NOT_REACHED();
+ }
+#endif
+
if (!m_currentInvocation)
return;
+
m_currentInvocation->didReceiveMessageFromInjectedBundle(messageName, messageBody);
}
@@ -959,6 +999,11 @@ void TestController::simulateWebNotificationClick(uint64_t notificationID)
m_webNotificationProvider.simulateWebNotificationClick(notificationID);
}
+void TestController::setMockGeolocationPosition(double latitude, double longitude, double accuracy)
+{
+ m_geolocationProvider->setMockGeolocationPosition(latitude, longitude, accuracy);
+}
+
void TestController::decidePolicyForNotificationPermissionRequest(WKPageRef page, WKSecurityOriginRef origin, WKNotificationPermissionRequestRef request, const void* clientInfo)
{
static_cast<TestController*>(const_cast<void*>(clientInfo))->decidePolicyForNotificationPermissionRequest(page, origin, request);
diff --git a/Tools/WebKitTestRunner/TestController.h b/Tools/WebKitTestRunner/TestController.h
index 0d33717b7..8125a3646 100644
--- a/Tools/WebKitTestRunner/TestController.h
+++ b/Tools/WebKitTestRunner/TestController.h
@@ -27,6 +27,7 @@
#define TestController_h
#include "WebNotificationProvider.h"
+#include <GeolocationProviderMock.h>
#include <WebKit2/WKRetainPtr.h>
#include <string>
#include <vector>
@@ -65,6 +66,11 @@ public:
void simulateWebNotificationClick(uint64_t notificationID);
+ // Geolocation.
+ void setGeolocationPermission(bool enabled) { m_isGeolocationPermissionAllowed = enabled; }
+ bool isGeolocationPermissionAllowed() const { return m_isGeolocationPermissionAllowed; }
+ void setMockGeolocationPosition(double latitude, double longitude, double accuracy);
+
bool resetStateToConsistentValues();
private:
@@ -123,6 +129,7 @@ private:
OwnPtr<PlatformWebView> m_mainWebView;
WKRetainPtr<WKContextRef> m_context;
WKRetainPtr<WKPageGroupRef> m_pageGroup;
+ OwnPtr<GeolocationProviderMock> m_geolocationProvider;
enum State {
Initial,
@@ -143,6 +150,8 @@ private:
bool m_beforeUnloadReturnValue;
+ bool m_isGeolocationPermissionAllowed;
+
EventSenderProxy* m_eventSenderProxy;
};
diff --git a/Tools/WebKitTestRunner/TestInvocation.cpp b/Tools/WebKitTestRunner/TestInvocation.cpp
index a54ff678a..449c1b0d3 100644
--- a/Tools/WebKitTestRunner/TestInvocation.cpp
+++ b/Tools/WebKitTestRunner/TestInvocation.cpp
@@ -198,8 +198,10 @@ end:
WKInspectorClose(WKPageGetInspector(TestController::shared().mainWebView()->page()));
#endif // ENABLE(INSPECTOR)
- if (errorMessage || !TestController::shared().resetStateToConsistentValues())
+ if (errorMessage)
dumpWebProcessUnresponsiveness(errorMessage);
+ else if (!TestController::shared().resetStateToConsistentValues())
+ dumpWebProcessUnresponsiveness("Timed out loading about:blank before the next test");
}
void TestInvocation::dumpWebProcessUnresponsiveness(const char* textToStdout)
@@ -346,6 +348,33 @@ void TestInvocation::didReceiveMessageFromInjectedBundle(WKStringRef messageName
return;
}
+ if (WKStringIsEqualToUTF8CString(messageName, "SetGeolocationPermission")) {
+ ASSERT(WKGetTypeID(messageBody) == WKBooleanGetTypeID());
+ WKBooleanRef enabledWK = static_cast<WKBooleanRef>(messageBody);
+ TestController::shared().setGeolocationPermission(WKBooleanGetValue(enabledWK));
+ return;
+ }
+
+ if (WKStringIsEqualToUTF8CString(messageName, "SetMockGeolocationPosition")) {
+ ASSERT(WKGetTypeID(messageBody) == WKDictionaryGetTypeID());
+ WKDictionaryRef messageBodyDictionary = static_cast<WKDictionaryRef>(messageBody);
+
+ WKRetainPtr<WKStringRef> latitudeKeyWK(AdoptWK, WKStringCreateWithUTF8CString("latitude"));
+ WKDoubleRef latitudeWK = static_cast<WKDoubleRef>(WKDictionaryGetItemForKey(messageBodyDictionary, latitudeKeyWK.get()));
+ double latitude = WKDoubleGetValue(latitudeWK);
+
+ WKRetainPtr<WKStringRef> longitudeKeyWK(AdoptWK, WKStringCreateWithUTF8CString("longitude"));
+ WKDoubleRef longitudeWK = static_cast<WKDoubleRef>(WKDictionaryGetItemForKey(messageBodyDictionary, longitudeKeyWK.get()));
+ double longitude = WKDoubleGetValue(longitudeWK);
+
+ WKRetainPtr<WKStringRef> accuracyKeyWK(AdoptWK, WKStringCreateWithUTF8CString("accuracy"));
+ WKDoubleRef accuracyWK = static_cast<WKDoubleRef>(WKDictionaryGetItemForKey(messageBodyDictionary, accuracyKeyWK.get()));
+ double accuracy = WKDoubleGetValue(accuracyWK);
+
+ TestController::shared().setMockGeolocationPosition(latitude, longitude, accuracy);
+ return;
+ }
+
ASSERT_NOT_REACHED();
}
diff --git a/Tools/WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj b/Tools/WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj
index 7cedd0eb2..00a67fb72 100644
--- a/Tools/WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj
+++ b/Tools/WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj
@@ -23,11 +23,13 @@
/* Begin PBXBuildFile section */
0F5169CB1445222D00E0A9D7 /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0F5169CA1445222D00E0A9D7 /* WebKit.framework */; };
0F5169CC1445222D00E0A9D7 /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0F5169CA1445222D00E0A9D7 /* WebKit.framework */; };
+ 26D758E7160BECDD00268472 /* GeolocationProviderMock.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26D758E5160BECDC00268472 /* GeolocationProviderMock.cpp */; };
29210EAE144CACB700835BB5 /* AccessibilityUIElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 29210EA9144CACB200835BB5 /* AccessibilityUIElement.cpp */; };
29210EB0144CACBD00835BB5 /* AccessibilityController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 29210EA2144CAAA500835BB5 /* AccessibilityController.cpp */; };
29210EB4144CACD500835BB5 /* AccessibilityTextMarker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 29210EB1144CACD400835BB5 /* AccessibilityTextMarker.cpp */; };
29210EB5144CACD500835BB5 /* AccessibilityTextMarkerMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 29210EB3144CACD400835BB5 /* AccessibilityTextMarkerMac.mm */; };
29210EDA144CC3EA00835BB5 /* AccessibilityUIElementMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 29210EAB144CACB200835BB5 /* AccessibilityUIElementMac.mm */; };
+ 29210EDA144CC3EA00835BB6 /* AccessibilityCommonMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 29210EAB144CACB200835BB6 /* AccessibilityUIElementMac.mm */; };
29210EDB144CD47900835BB5 /* JSAccessibilityController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 583913D014335E95008307E5 /* JSAccessibilityController.cpp */; };
29210EE1144CDB2600835BB5 /* JSAccessibilityUIElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 29210EDB146727E711835BB5 /* JSAccessibilityUIElement.cpp */; };
29A8FCCB145EF02E009045A6 /* JSAccessibilityTextMarker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 29210EE1144CDE6789815EE5 /* JSAccessibilityTextMarker.cpp */; };
@@ -100,12 +102,15 @@
/* Begin PBXFileReference section */
0F5169CA1445222D00E0A9D7 /* WebKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = WebKit.framework; sourceTree = BUILT_PRODUCTS_DIR; };
+ 26D758E5160BECDC00268472 /* GeolocationProviderMock.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GeolocationProviderMock.cpp; sourceTree = "<group>"; };
+ 26D758E6160BECDD00268472 /* GeolocationProviderMock.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GeolocationProviderMock.h; sourceTree = "<group>"; };
29210EA2144CAAA500835BB5 /* AccessibilityController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AccessibilityController.cpp; sourceTree = "<group>"; };
29210EA3144CAAA500835BB5 /* AccessibilityController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AccessibilityController.h; sourceTree = "<group>"; };
29210EA8144CAB8800835BB5 /* AccessibilityController.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = AccessibilityController.idl; sourceTree = "<group>"; };
29210EA9144CACB200835BB5 /* AccessibilityUIElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AccessibilityUIElement.cpp; sourceTree = "<group>"; };
29210EAA144CACB200835BB5 /* AccessibilityUIElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AccessibilityUIElement.h; sourceTree = "<group>"; };
29210EAB144CACB200835BB5 /* AccessibilityUIElementMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = AccessibilityUIElementMac.mm; path = mac/AccessibilityUIElementMac.mm; sourceTree = "<group>"; };
+ 29210EAB144CACB200835BB6 /* AccessibilityCommonMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = AccessibilityCommonMac.mm; path = mac/AccessibilityCommonMac.mm; sourceTree = "<group>"; };
29210EB1144CACD400835BB5 /* AccessibilityTextMarker.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AccessibilityTextMarker.cpp; sourceTree = "<group>"; };
29210EB2144CACD400835BB5 /* AccessibilityTextMarker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AccessibilityTextMarker.h; sourceTree = "<group>"; };
29210EB3144CACD400835BB5 /* AccessibilityTextMarkerMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = AccessibilityTextMarkerMac.mm; path = mac/AccessibilityTextMarkerMac.mm; sourceTree = "<group>"; };
@@ -255,6 +260,8 @@
5322FB4113FDA0CD0041ABCC /* CyclicRedundancyCheck.cpp */,
5322FB4213FDA0CD0041ABCC /* CyclicRedundancyCheck.h */,
5670B8261386FC13002EB355 /* EventSenderProxy.h */,
+ 26D758E5160BECDC00268472 /* GeolocationProviderMock.cpp */,
+ 26D758E6160BECDD00268472 /* GeolocationProviderMock.h */,
5322FB4413FDA0EA0041ABCC /* PixelDumpSupport.cpp */,
5322FB4513FDA0EA0041ABCC /* PixelDumpSupport.h */,
BC7934DD119066EC005EA8E2 /* PlatformWebView.h */,
@@ -302,6 +309,7 @@
29210EA9144CACB200835BB5 /* AccessibilityUIElement.cpp */,
29210EAA144CACB200835BB5 /* AccessibilityUIElement.h */,
29210EAB144CACB200835BB5 /* AccessibilityUIElementMac.mm */,
+ 29210EAB144CACB200835BB6 /* AccessibilityCommonMac.mm */,
29210EB1144CACD400835BB5 /* AccessibilityTextMarker.cpp */,
29210EB2144CACD400835BB5 /* AccessibilityTextMarker.h */,
29210EB3144CACD400835BB5 /* AccessibilityTextMarkerMac.mm */,
@@ -565,6 +573,7 @@
files = (
BC793400118F7C84005EA8E2 /* main.mm in Sources */,
5322FB4313FDA0CD0041ABCC /* CyclicRedundancyCheck.cpp in Sources */,
+ 26D758E7160BECDD00268472 /* GeolocationProviderMock.cpp in Sources */,
5322FB4613FDA0EA0041ABCC /* PixelDumpSupport.cpp in Sources */,
BC7934E811906846005EA8E2 /* PlatformWebViewMac.mm in Sources */,
BC793431118F7F19005EA8E2 /* TestController.cpp in Sources */,
@@ -600,6 +609,7 @@
29210EB4144CACD500835BB5 /* AccessibilityTextMarker.cpp in Sources */,
29210EB5144CACD500835BB5 /* AccessibilityTextMarkerMac.mm in Sources */,
29210EDA144CC3EA00835BB5 /* AccessibilityUIElementMac.mm in Sources */,
+ 29210EDA144CC3EA00835BB6 /* AccessibilityCommonMac.mm in Sources */,
29210EDB144CD47900835BB5 /* JSAccessibilityController.cpp in Sources */,
29210EE1144CDB2600835BB5 /* JSAccessibilityUIElement.cpp in Sources */,
29A8FCCB145EF02E009045A6 /* JSAccessibilityTextMarker.cpp in Sources */,
diff --git a/Tools/WebKitTestRunner/efl/EventSenderProxyEfl.cpp b/Tools/WebKitTestRunner/efl/EventSenderProxyEfl.cpp
index 048c0a6aa..0c732100e 100644
--- a/Tools/WebKitTestRunner/efl/EventSenderProxyEfl.cpp
+++ b/Tools/WebKitTestRunner/efl/EventSenderProxyEfl.cpp
@@ -411,9 +411,23 @@ void EventSenderProxy::keyDown(WKStringRef keyRef, WKEventModifiers wkModifiers,
wkModifiers |= kWKEventModifiersShiftKey;
Evas* evas = ecore_evas_get(m_testController->mainWebView()->platformWindow());
+
+ int eventIndex = 0;
+ // Mimic the emacs ctrl-o binding by inserting a paragraph
+ // separator and then putting the cursor back to its original
+ // position. Allows us to pass emacs-ctrl-o.html
+ if ((wkModifiers & kWKEventModifiersControlKey) && !strcmp(keyName, "o")) {
+ setEvasModifiers(evas, 0);
+ evas_event_feed_key_down(evas, "Return", "Return", "\r", 0, eventIndex++, 0);
+ evas_event_feed_key_up(evas, "Return", "Return", "\r", 0, eventIndex++, 0);
+ wkModifiers = 0;
+ keyName = "Left";
+ keyString = 0;
+ }
+
setEvasModifiers(evas, wkModifiers);
- evas_event_feed_key_down(evas, keyName, keyName, keyString, 0, 0, 0);
- evas_event_feed_key_up(evas, keyName, keyName, keyString, 0, 1, 0);
+ evas_event_feed_key_down(evas, keyName, keyName, keyString, 0, eventIndex++, 0);
+ evas_event_feed_key_up(evas, keyName, keyName, keyString, 0, eventIndex++, 0);
setEvasModifiers(evas, 0);
}
diff --git a/Tools/WebKitTestRunner/gtk/PlatformWebViewGtk.cpp b/Tools/WebKitTestRunner/gtk/PlatformWebViewGtk.cpp
index afe4a569c..f1615d4ac 100644
--- a/Tools/WebKitTestRunner/gtk/PlatformWebViewGtk.cpp
+++ b/Tools/WebKitTestRunner/gtk/PlatformWebViewGtk.cpp
@@ -28,6 +28,7 @@
#include "config.h"
#include "PlatformWebView.h"
+#include <WebKit2/WKViewPrivate.h>
#include <gtk/gtk.h>
namespace WTR {
@@ -70,6 +71,8 @@ WKPageRef PlatformWebView::page()
void PlatformWebView::focus()
{
+ WKViewSetFocus(m_view, true);
+ setWindowIsKey(true);
}
WKRect PlatformWebView::windowFrame()
diff --git a/Tools/WebKitTestRunner/qt/EventSenderProxyQt.cpp b/Tools/WebKitTestRunner/qt/EventSenderProxyQt.cpp
index 27bcca4df..5d4de9d20 100644
--- a/Tools/WebKitTestRunner/qt/EventSenderProxyQt.cpp
+++ b/Tools/WebKitTestRunner/qt/EventSenderProxyQt.cpp
@@ -188,10 +188,6 @@ void EventSenderProxy::keyDown(WKStringRef keyRef, WKEventModifiers modifiersRef
code = Qt::Key_PageDown;
modifiers &= ~Qt::MetaModifier;
}
- } else if (code == 'a' && modifiers == Qt::ControlModifier) {
- keyText = QString();
- code = Qt::Key_Home;
- modifiers = 0;
} else
code = key.unicode()->toUpper().unicode();
} else {
diff --git a/Tools/WebKitTestRunner/win/WebKitTestRunner.vcproj b/Tools/WebKitTestRunner/win/WebKitTestRunner.vcproj
index 27506886a..71690111c 100644
--- a/Tools/WebKitTestRunner/win/WebKitTestRunner.vcproj
+++ b/Tools/WebKitTestRunner/win/WebKitTestRunner.vcproj
@@ -479,6 +479,14 @@
>
</File>
<File
+ RelativePath="..\GeolocationProviderMock.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\GeolocationProviderMock.h"
+ >
+ </File>
+ <File
RelativePath="..\PixelDumpSupport.cpp"
>
</File>