Diff
Modified: trunk/LayoutTests/ChangeLog (129535 => 129536)
--- trunk/LayoutTests/ChangeLog 2012-09-25 18:59:58 UTC (rev 129535)
+++ trunk/LayoutTests/ChangeLog 2012-09-25 19:06:41 UTC (rev 129536)
@@ -1,3 +1,14 @@
+2012-09-25 Benjamin Poulain <[email protected]>
+
+ Add missing support for Geolocation tests on WebKit2
+ https://bugs.webkit.org/show_bug.cgi?id=97518
+
+ Reviewed by Sam Weinig.
+
+ Unskip almost all the layout tests.
+
+ * platform/wk2/Skipped:
+
2012-09-25 Akash Vaswani <[email protected]>
Crash after clicking in plugin at kauaiexplorer.com
Modified: trunk/LayoutTests/platform/wk2/Skipped (129535 => 129536)
--- trunk/LayoutTests/platform/wk2/Skipped 2012-09-25 18:59:58 UTC (rev 129535)
+++ trunk/LayoutTests/platform/wk2/Skipped 2012-09-25 19:06:41 UTC (rev 129536)
@@ -292,17 +292,7 @@
platform/mac/editing/deleting/deletionUI-minimum-size.html
platform/mac/editing/deleting/deletionUI-successful-deletion.html
-# Geolocation Tests for which WebKitTestRunner still misses support.
-fast/dom/Geolocation/delayed-permission-allowed-for-multiple-requests.html
-fast/dom/Geolocation/delayed-permission-allowed.html
-fast/dom/Geolocation/delayed-permission-denied-for-multiple-requests.html
-fast/dom/Geolocation/delayed-permission-denied.html
-fast/dom/Geolocation/error-clear-watch.html
-fast/dom/Geolocation/error.html
-fast/dom/Geolocation/maximum-age.html
-fast/dom/Geolocation/permission-denied-already-error.html
-fast/dom/Geolocation/reentrant-error.html
-fast/dom/Geolocation/watch.html
+# Fail on WebKit2, the test crash.
fast/dom/Geolocation/window-close-crash.html
# WebKitTestRunner needs layoutTestController.setDashboardCompatibilityMode
@@ -560,7 +550,6 @@
# https://bugs.webkit.org/show_bug.cgi?id=94554
inspector/geolocation-error.html
inspector/geolocation-success.html
-inspector/geolocation-watchPosition.html
# WebFrameLoaderClient::dispatchDecidePolicy methods should consider
# 'WKBundlePagePolicyActionPassThrough' policy action
@@ -953,8 +942,6 @@
fast/forms/input-align.html
# WebProcess sometimes terminates when running these tests
-fast/dom/Geolocation/notimer-after-unload.html
-fast/dom/Geolocation/remove-remote-context-in-error-callback-crash.html
fast/forms/form-associated-element-crash.html
# New history tests added in r76205 fail on WebKit2 (perhaps the change
Modified: trunk/Source/WebKit2/ChangeLog (129535 => 129536)
--- trunk/Source/WebKit2/ChangeLog 2012-09-25 18:59:58 UTC (rev 129535)
+++ trunk/Source/WebKit2/ChangeLog 2012-09-25 19:06:41 UTC (rev 129536)
@@ -1,3 +1,30 @@
+2012-09-25 Benjamin Poulain <[email protected]>
+
+ Add missing support for Geolocation tests on WebKit2
+ https://bugs.webkit.org/show_bug.cgi?id=97518
+
+ Reviewed by Sam Weinig.
+
+ The existing API for reporting error does not support passing and error message.
+
+ The interface UIProcess<->WebProcess is changed to take an error message, the
+ existing API now pass a null String, and the new function
+ WKGeolocationManagerProviderDidFailToDeterminePositionWithErrorMessage() provide
+ the extended support with error message.
+
+ * UIProcess/API/C/WKGeolocationManager.cpp:
+ (WKGeolocationManagerProviderDidFailToDeterminePositionWithErrorMessage):
+ * UIProcess/API/C/WKGeolocationManager.h:
+ * UIProcess/WebGeolocationManagerProxy.cpp:
+ (WebKit::WebGeolocationManagerProxy::providerDidFailToDeterminePosition):
+ * UIProcess/WebGeolocationManagerProxy.h:
+ (WebGeolocationManagerProxy):
+ * WebProcess/Geolocation/WebGeolocationManager.cpp:
+ (WebKit::WebGeolocationManager::didFailToDeterminePosition):
+ * WebProcess/Geolocation/WebGeolocationManager.h:
+ (WebGeolocationManager):
+ * WebProcess/Geolocation/WebGeolocationManager.messages.in:
+
2012-09-25 Akash Vaswani <[email protected]>
Crash after clicking in plugin at kauaiexplorer.com
Modified: trunk/Source/WebKit2/UIProcess/API/C/WKGeolocationManager.cpp (129535 => 129536)
--- trunk/Source/WebKit2/UIProcess/API/C/WKGeolocationManager.cpp 2012-09-25 18:59:58 UTC (rev 129535)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKGeolocationManager.cpp 2012-09-25 19:06:41 UTC (rev 129536)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 Apple Inc. All rights reserved.
+ * Copyright (C) 2011, 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
@@ -50,3 +50,8 @@
{
toImpl(geolocationManagerRef)->providerDidFailToDeterminePosition();
}
+
+void WKGeolocationManagerProviderDidFailToDeterminePositionWithErrorMessage(WKGeolocationManagerRef geolocationManagerRef, WKStringRef errorMessage)
+{
+ toImpl(geolocationManagerRef)->providerDidFailToDeterminePosition(toWTFString(errorMessage));
+}
Modified: trunk/Source/WebKit2/UIProcess/API/C/WKGeolocationManager.h (129535 => 129536)
--- trunk/Source/WebKit2/UIProcess/API/C/WKGeolocationManager.h 2012-09-25 18:59:58 UTC (rev 129535)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKGeolocationManager.h 2012-09-25 19:06:41 UTC (rev 129536)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 Apple Inc. All rights reserved.
+ * Copyright (C) 2011, 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
@@ -53,6 +53,8 @@
WK_EXPORT void WKGeolocationManagerProviderDidChangePosition(WKGeolocationManagerRef geolocationManager, WKGeolocationPositionRef position);
WK_EXPORT void WKGeolocationManagerProviderDidFailToDeterminePosition(WKGeolocationManagerRef geolocationManager);
+WK_EXPORT void WKGeolocationManagerProviderDidFailToDeterminePositionWithErrorMessage(WKGeolocationManagerRef geolocationManager, WKStringRef errorMessage);
+
#ifdef __cplusplus
}
#endif
Modified: trunk/Source/WebKit2/UIProcess/WebGeolocationManagerProxy.cpp (129535 => 129536)
--- trunk/Source/WebKit2/UIProcess/WebGeolocationManagerProxy.cpp 2012-09-25 18:59:58 UTC (rev 129535)
+++ trunk/Source/WebKit2/UIProcess/WebGeolocationManagerProxy.cpp 2012-09-25 19:06:41 UTC (rev 129536)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 Apple Inc. All rights reserved.
+ * Copyright (C) 2011, 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
@@ -64,12 +64,12 @@
m_context->sendToAllProcesses(Messages::WebGeolocationManager::DidChangePosition(position->data()));
}
-void WebGeolocationManagerProxy::providerDidFailToDeterminePosition()
+void WebGeolocationManagerProxy::providerDidFailToDeterminePosition(const String& errorMessage)
{
if (!m_context)
return;
- m_context->sendToAllProcesses(Messages::WebGeolocationManager::DidFailToDeterminePosition());
+ m_context->sendToAllProcesses(Messages::WebGeolocationManager::DidFailToDeterminePosition(errorMessage));
}
void WebGeolocationManagerProxy::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments)
Modified: trunk/Source/WebKit2/UIProcess/WebGeolocationManagerProxy.h (129535 => 129536)
--- trunk/Source/WebKit2/UIProcess/WebGeolocationManagerProxy.h 2012-09-25 18:59:58 UTC (rev 129535)
+++ trunk/Source/WebKit2/UIProcess/WebGeolocationManagerProxy.h 2012-09-25 19:06:41 UTC (rev 129536)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 Apple Inc. All rights reserved.
+ * Copyright (C) 2011, 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
@@ -29,6 +29,7 @@
#include "APIObject.h"
#include "MessageID.h"
#include "WebGeolocationProvider.h"
+#include <wtf/text/WTFString.h>
namespace CoreIPC {
class ArgumentDecoder;
@@ -53,7 +54,7 @@
void initializeProvider(const WKGeolocationProvider*);
void providerDidChangePosition(WebGeolocationPosition*);
- void providerDidFailToDeterminePosition();
+ void providerDidFailToDeterminePosition(const String& errorMessage = String());
void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
Modified: trunk/Source/WebKit2/WebProcess/Geolocation/WebGeolocationManager.cpp (129535 => 129536)
--- trunk/Source/WebKit2/WebProcess/Geolocation/WebGeolocationManager.cpp 2012-09-25 18:59:58 UTC (rev 129535)
+++ trunk/Source/WebKit2/WebProcess/Geolocation/WebGeolocationManager.cpp 2012-09-25 19:06:41 UTC (rev 129536)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 Apple Inc. All rights reserved.
+ * Copyright (C) 2011, 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
@@ -88,11 +88,11 @@
#endif // ENABLE(GEOLOCATION)
}
-void WebGeolocationManager::didFailToDeterminePosition()
+void WebGeolocationManager::didFailToDeterminePosition(const String& errorMessage)
{
#if ENABLE(GEOLOCATION)
// FIXME: Add localized error string.
- RefPtr<GeolocationError> error = GeolocationError::create(GeolocationError::PositionUnavailable, /* Localized error string */ String(""));
+ RefPtr<GeolocationError> error = GeolocationError::create(GeolocationError::PositionUnavailable, errorMessage);
Vector<RefPtr<WebPage> > webPageCopy;
copyToVector(m_pageSet, webPageCopy);
@@ -101,6 +101,8 @@
if (page->corePage())
GeolocationController::from(page->corePage())->errorOccurred(error.get());
}
+#else
+ UNUSED_PARAM(errorMessage);
#endif // ENABLE(GEOLOCATION)
}
Modified: trunk/Source/WebKit2/WebProcess/Geolocation/WebGeolocationManager.h (129535 => 129536)
--- trunk/Source/WebKit2/WebProcess/Geolocation/WebGeolocationManager.h 2012-09-25 18:59:58 UTC (rev 129535)
+++ trunk/Source/WebKit2/WebProcess/Geolocation/WebGeolocationManager.h 2012-09-25 19:06:41 UTC (rev 129536)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 Apple Inc. All rights reserved.
+ * Copyright (C) 2011, 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
@@ -41,6 +41,10 @@
class Geolocation;
}
+namespace WTF {
+class String;
+}
+
namespace WebKit {
class WebProcess;
@@ -64,7 +68,7 @@
void didReceiveWebGeolocationManagerMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
void didChangePosition(const WebGeolocationPosition::Data&);
- void didFailToDeterminePosition();
+ void didFailToDeterminePosition(const WTF::String& errorMessage);
WebProcess* m_process;
HashSet<WebPage*> m_pageSet;
Modified: trunk/Source/WebKit2/WebProcess/Geolocation/WebGeolocationManager.messages.in (129535 => 129536)
--- trunk/Source/WebKit2/WebProcess/Geolocation/WebGeolocationManager.messages.in 2012-09-25 18:59:58 UTC (rev 129535)
+++ trunk/Source/WebKit2/WebProcess/Geolocation/WebGeolocationManager.messages.in 2012-09-25 19:06:41 UTC (rev 129536)
@@ -22,5 +22,5 @@
messages -> WebGeolocationManager {
DidChangePosition(WebKit::WebGeolocationPosition::Data position);
- DidFailToDeterminePosition();
+ DidFailToDeterminePosition(WTF::String errorMessage);
}
Modified: trunk/Tools/ChangeLog (129535 => 129536)
--- trunk/Tools/ChangeLog 2012-09-25 18:59:58 UTC (rev 129535)
+++ trunk/Tools/ChangeLog 2012-09-25 19:06:41 UTC (rev 129536)
@@ -1,3 +1,46 @@
+2012-09-25 Benjamin Poulain <[email protected]>
+
+ Add missing support for Geolocation tests on WebKit2
+ https://bugs.webkit.org/show_bug.cgi?id=97518
+
+ Reviewed by Sam Weinig.
+
+ There are two main features added to the tooling to make the test run:
+ -Add support for error reporting for position errors through setMockGeolocationPositionUnavailableError.
+ -Support the 3 states permission: undefined-allowed-denied.
+
+ * WebKitTestRunner/GeolocationProviderMock.cpp:
+ (WTR::GeolocationProviderMock::GeolocationProviderMock):
+ (WTR::GeolocationProviderMock::setPosition):
+ (WTR::GeolocationProviderMock::setPositionUnavailableError):
+ (WTR::GeolocationProviderMock::startUpdating):
+ (WTR::GeolocationProviderMock::sendPositionIfNeeded):
+ (WTR::GeolocationProviderMock::sendErrorIfNeeded):
+ * WebKitTestRunner/GeolocationProviderMock.h:
+ (GeolocationProviderMock):
+ * WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
+ * WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
+ (WTR::InjectedBundle::setMockGeolocationPositionUnavailableError):
+ * WebKitTestRunner/InjectedBundle/InjectedBundle.h:
+ (InjectedBundle):
+ * WebKitTestRunner/InjectedBundle/TestRunner.cpp:
+ (WTR::TestRunner::setMockGeolocationPositionUnavailableError):
+ * WebKitTestRunner/InjectedBundle/TestRunner.h:
+ (TestRunner):
+ * WebKitTestRunner/TestController.cpp:
+ (WTR::TestController::TestController):
+ (WTR::decidePolicyForGeolocationPermissionRequest):
+ (WTR::TestController::resetStateToConsistentValues):
+ (WTR::TestController::setGeolocationPermission):
+ (WTR::TestController::setMockGeolocationPosition):
+ (WTR::TestController::setMockGeolocationPositionUnavailableError):
+ (WTR::TestController::handleGeolocationPermissionRequest):
+ (WTR::TestController::decidePolicyForGeolocationPermissionRequestIfPossible):
+ * WebKitTestRunner/TestController.h:
+ (TestController):
+ * WebKitTestRunner/TestInvocation.cpp:
+ (WTR::TestInvocation::didReceiveMessageFromInjectedBundle):
+
2012-09-25 Sheriff Bot <[email protected]>
Unreviewed, rolling out r129517.
Modified: trunk/Tools/WebKitTestRunner/GeolocationProviderMock.cpp (129535 => 129536)
--- trunk/Tools/WebKitTestRunner/GeolocationProviderMock.cpp 2012-09-25 18:59:58 UTC (rev 129535)
+++ trunk/Tools/WebKitTestRunner/GeolocationProviderMock.cpp 2012-09-25 19:06:41 UTC (rev 129536)
@@ -46,6 +46,7 @@
GeolocationProviderMock::GeolocationProviderMock(WKContextRef context)
: m_isActive(false)
+ , m_hasError(false)
{
m_geolocationManager = WKContextGetGeolocationManager(context);
@@ -57,20 +58,26 @@
WKGeolocationManagerSetProvider(m_geolocationManager, &providerCallback);
}
-void GeolocationProviderMock::setMockGeolocationPosition(double latitude, double longitude, double accuracy)
+void GeolocationProviderMock::setPosition(double latitude, double longitude, double accuracy)
{
m_position.adopt(WKGeolocationPositionCreate(currentTime(), latitude, longitude, accuracy));
- if (m_isActive)
- WKGeolocationManagerProviderDidChangePosition(m_geolocationManager, m_position.get());
+ sendPositionIfNeeded();
}
+void GeolocationProviderMock::setPositionUnavailableError(WKStringRef errorMessage)
+{
+ m_errorMessage = errorMessage;
+ m_hasError = true;
+ sendErrorIfNeeded();
+}
+
void GeolocationProviderMock::startUpdating(WKGeolocationManagerRef geolocationManager)
{
ASSERT_UNUSED(geolocationManager, geolocationManager == m_geolocationManager);
m_isActive = true;
- if (m_position)
- WKGeolocationManagerProviderDidChangePosition(m_geolocationManager, m_position.get());
+ sendPositionIfNeeded();
+ sendErrorIfNeeded();
}
void GeolocationProviderMock::stopUpdating(WKGeolocationManagerRef geolocationManager)
@@ -80,4 +87,21 @@
m_isActive = false;
}
+void GeolocationProviderMock::sendPositionIfNeeded()
+{
+ if (m_isActive && m_position) {
+ WKGeolocationManagerProviderDidChangePosition(m_geolocationManager, m_position.get());
+ m_position.clear();
+ }
+}
+
+void GeolocationProviderMock::sendErrorIfNeeded()
+{
+ if (m_isActive && m_hasError) {
+ m_hasError = false;
+ WKGeolocationManagerProviderDidFailToDeterminePositionWithErrorMessage(m_geolocationManager, m_errorMessage.get());
+ m_errorMessage.clear();
+ }
+}
+
} // namespace WTR
Modified: trunk/Tools/WebKitTestRunner/GeolocationProviderMock.h (129535 => 129536)
--- trunk/Tools/WebKitTestRunner/GeolocationProviderMock.h 2012-09-25 18:59:58 UTC (rev 129535)
+++ trunk/Tools/WebKitTestRunner/GeolocationProviderMock.h 2012-09-25 19:06:41 UTC (rev 129536)
@@ -34,16 +34,23 @@
public:
GeolocationProviderMock(WKContextRef);
- void setMockGeolocationPosition(double latitude, double longitude, double accuracy);
+ void setPosition(double latitude, double longitude, double accuracy);
+ void setPositionUnavailableError(WKStringRef errorMessage);
void startUpdating(WKGeolocationManagerRef);
void stopUpdating(WKGeolocationManagerRef);
private:
+ void sendPositionIfNeeded();
+ void sendErrorIfNeeded();
+
WKGeolocationManagerRef m_geolocationManager;
bool m_isActive;
WKRetainPtr<WKGeolocationPositionRef> m_position;
+
+ bool m_hasError;
+ WKRetainPtr<WKStringRef> m_errorMessage;
};
} // namespace WTR
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl (129535 => 129536)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl 2012-09-25 18:59:58 UTC (rev 129535)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl 2012-09-25 19:06:41 UTC (rev 129536)
@@ -181,6 +181,7 @@
// Geolocation
void setGeolocationPermission(in boolean value);
void setMockGeolocationPosition(in double latitude, in double longitude, in double accuracy);
+ void setMockGeolocationPositionUnavailableError(in DOMString errorMessage);
boolean callShouldCloseOnWebView();
};
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp (129535 => 129536)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp 2012-09-25 18:59:58 UTC (rev 129535)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp 2012-09-25 19:06:41 UTC (rev 129536)
@@ -386,4 +386,10 @@
WKBundlePostMessage(m_bundle, messageName.get(), messageBody.get());
}
+void InjectedBundle::setMockGeolocationPositionUnavailableError(WKStringRef errorMessage)
+{
+ WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("SetMockGeolocationPositionUnavailableError"));
+ WKBundlePostMessage(m_bundle, messageName.get(), errorMessage);
+}
+
} // namespace WTR
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.h (129535 => 129536)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.h 2012-09-25 18:59:58 UTC (rev 129535)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.h 2012-09-25 19:06:41 UTC (rev 129536)
@@ -93,6 +93,7 @@
// Geolocation.
void setGeolocationPermission(bool);
void setMockGeolocationPosition(double latitude, double longitude, double accuracy);
+ void setMockGeolocationPositionUnavailableError(WKStringRef errorMessage);
private:
InjectedBundle();
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp (129535 => 129536)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp 2012-09-25 18:59:58 UTC (rev 129535)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp 2012-09-25 19:06:41 UTC (rev 129536)
@@ -785,6 +785,12 @@
InjectedBundle::shared().setMockGeolocationPosition(latitude, longitude, accuracy);
}
+void TestRunner::setMockGeolocationPositionUnavailableError(JSStringRef message)
+{
+ WKRetainPtr<WKStringRef> messageWK = toWK(message);
+ InjectedBundle::shared().setMockGeolocationPositionUnavailableError(messageWK.get());
+}
+
bool TestRunner::callShouldCloseOnWebView()
{
WKBundleFrameRef mainFrame = WKBundlePageGetMainFrame(InjectedBundle::shared().page()->page());
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h (129535 => 129536)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h 2012-09-25 18:59:58 UTC (rev 129535)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h 2012-09-25 19:06:41 UTC (rev 129536)
@@ -252,6 +252,7 @@
// Geolocation.
void setGeolocationPermission(bool);
void setMockGeolocationPosition(double latitude, double longitude, double accuracy);
+ void setMockGeolocationPositionUnavailableError(JSStringRef message);
JSRetainPtr<JSStringRef> platformName();
Modified: trunk/Tools/WebKitTestRunner/TestController.cpp (129535 => 129536)
--- trunk/Tools/WebKitTestRunner/TestController.cpp 2012-09-25 18:59:58 UTC (rev 129535)
+++ trunk/Tools/WebKitTestRunner/TestController.cpp 2012-09-25 19:06:41 UTC (rev 129536)
@@ -91,6 +91,7 @@
, m_didPrintWebProcessCrashedMessage(false)
, m_shouldExitWhenWebProcessCrashes(true)
, m_beforeUnloadReturnValue(true)
+ , m_isGeolocationPermissionSet(false)
, m_isGeolocationPermissionAllowed(false)
#if PLATFORM(MAC) || PLATFORM(QT) || PLATFORM(GTK) || PLATFORM(EFL)
, m_eventSenderProxy(new EventSenderProxy(this))
@@ -174,10 +175,7 @@
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);
+ testController->handleGeolocationPermissionRequest(permissionRequest);
}
WKPageRef TestController::createOtherPage(WKPageRef oldPage, WKURLRequestRef, WKDictionaryRef, WKEventModifiers, WKEventMouseButton, const void*)
@@ -528,6 +526,11 @@
// Reset notification permissions
m_webNotificationProvider.reset();
+ // Reset Geolocation permissions.
+ m_geolocationPermissionRequests.clear();
+ m_isGeolocationPermissionSet = false;
+ m_isGeolocationPermissionAllowed = false;
+
// Reset main page back to about:blank
m_doneResetting = false;
@@ -999,11 +1002,43 @@
m_webNotificationProvider.simulateWebNotificationClick(notificationID);
}
+void TestController::setGeolocationPermission(bool enabled)
+{
+ m_isGeolocationPermissionSet = true;
+ m_isGeolocationPermissionAllowed = enabled;
+ decidePolicyForGeolocationPermissionRequestIfPossible();
+}
+
void TestController::setMockGeolocationPosition(double latitude, double longitude, double accuracy)
{
- m_geolocationProvider->setMockGeolocationPosition(latitude, longitude, accuracy);
+ m_geolocationProvider->setPosition(latitude, longitude, accuracy);
}
+void TestController::setMockGeolocationPositionUnavailableError(WKStringRef errorMessage)
+{
+ m_geolocationProvider->setPositionUnavailableError(errorMessage);
+}
+
+void TestController::handleGeolocationPermissionRequest(WKGeolocationPermissionRequestRef geolocationPermissionRequest)
+{
+ m_geolocationPermissionRequests.append(geolocationPermissionRequest);
+ decidePolicyForGeolocationPermissionRequestIfPossible();
+}
+
+void TestController::decidePolicyForGeolocationPermissionRequestIfPossible()
+{
+ if (!m_isGeolocationPermissionSet)
+ return;
+
+ for (size_t i = 0; i < m_geolocationPermissionRequests.size(); ++i) {
+ WKGeolocationPermissionRequestRef& permissionRequest = m_geolocationPermissionRequests[i];
+ if (m_isGeolocationPermissionAllowed)
+ WKGeolocationPermissionRequestAllow(permissionRequest);
+ else
+ WKGeolocationPermissionRequestDeny(permissionRequest);
+ }
+}
+
void TestController::decidePolicyForNotificationPermissionRequest(WKPageRef page, WKSecurityOriginRef origin, WKNotificationPermissionRequestRef request, const void* clientInfo)
{
static_cast<TestController*>(const_cast<void*>(clientInfo))->decidePolicyForNotificationPermissionRequest(page, origin, request);
Modified: trunk/Tools/WebKitTestRunner/TestController.h (129535 => 129536)
--- trunk/Tools/WebKitTestRunner/TestController.h 2012-09-25 18:59:58 UTC (rev 129535)
+++ trunk/Tools/WebKitTestRunner/TestController.h 2012-09-25 19:06:41 UTC (rev 129536)
@@ -32,6 +32,7 @@
#include <string>
#include <vector>
#include <wtf/OwnPtr.h>
+#include <wtf/Vector.h>
namespace WTR {
@@ -67,9 +68,10 @@
void simulateWebNotificationClick(uint64_t notificationID);
// Geolocation.
- void setGeolocationPermission(bool enabled) { m_isGeolocationPermissionAllowed = enabled; }
- bool isGeolocationPermissionAllowed() const { return m_isGeolocationPermissionAllowed; }
+ void setGeolocationPermission(bool);
void setMockGeolocationPosition(double latitude, double longitude, double accuracy);
+ void setMockGeolocationPositionUnavailableError(WKStringRef errorMessage);
+ void handleGeolocationPermissionRequest(WKGeolocationPermissionRequestRef);
bool resetStateToConsistentValues();
@@ -87,6 +89,8 @@
void initializeInjectedBundlePath();
void initializeTestPluginDirectory();
+ void decidePolicyForGeolocationPermissionRequestIfPossible();
+
// WKContextInjectedBundleClient
static void didReceiveMessageFromInjectedBundle(WKContextRef, WKStringRef messageName, WKTypeRef messageBody, const void*);
static void didReceiveSynchronousMessageFromInjectedBundle(WKContextRef, WKStringRef messageName, WKTypeRef messageBody, WKTypeRef* returnData, const void*);
@@ -129,7 +133,6 @@
OwnPtr<PlatformWebView> m_mainWebView;
WKRetainPtr<WKContextRef> m_context;
WKRetainPtr<WKPageGroupRef> m_pageGroup;
- OwnPtr<GeolocationProviderMock> m_geolocationProvider;
enum State {
Initial,
@@ -150,6 +153,9 @@
bool m_beforeUnloadReturnValue;
+ OwnPtr<GeolocationProviderMock> m_geolocationProvider;
+ Vector<WKGeolocationPermissionRequestRef> m_geolocationPermissionRequests;
+ bool m_isGeolocationPermissionSet;
bool m_isGeolocationPermissionAllowed;
EventSenderProxy* m_eventSenderProxy;
Modified: trunk/Tools/WebKitTestRunner/TestInvocation.cpp (129535 => 129536)
--- trunk/Tools/WebKitTestRunner/TestInvocation.cpp 2012-09-25 18:59:58 UTC (rev 129535)
+++ trunk/Tools/WebKitTestRunner/TestInvocation.cpp 2012-09-25 19:06:41 UTC (rev 129536)
@@ -375,6 +375,13 @@
return;
}
+ if (WKStringIsEqualToUTF8CString(messageName, "SetMockGeolocationPositionUnavailableError")) {
+ ASSERT(WKGetTypeID(messageBody) == WKStringGetTypeID());
+ WKStringRef errorMessage = static_cast<WKStringRef>(messageBody);
+ TestController::shared().setMockGeolocationPositionUnavailableError(errorMessage);
+ return;
+ }
+
ASSERT_NOT_REACHED();
}