Fix Geolocation error reporting in the test support
https://bugs.webkit.org/show_bug.cgi?id=97386

Source/WebCore: 

Patch by Benjamin Poulain <bpoulain@apple.com> on 2012-09-24
Reviewed by Sam Weinig.

GeolocationController currently expose GeolocationError which can be either
PermissionDenied or PositionUnavailable.

In practice, only PositionUnavailable is supported and tested, only Chrome
somewhat expose PermissionDenied.
The correct way to deny the permission is through Geolocation::setIsAllowed().

This patch does some of the initial cleanup toward that goal, reducing how
far GeolocationError is spread.

* WebCore.exp.in:
* WebCore.xcodeproj/project.pbxproj:
Mac does not use GeolocationClientMock, it should not be compiled in WebCore.

* platform/mock/GeolocationClientMock.cpp:
(WebCore::GeolocationClientMock::GeolocationClientMock):
(WebCore::GeolocationClientMock::setPosition):
(WebCore::GeolocationClientMock::setPositionUnavailableError):
This method replace setError(). It is limited to PositionUnavailable errors.

(WebCore::GeolocationClientMock::reset):
(WebCore::GeolocationClientMock::controllerTimerFired):
(WebCore):
(WebCore::GeolocationClientMock::clearError):
* platform/mock/GeolocationClientMock.h:
(WebCore):
(GeolocationClientMock):

Source/WebKit/blackberry: 

Patch by Benjamin Poulain <bpoulain@apple.com> on 2012-09-24
Reviewed by Sam Weinig.

* WebKitSupport/DumpRenderTreeSupport.cpp:
(DumpRenderTreeSupport::setMockGeolocationPositionUnavailableError):
* WebKitSupport/DumpRenderTreeSupport.h:
(DumpRenderTreeSupport):

Source/WebKit/chromium: 

Patch by Benjamin Poulain <bpoulain@apple.com> on 2012-09-24
Reviewed by Sam Weinig.

* public/WebGeolocationClientMock.h:
(WebGeolocationClientMock):
* src/WebGeolocationClientMock.cpp:
(WebKit::WebGeolocationClientMock::setMockGeolocationPositionUnavailableError):

Source/WebKit/gtk: 

Patch by Benjamin Poulain <bpoulain@apple.com> on 2012-09-24
Reviewed by Sam Weinig.

* WebCoreSupport/DumpRenderTreeSupportGtk.cpp:
(DumpRenderTreeSupportGtk::setMockGeolocationPositionUnavailableError):
* WebCoreSupport/DumpRenderTreeSupportGtk.h:
(DumpRenderTreeSupportGtk):

Source/WebKit/mac: 

Patch by Benjamin Poulain <bpoulain@apple.com> on 2012-09-24
Reviewed by Sam Weinig.

* WebView/WebView.mm:
(-[WebView _geolocationDidFailWithMessage:]):
* WebView/WebViewPrivate.h:

Source/WebKit/qt: 

Patch by Benjamin Poulain <bpoulain@apple.com> on 2012-09-24
Reviewed by Sam Weinig.

* WebCoreSupport/DumpRenderTreeSupportQt.cpp:
(DumpRenderTreeSupportQt::setMockGeolocationPositionUnavailableError):
* WebCoreSupport/DumpRenderTreeSupportQt.h:

Tools: 

Patch by Benjamin Poulain <bpoulain@apple.com> on 2012-09-24
Reviewed by Sam Weinig.
The TestRunner was exposing internal implementation details of
the Geolocation object through setMockGeolocationError().

In practice, only the error code PositionUnavailable is supported
or even implemented.

Exposing setMockGeolocationError() does not make sense for WebKit2 as
passing generic errors from the UIProcess is a bad idea. This is the
opportunity to clean TestRunner and prepare and interface suitable for WebKit2.

* DumpRenderTree/TestRunner.cpp:
(setMockGeolocationPositionUnavailableErrorCallback):
(TestRunner::staticFunctions):
* DumpRenderTree/TestRunner.h:
(TestRunner):
* DumpRenderTree/blackberry/TestRunnerBlackBerry.cpp:
(TestRunner::setMockGeolocationPositionUnavailableError):
* DumpRenderTree/chromium/DRTTestRunner.cpp:
(DRTTestRunner::DRTTestRunner):
(DRTTestRunner::setMockGeolocationPositionUnavailableError):
* DumpRenderTree/chromium/DRTTestRunner.h:
(DRTTestRunner):
* DumpRenderTree/efl/TestRunnerEfl.cpp:
(TestRunner::setMockGeolocationPositionUnavailableError):
* DumpRenderTree/gtk/TestRunnerGtk.cpp:
(TestRunner::setMockGeolocationPositionUnavailableError):
* DumpRenderTree/mac/MockGeolocationProvider.h:
* DumpRenderTree/mac/MockGeolocationProvider.mm:
(-[MockGeolocationProvider dealloc]):
(-[MockGeolocationProvider resetError]):
(-[MockGeolocationProvider setPosition:]):
(-[MockGeolocationProvider setPositionUnavailableErrorWithMessage:]):
(-[MockGeolocationProvider lastPosition]):
(-[MockGeolocationProvider timerFired]):
* DumpRenderTree/mac/TestRunnerMac.mm:
(TestRunner::setMockGeolocationPositionUnavailableError):
* DumpRenderTree/qt/TestRunnerQt.cpp:
(TestRunner::setMockGeolocationPositionUnavailableError):
* DumpRenderTree/qt/TestRunnerQt.h:
(TestRunner):
* DumpRenderTree/win/TestRunnerWin.cpp:
(TestRunner::setMockGeolocationPositionUnavailableError):
* DumpRenderTree/wx/TestRunnerWx.cpp:
(TestRunner::setMockGeolocationPositionUnavailableError):

LayoutTests: 

Patch by Benjamin Poulain <bpoulain@apple.com> on 2012-09-24
Reviewed by Sam Weinig.

Update the tests to use setMockGeolocationPositionUnavailableError() instead
of setMockGeolocationError().

Only PositionError.POSITION_UNAVAILABLE was supported, so this not change
anything for the test coverage.

* fast/dom/Geolocation/error-clear-watch.html:
* fast/dom/Geolocation/error-expected.txt:
* fast/dom/Geolocation/maximum-age-expected.txt:
* fast/dom/Geolocation/reentrant-error-expected.txt:
* fast/dom/Geolocation/script-tests/error.js:
* fast/dom/Geolocation/script-tests/maximum-age.js:
(checkError):
(testNonZeroMaximumAge):
* fast/dom/Geolocation/script-tests/permission-denied-already-error.js:
* fast/dom/Geolocation/script-tests/reentrant-error.js:
* fast/dom/Geolocation/script-tests/watch.js:
(checkError):
* fast/dom/Geolocation/watch-expected.txt:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@129444 268f45cc-cd09-0410-ab3c-d52691b4dbfc
46 files changed