Changeset 48144 in webkit


Ignore:
Timestamp:
Sep 7, 2009 11:13:55 PM (15 years ago)
Author:
abarth@webkit.org
Message:

2009-09-07 Steve Block <steveblock@google.com>

Reviewed by Adam Barth.

Adds a mock Geolocation service. This will be used to provide predictable behavior of the
Geolocation API for use in LayoutTests. Later changes will integrate the the mock
Geolocation service with DumpRenderTree.
https://bugs.webkit.org/show_bug.cgi?id=28264

  • fast/dom/Geolocation/resources/error.js: Added. Tests that the error callback is called when the service reports an error.
  • fast/dom/Geolocation/error-expected.txt: Added. Expected result for above test.
  • fast/dom/Geolocation/error.html: Added. Wrapper for above test.

2009-09-07 Steve Block <steveblock@google.com>

Reviewed by Adam Barth.

Adds a mock Geolocation service. This will be used to provide predictable behavior of the
Geolocation API for use in LayoutTests. Later changes will integrate the the mock
Geolocation service with DumpRenderTree.
https://bugs.webkit.org/show_bug.cgi?id=28264

The mock Geolocation service returns a fixed position or error. This position or error can be
set through static methods on the GeolocationService class. The position or error is shared
between all instances of the mock Geolocation service.

Implementation details.
The GeolocationService object maintains a pointer to a factory function which it uses to create
Geolocation service instances. Each platform implementing Geolocation sets this pointer
to the factory function for their platform's implementation. When the mock Geolocation service
is activated, the factory function pointer is reset to the factory function for the mock service.

Test: fast/dom/Geolocation/error.html

  • WebCore.base.exp: Modified. Exports GeolocationServiceMock methods.
  • GNUMakefile.am: Modified. Added GeolocationServiceMock files.
  • WebCore.gypi: Modified. Added GeolocationServiceMock files.
  • WebCore.pro: Modified. Added GeolocationServiceMock files.
  • WebCore.vcproj/WebCore.vcproj: Modified. Added GeolocationServiceMock files.
  • WebCore.vcproj/WebCoreCommon.vsprops: Modified. Added mock directory to includes.
  • WebCore.xcodeproj/project.pbxproj: Modified. Added GeolocationServiceMock files and exports some headers.
  • WebCoreSources.bkl: Modified. Added GeolocationServiceMock files.
  • page/ChromeClient.h: Modified. Fixed comment.
  • page/Geolocation.cpp: Modified. (WebCore::Geolocation::setIsAllowed): Modified. Fixed error string.
  • platform/GeolocationService.cpp: Modified. (WebCore::createGeolocationServiceNull): Added. Returns null in place of a Geolocation service. Used to avoid link errors on platforms where Geolocation is not implemented. (WebCore::GeolocationService::create): Added. Uses the factory function pointer to create a Geolocation service implementation. (WebCore::GeolocationService::useMock): Added. Configures the GeolocationServie to use the mock implementation.
  • platform/GeolocationService.h: Modified.
  • platform/mock: Added.
  • platform/mock/GeolocationServiceMock.cpp: Added. (WebCore::GeolocationServiceMock::create): Added. Creates a GeolocationServiceMock object. (WebCore::GeolocationServiceMock::GeolocationServiceMock): Added. Constructor. (WebCore::GeolocationServiceMock::~GeolocationServiceMock): Added. Destructor. (WebCore::GeolocationServiceMock::setPosition): Added. Sets the position that will be returned by the object. (WebCore::GeolocationServiceMock::setError): Added. Sets the error that will be returned by the object. (WebCore::GeolocationServiceMock::startUpdating): Added. GeolocationService implementation. Starts the service. (WebCore::GeolocationServiceMock::stopUpdating): Added. GeolocationService implementation. Stops the service. (WebCore::GeolocationServiceMock::timerFired): Added. Used to provide an asynchronous callback when the service is started. (WebCore::GeolocationServiceMock::makeGeolocationCallbackFromAllInstances): Added. Used to call back when the position or error is updated. (WebCore::GeolocationServiceMock::makeGeolocationCallback): Added. Used to call back when the service starts. (WebCore::GeolocationServiceMock::initStatics): Added. Initializes statics members with constructors. (WebCore::GeolocationServiceMock::cleanUpStatics): Added. Cleans up static members with constructors.
  • platform/mock/GeolocationServiceMock.h: Added. (WebCore::GeolocationServiceMock::lastPosition): Added. Returns the fixed position. (WebCore::GeolocationServiceMock::lastError): Added. Returns the fixed error.
  • platform/gtk/GeolocationServiceGtk.cpp: Modified. (WebCore::GeolocationServiceGtk::create): Added. Creates an instance of GeolocationServiceGtk.
  • platform/gtk/GeolocationServiceGtk.h: Modified.
  • platform/mac/GeolocationServiceMac.h: Modified.
  • platform/mac/GeolocationServiceMac.mm: Modified. (WebCore::GeolocationServiceMac::create): Added. Creates an instance of GeolocationServiceMac.

2009-09-07 Steve Block <steveblock@google.com>

Reviewed by Adam Barth.

Adds a mock Geolocation service. This will be used to provide predictable behavior of the
Geolocation API for use in LayoutTests. Later changes will integrate the the mock
Geolocation service with DumpRenderTree.
https://bugs.webkit.org/show_bug.cgi?id=28264

  • WebKit.xcodeproj/project.pbxproj: Modified. Adds WebGeolocationMock.

2009-09-07 Steve Block <steveblock@google.com>

Reviewed by Adam Barth.

Adds a mock Geolocation service. This will be used to provide predictable behavior of the
Geolocation API for use in LayoutTests. Later changes will integrate the the mock
Geolocation service with DumpRenderTree.
https://bugs.webkit.org/show_bug.cgi?id=28264

  • WebCoreSupport/WebGeolocationMockPrivate.h: Added.
  • WebCoreSupport/WebGeolocationMock.mm: Added. (+[WebGeolocationMock setError:code:]): Added. Used by DumpRender tree to configure the mock Geolocation service. (+[WebGeolocationMock setPosition:latitude:longitude:accuracy:]): Added. Used by DumpRender tree to configure the mock Geolocation service.
  • WebKit.exp: Modified. Exports WebGeolocationMock.

2009-09-07 Steve Block <steveblock@google.com>

Reviewed by Adam Barth.

Adds a mock Geolocation service. This will be used to provide predictable behavior of the
Geolocation API for use in LayoutTests. Later changes will integrate the the mock
Geolocation service with DumpRenderTree.
https://bugs.webkit.org/show_bug.cgi?id=28264

  • DumpRenderTree/LayoutTestController.cpp: Modified. (setMockGeolocationPositionCallback): Added. Configures the mock Geolocation service. (setMockGeolocationErrorCallback): Added. Configures the mock Geolocation service. (LayoutTestController::staticFunctions): Added. Registers the above functions on the LayoutTestController.
  • DumpRenderTree/LayoutTestController.h: Modified.
  • DumpRenderTree/mac/LayoutTestControllerMac.mm: Modified. (LayoutTestController::setMockGeolocationPosition): Added. Configures the mock Geolocation service. (LayoutTestController::setMockGeolocationError): Added. Configures the mock Geolocation service.
Location:
trunk
Files:
6 added
30 edited
2 copied

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r48143 r48144  
     12009-09-07  Steve Block  <steveblock@google.com>
     2
     3        Reviewed by Adam Barth.
     4
     5        Adds a mock Geolocation service. This will be used to provide predictable behavior of the
     6        Geolocation API for use in LayoutTests. Later changes will integrate the the mock
     7        Geolocation service with DumpRenderTree.
     8        https://bugs.webkit.org/show_bug.cgi?id=28264
     9
     10        * fast/dom/Geolocation/resources/error.js: Added. Tests that the error callback is called when the service reports an error.
     11        * fast/dom/Geolocation/error-expected.txt: Added. Expected result for above test.
     12        * fast/dom/Geolocation/error.html: Added. Wrapper for above test.
     13
    1142009-09-07  Jeremy Orlow  <jorlow@chromium.org>
    215
  • trunk/LayoutTests/platform/gtk/Skipped

    r48141 r48144  
    15701570fast/dom/cssTarget-crash.html
    15711571fast/dom/frame-loading-via-document-write.html
     1572fast/dom/Geolocation/error.html
    15721573fast/dom/getBoundingClientRect.html
    15731574fast/dom/null-document-location-put-crash.html
  • trunk/WebCore/ChangeLog

    r48142 r48144  
     12009-09-07  Steve Block  <steveblock@google.com>
     2
     3        Reviewed by Adam Barth.
     4
     5        Adds a mock Geolocation service. This will be used to provide predictable behavior of the
     6        Geolocation API for use in LayoutTests. Later changes will integrate the the mock
     7        Geolocation service with DumpRenderTree.
     8        https://bugs.webkit.org/show_bug.cgi?id=28264
     9
     10        The mock Geolocation service returns a fixed position or error. This position or error can be
     11        set through static methods on the GeolocationService class. The position or error is shared
     12        between all instances of the mock Geolocation service.
     13
     14        Implementation details.
     15        The GeolocationService object maintains a pointer to a factory function which it uses to create
     16        Geolocation service instances. Each platform implementing Geolocation sets this pointer
     17        to the factory function for their platform's implementation. When the mock Geolocation service
     18        is activated, the factory function pointer is reset to the factory function for the mock service.
     19
     20        Test: fast/dom/Geolocation/error.html
     21
     22        * WebCore.base.exp: Modified. Exports GeolocationServiceMock methods.
     23        * GNUMakefile.am: Modified. Added GeolocationServiceMock files.
     24        * WebCore.gypi: Modified. Added GeolocationServiceMock files.
     25        * WebCore.pro: Modified. Added GeolocationServiceMock files.
     26        * WebCore.vcproj/WebCore.vcproj: Modified. Added GeolocationServiceMock files.
     27        * WebCore.vcproj/WebCoreCommon.vsprops: Modified. Added mock directory to includes.
     28        * WebCore.xcodeproj/project.pbxproj: Modified. Added GeolocationServiceMock files and exports some headers.
     29        * WebCoreSources.bkl: Modified. Added GeolocationServiceMock files.
     30        * page/ChromeClient.h: Modified. Fixed comment.
     31        * page/Geolocation.cpp: Modified.
     32        (WebCore::Geolocation::setIsAllowed): Modified. Fixed error string.
     33        * platform/GeolocationService.cpp: Modified.
     34        (WebCore::createGeolocationServiceNull): Added. Returns null in place of a Geolocation service. Used to avoid link errors on platforms where Geolocation is not implemented.
     35        (WebCore::GeolocationService::create): Added. Uses the factory function pointer to create a Geolocation service implementation.
     36        (WebCore::GeolocationService::useMock): Added. Configures the GeolocationServie to use the mock implementation.
     37        * platform/GeolocationService.h: Modified.
     38        * platform/mock: Added.
     39        * platform/mock/GeolocationServiceMock.cpp: Added.
     40        (WebCore::GeolocationServiceMock::create): Added. Creates a GeolocationServiceMock object.
     41        (WebCore::GeolocationServiceMock::GeolocationServiceMock): Added. Constructor.
     42        (WebCore::GeolocationServiceMock::~GeolocationServiceMock): Added. Destructor.
     43        (WebCore::GeolocationServiceMock::setPosition): Added. Sets the position that will be returned by the object.
     44        (WebCore::GeolocationServiceMock::setError): Added. Sets the error that will be returned by the object.
     45        (WebCore::GeolocationServiceMock::startUpdating): Added. GeolocationService implementation. Starts the service.
     46        (WebCore::GeolocationServiceMock::stopUpdating): Added. GeolocationService implementation. Stops the service.
     47        (WebCore::GeolocationServiceMock::timerFired): Added. Used to provide an asynchronous callback when the service is started.
     48        (WebCore::GeolocationServiceMock::makeGeolocationCallbackFromAllInstances): Added. Used to call back when the position or error is updated.
     49        (WebCore::GeolocationServiceMock::makeGeolocationCallback): Added. Used to call back when the service starts.
     50        (WebCore::GeolocationServiceMock::initStatics): Added. Initializes statics members with constructors.
     51        (WebCore::GeolocationServiceMock::cleanUpStatics): Added. Cleans up static members with constructors.
     52        * platform/mock/GeolocationServiceMock.h: Added.
     53        (WebCore::GeolocationServiceMock::lastPosition): Added. Returns the fixed position.
     54        (WebCore::GeolocationServiceMock::lastError): Added. Returns the fixed error.
     55        * platform/gtk/GeolocationServiceGtk.cpp: Modified.
     56        (WebCore::GeolocationServiceGtk::create): Added. Creates an instance of GeolocationServiceGtk.
     57        * platform/gtk/GeolocationServiceGtk.h: Modified.
     58        * platform/mac/GeolocationServiceMac.h: Modified.
     59        * platform/mac/GeolocationServiceMac.mm: Modified.
     60        (WebCore::GeolocationServiceMac::create): Added. Creates an instance of GeolocationServiceMac.
     61
    1622009-09-07  Adam Barth  <abarth@webkit.org>
    263
  • trunk/WebCore/GNUmakefile.am

    r48137 r48144  
    4242        -I$(srcdir)/WebCore/platform/image-decoders/png \
    4343        -I$(srcdir)/WebCore/platform/image-decoders/xbm \
     44        -I$(srcdir)/WebCore/platform/mock \
    4445        -I$(srcdir)/WebCore/platform/network \
    4546        -I$(srcdir)/WebCore/platform/text \
     
    13961397        WebCore/platform/MIMETypeRegistry.cpp \
    13971398        WebCore/platform/MIMETypeRegistry.h \
     1399        WebCore/platform/mock/GeolocationServiceMock.cpp \
     1400        WebCore/platform/mock/GeolocationServiceMock.h \
    13981401        WebCore/platform/NotImplemented.h \
    13991402        WebCore/platform/Pasteboard.h \
  • trunk/WebCore/WebCore.base.exp

    r48064 r48144  
    443443__ZN7WebCore21isBackForwardLoadTypeENS_13FrameLoadTypeE
    444444__ZN7WebCore21reportThreadViolationEPKcNS_20ThreadViolationRoundE
     445__ZN7WebCore22GeolocationServiceMock11setPositionEN3WTF10PassRefPtrINS_11GeopositionEEE
     446__ZN7WebCore22GeolocationServiceMock8setErrorEN3WTF10PassRefPtrINS_13PositionErrorEEE
    445447__ZN7WebCore22ScriptExecutionContext26canSuspendActiveDOMObjectsEv
    446448__ZN7WebCore22applicationIsAppleMailEv
  • trunk/WebCore/WebCore.gypi

    r48099 r48144  
    26082608            'platform/MIMETypeRegistry.cpp',
    26092609            'platform/MIMETypeRegistry.h',
     2610            'platform/mock/GeolocationServiceMock.cpp',
     2611            'platform/mock/GeolocationServiceMock.h',
    26102612            'platform/NotImplemented.h',
    26112613            'platform/Pasteboard.h',
  • trunk/WebCore/WebCore.pro

    r48135 r48144  
    213213    $$PWD/platform/graphics/transforms \
    214214    $$PWD/platform/image-decoders \
     215    $$PWD/platform/mock \
    215216    $$PWD/platform/network \
    216217    $$PWD/platform/sql \
     
    11891190    platform/Logging.cpp \
    11901191    platform/MIMETypeRegistry.cpp \
     1192    platform/mock/GeolocationServiceMock.cpp \
    11911193    platform/network/AuthenticationChallengeBase.cpp \
    11921194    platform/network/Credential.cpp \
     
    18201822    platform/FileChooser.h \
    18211823    platform/GeolocationService.h \
     1824    platform/mock/GeolocationServiceMock.h \
    18221825    platform/graphics/BitmapImage.h \
    18231826    platform/graphics/Color.h \
  • trunk/WebCore/WebCore.vcproj/WebCore.vcproj

    r48104 r48144  
    1706917069                                >
    1707017070                        </File>
    17071                         <File
     17071      <File
    1707217072                                RelativePath="..\page\UserScript.h"
    1707317073                                >
    1707417074                        </File>
    17075                         <File
     17075      <File
    1707617076                                RelativePath="..\page\UserScriptTypes.h"
    1707717077                                >
     
    2176021760                                </File>
    2176121761                        </Filter>
     21762                        <Filter
     21763                                Name="mock"
     21764                                >
     21765                                <File
     21766                                        RelativePath="..\platform\mock\GeolocationServiceMock.cpp"
     21767                                        >
     21768                                </File>
     21769                                <File
     21770                                        RelativePath="..\platform\mock\GeolocationServiceMock.h"
     21771                                        >
     21772                                </File>
     21773                        </Filter>
    2176221774                </Filter>
    2176321775                <Filter
  • trunk/WebCore/WebCore.vcproj/WebCoreCommon.vsprops

    r48131 r48144  
    88        <Tool
    99                Name="VCCLCompilerTool"
    10                 AdditionalIncludeDirectories="&quot;$(ProjectDir)..\&quot;;&quot;$(ProjectDir)..&quot;;&quot;$(ProjectDir)..\accessibility&quot;;&quot;$(ProjectDir)..\accessibility\win&quot;;&quot;$(ProjectDir)..\bridge&quot;;&quot;$(ProjectDir)..\bridge\c&quot;;&quot;$(ProjectDir)..\css&quot;;&quot;$(ProjectDir)..\editing&quot;;&quot;$(ProjectDir)..\rendering&quot;;&quot;$(ProjectDir)..\rendering\style&quot;;&quot;$(ProjectDir)..\bindings\js&quot;;&quot;$(ProjectDir)..\dom&quot;;&quot;$(ProjectDir)..\dom\default&quot;;&quot;$(ProjectDir)..\history&quot;;&quot;$(ProjectDir)..\html&quot;;&quot;$(ProjectDir)..\html\canvas&quot;;&quot;$(ProjectDir)..\inspector&quot;;&quot;$(ProjectDir)..\loader&quot;;&quot;$(ProjectDir)..\loader\appcache&quot;;&quot;$(ProjectDir)..\loader\archive&quot;;&quot;$(ProjectDir)..\loader\archive\cf&quot;;&quot;$(ProjectDir)..\loader\icon&quot;;&quot;$(ProjectDir)..\notifications&quot;;&quot;$(ProjectDir)..\page&quot;;&quot;$(ProjectDir)..\page\animation&quot;;&quot;$(ProjectDir)..\page\win&quot;;&quot;$(ProjectDir)..\platform&quot;;&quot;$(ProjectDir)..\platform\animation&quot;;&quot;$(ProjectDir)..\platform\sql&quot;;&quot;$(ProjectDir)..\platform\win&quot;;&quot;$(ProjectDir)..\platform\network&quot;;&quot;$(ProjectDir)..\platform\network\win&quot;;&quot;$(ProjectDir)..\platform\cf&quot;;&quot;$(ProjectDir)..\platform\graphics&quot;;&quot;$(ProjectDir)..\platform\graphics\opentype&quot;;&quot;$(ProjectDir)..\platform\graphics\transforms&quot;;&quot;$(ProjectDir)..\platform\text&quot;;&quot;$(ProjectDir)..\platform\graphics\win&quot;;&quot;$(ProjectDir)..\xml&quot;;&quot;$(WebKitOutputDir)\obj\WebCore\DerivedSources&quot;;&quot;$(ProjectDir)..\plugins&quot;;&quot;$(ProjectDir)..\plugins\win&quot;;&quot;$(ProjectDir)..\svg\graphics&quot;;&quot;$(ProjectDir)..\svg\graphics\filters&quot;;&quot;$(ProjectDir)..\svg&quot;;&quot;$(ProjectDir)..\wml&quot;;&quot;$(ProjectDir)..\storage&quot;;&quot;$(ProjectDir)..\workers&quot;;&quot;$(WebKitOutputDir)\include&quot;;&quot;$(WebKitOutputDir)\include\private&quot;;&quot;$(WebKitOutputDir)\include\JavaScriptCore&quot;;&quot;$(WebKitOutputDir)\include\private\JavaScriptCore&quot;;&quot;$(ProjectDir)..\ForwardingHeaders&quot;;&quot;$(WebKitLibrariesDir)\include&quot;;&quot;$(WebKitLibrariesDir)\include\private&quot;;&quot;$(WebKitLibrariesDir)\include\private\JavaScriptCore&quot;;&quot;$(WebKitLibrariesDir)\include\icu&quot;;&quot;$(WebKitLibrariesDir)\include\iconv&quot;;&quot;$(WebKitLibrariesDir)\include\pthreads&quot;;&quot;$(WebKitLibrariesDir)\include\sqlite&quot;;&quot;$(WebKitLibrariesDir)\include\JavaScriptCore&quot;;&quot;$(WebKitLibrariesDir)\Include\CoreFoundation\OSXCompatibilityHeaders&quot;;&quot;$(WebKitLibrariesDir)\Include\CoreFoundation\OSXCompatibilityHeaders\GNUCompatibility&quot;;&quot;$(ProjectDir)..\svg\animation&quot;"
     10                AdditionalIncludeDirectories="&quot;$(ProjectDir)..\&quot;;&quot;$(ProjectDir)..&quot;;&quot;$(ProjectDir)..\accessibility&quot;;&quot;$(ProjectDir)..\accessibility\win&quot;;&quot;$(ProjectDir)..\bridge&quot;;&quot;$(ProjectDir)..\bridge\c&quot;;&quot;$(ProjectDir)..\css&quot;;&quot;$(ProjectDir)..\editing&quot;;&quot;$(ProjectDir)..\rendering&quot;;&quot;$(ProjectDir)..\rendering\style&quot;;&quot;$(ProjectDir)..\bindings\js&quot;;&quot;$(ProjectDir)..\dom&quot;;&quot;$(ProjectDir)..\dom\default&quot;;&quot;$(ProjectDir)..\history&quot;;&quot;$(ProjectDir)..\html&quot;;&quot;$(ProjectDir)..\html\canvas&quot;;&quot;$(ProjectDir)..\inspector&quot;;&quot;$(ProjectDir)..\loader&quot;;&quot;$(ProjectDir)..\loader\appcache&quot;;&quot;$(ProjectDir)..\loader\archive&quot;;&quot;$(ProjectDir)..\loader\archive\cf&quot;;&quot;$(ProjectDir)..\loader\icon&quot;;&quot;$(ProjectDir)..\notifications&quot;;&quot;$(ProjectDir)..\page&quot;;&quot;$(ProjectDir)..\page\animation&quot;;&quot;$(ProjectDir)..\page\win&quot;;&quot;$(ProjectDir)..\platform&quot;;&quot;$(ProjectDir)..\platform\animation&quot;;&quot;$(ProjectDir)..\platform\mock&quot;;&quot;$(ProjectDir)..\platform\sql&quot;;&quot;$(ProjectDir)..\platform\win&quot;;&quot;$(ProjectDir)..\platform\network&quot;;&quot;$(ProjectDir)..\platform\network\win&quot;;&quot;$(ProjectDir)..\platform\cf&quot;;&quot;$(ProjectDir)..\platform\graphics&quot;;&quot;$(ProjectDir)..\platform\graphics\opentype&quot;;&quot;$(ProjectDir)..\platform\graphics\transforms&quot;;&quot;$(ProjectDir)..\platform\text&quot;;&quot;$(ProjectDir)..\platform\graphics\win&quot;;&quot;$(ProjectDir)..\xml&quot;;&quot;$(WebKitOutputDir)\obj\WebCore\DerivedSources&quot;;&quot;$(ProjectDir)..\plugins&quot;;&quot;$(ProjectDir)..\plugins\win&quot;;&quot;$(ProjectDir)..\svg\graphics&quot;;&quot;$(ProjectDir)..\svg\graphics\filters&quot;;&quot;$(ProjectDir)..\svg&quot;;&quot;$(ProjectDir)..\wml&quot;;&quot;$(ProjectDir)..\storage&quot;;&quot;$(ProjectDir)..\workers&quot;;&quot;$(WebKitOutputDir)\include&quot;;&quot;$(WebKitOutputDir)\include\private&quot;;&quot;$(WebKitOutputDir)\include\JavaScriptCore&quot;;&quot;$(WebKitOutputDir)\include\private\JavaScriptCore&quot;;&quot;$(ProjectDir)..\ForwardingHeaders&quot;;&quot;$(WebKitLibrariesDir)\include&quot;;&quot;$(WebKitLibrariesDir)\include\private&quot;;&quot;$(WebKitLibrariesDir)\include\private\JavaScriptCore&quot;;&quot;$(WebKitLibrariesDir)\include\icu&quot;;&quot;$(WebKitLibrariesDir)\include\iconv&quot;;&quot;$(WebKitLibrariesDir)\include\pthreads&quot;;&quot;$(WebKitLibrariesDir)\include\sqlite&quot;;&quot;$(WebKitLibrariesDir)\include\JavaScriptCore&quot;;&quot;$(WebKitLibrariesDir)\Include\CoreFoundation\OSXCompatibilityHeaders&quot;;&quot;$(WebKitLibrariesDir)\Include\CoreFoundation\OSXCompatibilityHeaders\GNUCompatibility&quot;;&quot;$(ProjectDir)..\svg\animation&quot;"
    1111                PreprocessorDefinitions="__WIN32__;WEBCORE_CONTEXT_MENUS;ENABLE_CHANNEL_MESSAGING;ENABLE_DATABASE;ENABLE_DATAGRID;ENABLE_DATALIST;ENABLE_DOM_STORAGE;ENABLE_EVENTSOURCE;ENABLE_ICONDATABASE;ENABLE_OFFLINE_WEB_APPLICATIONS;ENABLE_RUBY;ENABLE_SHARED_WORKERS;ENABLE_SVG;ENABLE_SVG_ANIMATION;ENABLE_SVG_AS_IMAGE;ENABLE_SVG_FONTS;ENABLE_SVG_FOREIGN_OBJECT;ENABLE_SVG_USE;ENABLE_WEB_SOCKETS;ENABLE_WORKERS;ENABLE_XPATH;ENABLE_XSLT"
    1212                UsePrecompiledHeader="2"
  • trunk/WebCore/WebCore.xcodeproj/project.pbxproj

    r48137 r48144  
    10161016                550A0BC9085F6039007353D6 /* QualifiedName.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 550A0BC7085F6039007353D6 /* QualifiedName.cpp */; };
    10171017                550A0BCA085F6039007353D6 /* QualifiedName.h in Headers */ = {isa = PBXBuildFile; fileRef = 550A0BC8085F6039007353D6 /* QualifiedName.h */; settings = {ATTRIBUTES = (Private, ); }; };
     1018                59C77F2A10545B3B00506104 /* GeolocationServiceMock.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 59C77F2810545B3B00506104 /* GeolocationServiceMock.cpp */; };
     1019                59C77F2B10545B3B00506104 /* GeolocationServiceMock.h in Headers */ = {isa = PBXBuildFile; fileRef = 59C77F2910545B3B00506104 /* GeolocationServiceMock.h */; settings = {ATTRIBUTES = (Private, ); }; };
    10181020                5D15E3AB0F9E6AC1009E0E3F /* XMLTokenizerScope.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5D15E3A90F9E6AC1009E0E3F /* XMLTokenizerScope.cpp */; };
    10191021                5D15E3AC0F9E6AC1009E0E3F /* XMLTokenizerScope.h in Headers */ = {isa = PBXBuildFile; fileRef = 5D15E3AA0F9E6AC1009E0E3F /* XMLTokenizerScope.h */; };
     
    46154617                F9F0ED7A0DB50CA200D16DB9 /* XMLHttpRequestProgressEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = F9F0ED770DB50CA200D16DB9 /* XMLHttpRequestProgressEvent.h */; };
    46164618                FE6FD4870F676E5700092873 /* Coordinates.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FE6FD4840F676E5700092873 /* Coordinates.cpp */; };
    4617                 FE6FD4880F676E5700092873 /* Coordinates.h in Headers */ = {isa = PBXBuildFile; fileRef = FE6FD4850F676E5700092873 /* Coordinates.h */; };
     4619                FE6FD4880F676E5700092873 /* Coordinates.h in Headers */ = {isa = PBXBuildFile; fileRef = FE6FD4850F676E5700092873 /* Coordinates.h */; settings = {ATTRIBUTES = (Private, ); }; };
    46184620                FE6FD48D0F676E9300092873 /* JSCoordinates.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FE6FD48B0F676E9300092873 /* JSCoordinates.cpp */; };
    46194621                FE6FD48E0F676E9300092873 /* JSCoordinates.h in Headers */ = {isa = PBXBuildFile; fileRef = FE6FD48C0F676E9300092873 /* JSCoordinates.h */; };
     
    46274629                FE80D7C60E9C1F25000D6F75 /* Geolocation.h in Headers */ = {isa = PBXBuildFile; fileRef = FE80D7B80E9C1F25000D6F75 /* Geolocation.h */; settings = {ATTRIBUTES = (Private, ); }; };
    46284630                FE80D7C80E9C1F25000D6F75 /* Geoposition.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FE80D7BA0E9C1F25000D6F75 /* Geoposition.cpp */; };
    4629                 FE80D7C90E9C1F25000D6F75 /* Geoposition.h in Headers */ = {isa = PBXBuildFile; fileRef = FE80D7BB0E9C1F25000D6F75 /* Geoposition.h */; };
     4631                FE80D7C90E9C1F25000D6F75 /* Geoposition.h in Headers */ = {isa = PBXBuildFile; fileRef = FE80D7BB0E9C1F25000D6F75 /* Geoposition.h */; settings = {ATTRIBUTES = (Private, ); }; };
    46304632                FE80D7CB0E9C1F25000D6F75 /* PositionCallback.h in Headers */ = {isa = PBXBuildFile; fileRef = FE80D7BD0E9C1F25000D6F75 /* PositionCallback.h */; settings = {ATTRIBUTES = (Private, ); }; };
    4631                 FE80D7CD0E9C1F25000D6F75 /* PositionError.h in Headers */ = {isa = PBXBuildFile; fileRef = FE80D7BF0E9C1F25000D6F75 /* PositionError.h */; };
     4633                FE80D7CD0E9C1F25000D6F75 /* PositionError.h in Headers */ = {isa = PBXBuildFile; fileRef = FE80D7BF0E9C1F25000D6F75 /* PositionError.h */; settings = {ATTRIBUTES = (Private, ); }; };
    46324634                FE80D7CF0E9C1F25000D6F75 /* PositionErrorCallback.h in Headers */ = {isa = PBXBuildFile; fileRef = FE80D7C10E9C1F25000D6F75 /* PositionErrorCallback.h */; settings = {ATTRIBUTES = (Private, ); }; };
    46334635                FE80D7D10E9C1F25000D6F75 /* PositionOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = FE80D7C30E9C1F25000D6F75 /* PositionOptions.h */; settings = {ATTRIBUTES = (Private, ); }; };
     
    61676169                550A0BC7085F6039007353D6 /* QualifiedName.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = QualifiedName.cpp; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
    61686170                550A0BC8085F6039007353D6 /* QualifiedName.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = QualifiedName.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
     6171                59C77F2810545B3B00506104 /* GeolocationServiceMock.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = GeolocationServiceMock.cpp; path = mock/GeolocationServiceMock.cpp; sourceTree = "<group>"; };
     6172                59C77F2910545B3B00506104 /* GeolocationServiceMock.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GeolocationServiceMock.h; path = mock/GeolocationServiceMock.h; sourceTree = "<group>"; };
    61696173                5D15E3A90F9E6AC1009E0E3F /* XMLTokenizerScope.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XMLTokenizerScope.cpp; sourceTree = "<group>"; };
    61706174                5D15E3AA0F9E6AC1009E0E3F /* XMLTokenizerScope.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XMLTokenizerScope.h; sourceTree = "<group>"; };
     
    1057710581                        sourceTree = "<group>";
    1057810582                };
     10583                59C77F101054591C00506104 /* mock */ = {
     10584                        isa = PBXGroup;
     10585                        children = (
     10586                                59C77F2810545B3B00506104 /* GeolocationServiceMock.cpp */,
     10587                                59C77F2910545B3B00506104 /* GeolocationServiceMock.h */,
     10588                        );
     10589                        name = mock;
     10590                        sourceTree = "<group>";
     10591                };
    1057910592                5DA5E0F9102B950400088CF9 /* WebSockets */ = {
    1058010593                        isa = PBXGroup;
     
    1437114384                        isa = PBXGroup;
    1437214385                        children = (
     14386                                59C77F101054591C00506104 /* mock */,
    1437314387                                49E912A40EFAC8E6009D0CAF /* animation */,
    1437414388                                1AE42F670AA4B8CB00C8612D /* cf */,
     
    1755917573                                51ABAE1B103C18FF008C5260 /* SocketStreamError.h in Headers */,
    1756017574                                51ABAE1E103C1913008C5260 /* SocketStreamHandle.h in Headers */,
     17575                                59C77F2B10545B3B00506104 /* GeolocationServiceMock.h in Headers */,
    1756117576                        );
    1756217577                        runOnlyForDeploymentPostprocessing = 0;
     
    1965419669                                510D4A36103165EE0049EA54 /* SocketStreamHandleBase.cpp in Sources */,
    1965519670                                51ABAE1F103C1913008C5260 /* SocketStreamHandleCFNet.cpp in Sources */,
     19671                                59C77F2A10545B3B00506104 /* GeolocationServiceMock.cpp in Sources */,
    1965619672                        );
    1965719673                        runOnlyForDeploymentPostprocessing = 0;
  • trunk/WebCore/WebCoreSources.bkl

    r48025 r48144  
    818818        platform/Logging.cpp
    819819        platform/MIMETypeRegistry.cpp
     820        platform/mock/GeolocationServiceMock.cpp
    820821        platform/text/RegularExpression.cpp
    821822        platform/Scrollbar.cpp
  • trunk/WebCore/page/ChromeClient.h

    r47866 r48144  
    176176        virtual bool paintCustomScrollCorner(GraphicsContext*, const FloatRect&);
    177177
    178         // This is an asynchronous call. The ChromeClient can display UI asking the user for permission
     178        // This can be either a synchronous or asynchronous call. The ChromeClient can display UI asking the user for permission
    179179        // to use Geolococation. The ChromeClient must call Geolocation::setShouldClearCache() appropriately.
    180180        virtual void requestGeolocationPermissionForFrame(Frame*, Geolocation*) = 0;
  • trunk/WebCore/page/Geolocation.cpp

    r47252 r48144  
    146146        makeSuccessCallbacks();
    147147    } else {
    148         WTF::RefPtr<WebCore::PositionError> error = WebCore::PositionError::create(PositionError::PERMISSION_DENIED, "User disallowed GeoLocation");
     148        WTF::RefPtr<WebCore::PositionError> error = WebCore::PositionError::create(PositionError::PERMISSION_DENIED, "User disallowed Geolocation");
    149149        handleError(error.get());
    150150    }
  • trunk/WebCore/platform/GeolocationService.cpp

    r44094 r48144  
    2121 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    2222 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
    23  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
     23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    2424 */
    2525
    2626#include "config.h"
    2727#include "GeolocationService.h"
     28#include "Geoposition.h"
     29#include "GeolocationServiceMock.h"
     30#include "PositionError.h"
    2831
     32#include <wtf/CurrentTime.h>
    2933#include <wtf/Assertions.h>
    3034
     
    3236
    3337#if !ENABLE(GEOLOCATION)
    34 GeolocationService* GeolocationService::create(GeolocationServiceClient*)
     38GeolocationService* createGeolocationServiceNull(GeolocationServiceClient*)
    3539{
    3640    return 0;
    3741}
     42
     43GeolocationService::FactoryFunction* GeolocationService::s_factoryFunction = &createGeolocationServiceNull;
    3844#endif
     45
     46GeolocationService* GeolocationService::create(GeolocationServiceClient* client)
     47{
     48    return (*s_factoryFunction)(client);
     49}
     50
     51void GeolocationService::useMock()
     52{
     53    s_factoryFunction = &GeolocationServiceMock::create;
     54}
    3955
    4056GeolocationService::GeolocationService(GeolocationServiceClient* client)
  • trunk/WebCore/platform/GeolocationService.h

    r41375 r48144  
    6060    void errorOccurred();
    6161
     62    static void useMock();
     63
    6264protected:
    6365    GeolocationService(GeolocationServiceClient*);
     
    6567private:
    6668    GeolocationServiceClient* m_geolocationServiceClient;
     69
     70    typedef GeolocationService* (FactoryFunction)(GeolocationServiceClient*);
     71    static FactoryFunction* s_factoryFunction;
    6772};
    6873
  • trunk/WebCore/platform/gtk/GeolocationServiceGtk.cpp

    r42440 r48144  
    3838namespace WebCore {
    3939
    40 GeolocationService* GeolocationService::create(GeolocationServiceClient* client)
     40GeolocationService* GeolocationServiceGtk::create(GeolocationServiceClient* client)
    4141{
    4242    return new GeolocationServiceGtk(client);
    4343}
     44
     45GeolocationService::FactoryFunction* GeolocationService::s_factoryFunction = &GeolocationServiceGtk::create;
    4446
    4547GeolocationServiceGtk::GeolocationServiceGtk(GeolocationServiceClient* client)
  • trunk/WebCore/platform/gtk/GeolocationServiceGtk.h

    r40441 r48144  
    3232    class GeolocationServiceGtk : public GeolocationService {
    3333    public:
    34         GeolocationServiceGtk(GeolocationServiceClient*);
     34        static GeolocationService* create(GeolocationServiceClient*);
    3535        ~GeolocationServiceGtk();
    3636
     
    4545
    4646    private:
     47        GeolocationServiceGtk(GeolocationServiceClient*);
     48
    4749        void updateLocationInformation();
    4850        void setError(PositionError::ErrorCode, const char* message);
  • trunk/WebCore/platform/mac/GeolocationServiceMac.h

    r41375 r48144  
    4646class GeolocationServiceMac : public GeolocationService {
    4747public:
    48     GeolocationServiceMac(GeolocationServiceClient*);
     48    static GeolocationService* create(GeolocationServiceClient*);
    4949    virtual ~GeolocationServiceMac();
    5050   
     
    6262
    6363private:
     64    GeolocationServiceMac(GeolocationServiceClient*);
     65
    6466    RetainPtr<CLLocationManager> m_locationManager;
    6567    RetainPtr<WebCoreCoreLocationObserver> m_objcObserver;
  • trunk/WebCore/platform/mac/GeolocationServiceMac.mm

    r42437 r48144  
    6666namespace WebCore {
    6767
    68 GeolocationService* GeolocationService::create(GeolocationServiceClient* client)
     68GeolocationService* GeolocationServiceMac::create(GeolocationServiceClient* client)
    6969{
    7070    return new GeolocationServiceMac(client);
    7171}
     72
     73GeolocationService::FactoryFunction* GeolocationService::s_factoryFunction = &GeolocationServiceMac::create;
    7274
    7375GeolocationServiceMac::GeolocationServiceMac(GeolocationServiceClient* client)
  • trunk/WebCore/platform/mock/GeolocationServiceMock.h

    r48143 r48144  
    2121 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    2222 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
    23  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
     23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    2424 */
    2525
    26 #ifndef GeolocationServiceMac_h
    27 #define GeolocationServiceMac_h
    28 
    29 #if ENABLE(GEOLOCATION)
     26#ifndef GeolocationServiceMock_h
     27#define GeolocationServiceMock_h
    3028
    3129#include "GeolocationService.h"
     30#include "Timer.h"
     31#include <wtf/HashSet.h>
    3232#include <wtf/PassRefPtr.h>
    3333#include <wtf/RefPtr.h>
    34 #include <wtf/RetainPtr.h>
    35 
    36 #ifdef __OBJC__
    37 @class CLLocationManager;
    38 @class WebCoreCoreLocationObserver;
    39 #else
    40 class CLLocationManager;
    41 class WebCoreCoreLocationObserver;
    42 #endif
    4334
    4435namespace WebCore {
    4536
    46 class GeolocationServiceMac : public GeolocationService {
    47 public:
    48     GeolocationServiceMac(GeolocationServiceClient*);
    49     virtual ~GeolocationServiceMac();
    50    
     37// This class provides a mock implementation of a GeolocationService for testing
     38// purposes. It allows the position or error that will be reported by this class
     39// to be set manually using the setPosition and setError methods. Objects of
     40// this class call back to their respective GeolocationServiceClient with the
     41// position or error every time either of these is updated.
     42class GeolocationServiceMock : public GeolocationService {
     43  public:
     44    static GeolocationService* create(GeolocationServiceClient*);
     45
     46    GeolocationServiceMock(GeolocationServiceClient*);
     47    virtual ~GeolocationServiceMock();
     48
    5149    virtual bool startUpdating(PositionOptions*);
    5250    virtual void stopUpdating();
    5351
    54     virtual void suspend();
    55     virtual void resume();
     52    static void setPosition(PassRefPtr<Geoposition> position);
     53    static void setError(PassRefPtr<PositionError> position);
    5654
    57     virtual Geoposition* lastPosition() const { return m_lastPosition.get(); }
    58     virtual PositionError* lastError() const { return m_lastError.get(); }
     55    virtual Geoposition* lastPosition() const { return s_lastPosition->get(); }
     56    virtual PositionError* lastError() const { return s_lastError->get(); }
    5957
    60     void positionChanged(PassRefPtr<Geoposition>);
    61     void errorOccurred(PassRefPtr<PositionError>);
     58  private:
     59    static void makeGeolocationCallbackFromAllInstances();
     60    void makeGeolocationCallback();
    6261
    63 private:
    64     RetainPtr<CLLocationManager> m_locationManager;
    65     RetainPtr<WebCoreCoreLocationObserver> m_objcObserver;
    66    
    67     RefPtr<Geoposition> m_lastPosition;
    68     RefPtr<PositionError> m_lastError;
     62    void timerFired(Timer<GeolocationServiceMock>*);
     63
     64    static void initStatics();
     65    static void cleanUpStatics();
     66
     67    typedef HashSet<GeolocationServiceMock*> GeolocationServiceSet;
     68    static GeolocationServiceSet* s_instances;
     69
     70    static RefPtr<Geoposition>* s_lastPosition;
     71    static RefPtr<PositionError>* s_lastError;
     72
     73    Timer<GeolocationServiceMock> m_timer;
     74
     75    bool m_isActive;
    6976};
    70    
     77
    7178} // namespace WebCore
    7279
    73 #endif // ENABLE(GEOLOCATION)
    74 
    75 #endif // GeolocationServiceMac_h
     80#endif // GeolocationServiceMock_h
  • trunk/WebKit/ChangeLog

    r48023 r48144  
     12009-09-07  Steve Block  <steveblock@google.com>
     2
     3        Reviewed by Adam Barth.
     4
     5        Adds a mock Geolocation service. This will be used to provide predictable behavior of the
     6        Geolocation API for use in LayoutTests. Later changes will integrate the the mock
     7        Geolocation service with DumpRenderTree.
     8        https://bugs.webkit.org/show_bug.cgi?id=28264
     9
     10        * WebKit.xcodeproj/project.pbxproj: Modified. Adds WebGeolocationMock.
     11
    1122009-09-03  John Sullivan  <sullivan@apple.com>
    213
  • trunk/WebKit/WebKit.xcodeproj/project.pbxproj

    r47908 r48144  
    9595                5241ADF50B1BC48A004012BD /* WebCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 5241ADF30B1BC48A004012BD /* WebCache.h */; settings = {ATTRIBUTES = (Private, ); }; };
    9696                5241ADF60B1BC48A004012BD /* WebCache.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5241ADF40B1BC48A004012BD /* WebCache.mm */; };
     97                59C77F3510545F7E00506104 /* WebGeolocationMock.mm in Sources */ = {isa = PBXBuildFile; fileRef = 59C77F3310545F7E00506104 /* WebGeolocationMock.mm */; };
     98                59C77F4B105471E700506104 /* WebGeolocationMockPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 59C77F4A105471E700506104 /* WebGeolocationMockPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
    9799                5D1638F30E35B45D00F3038E /* EmptyProtocolDefinitions.h in Headers */ = {isa = PBXBuildFile; fileRef = 5D1638F20E35B45D00F3038E /* EmptyProtocolDefinitions.h */; };
    98100                5D7BF8140C2A1D90008CE06D /* WebInspector.h in Headers */ = {isa = PBXBuildFile; fileRef = 5D7BF8120C2A1D90008CE06D /* WebInspector.h */; settings = {ATTRIBUTES = (Private, ); }; };
     
    467469                5241ADF30B1BC48A004012BD /* WebCache.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = WebCache.h; sourceTree = "<group>"; };
    468470                5241ADF40B1BC48A004012BD /* WebCache.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = WebCache.mm; sourceTree = "<group>"; };
     471                59C77F3310545F7E00506104 /* WebGeolocationMock.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebGeolocationMock.mm; sourceTree = "<group>"; };
     472                59C77F4A105471E700506104 /* WebGeolocationMockPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebGeolocationMockPrivate.h; sourceTree = "<group>"; };
    469473                5D1638F20E35B45D00F3038E /* EmptyProtocolDefinitions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EmptyProtocolDefinitions.h; sourceTree = "<group>"; };
    470474                5D7BF8120C2A1D90008CE06D /* WebInspector.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = WebInspector.h; sourceTree = "<group>"; };
     
    11361140                        isa = PBXGroup;
    11371141                        children = (
     1142                                59C77F4A105471E700506104 /* WebGeolocationMockPrivate.h */,
     1143                                59C77F3310545F7E00506104 /* WebGeolocationMock.mm */,
    11381144                                B68049710FFBCEC1009F7F62 /* WebApplicationCache.h */,
    11391145                                B68049720FFBCEC1009F7F62 /* WebApplicationCache.mm */,
     
    14471453                                939810710824BF01008DF038 /* WebViewPrivate.h in Headers */,
    14481454                                41F4484F10338E8C0030E55E /* WebWorkersPrivate.h in Headers */,
     1455                                59C77F4B105471E700506104 /* WebGeolocationMockPrivate.h in Headers */,
    14491456                        );
    14501457                        runOnlyForDeploymentPostprocessing = 0;
     
    17781785                                939810E80824BF01008DF038 /* WebViewFactory.mm in Sources */,
    17791786                                41F4485010338E8C0030E55E /* WebWorkersPrivate.mm in Sources */,
     1787                                59C77F3510545F7E00506104 /* WebGeolocationMock.mm in Sources */,
    17801788                        );
    17811789                        runOnlyForDeploymentPostprocessing = 0;
  • trunk/WebKit/mac/ChangeLog

    r48131 r48144  
     12009-09-07  Steve Block  <steveblock@google.com>
     2
     3        Reviewed by Adam Barth.
     4
     5        Adds a mock Geolocation service. This will be used to provide predictable behavior of the
     6        Geolocation API for use in LayoutTests. Later changes will integrate the the mock
     7        Geolocation service with DumpRenderTree.
     8        https://bugs.webkit.org/show_bug.cgi?id=28264
     9
     10        * WebCoreSupport/WebGeolocationMockPrivate.h: Added.
     11        * WebCoreSupport/WebGeolocationMock.mm: Added.
     12        (+[WebGeolocationMock setError:code:]): Added. Used by DumpRender tree to configure the mock Geolocation service.
     13        (+[WebGeolocationMock setPosition:latitude:longitude:accuracy:]): Added. Used by DumpRender tree to configure the mock Geolocation service.
     14        * WebKit.exp: Modified. Exports WebGeolocationMock.
     15
    1162009-09-07  Drew Wilson  <atwilson@google.com>
    217
  • trunk/WebKit/mac/WebCoreSupport/WebGeolocationMockPrivate.h

    r48143 r48144  
    11/*
    2  * Copyright (C) 2008 Apple Inc. All Rights Reserved.
     2 * Copyright (C) 2009 Apple Inc. All Rights Reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    2424 */
    2525
    26 #include "config.h"
    27 #include "GeolocationService.h"
     26#import <Foundation/Foundation.h>
    2827
    29 #include <wtf/Assertions.h>
    30 
    31 namespace WebCore {
    32 
    33 #if !ENABLE(GEOLOCATION)
    34 GeolocationService* GeolocationService::create(GeolocationServiceClient*)
    35 {
    36     return 0;
    37 }
    38 #endif
    39 
    40 GeolocationService::GeolocationService(GeolocationServiceClient* client)
    41     : m_geolocationServiceClient(client)
    42 {
    43     ASSERT(m_geolocationServiceClient);
     28@interface WebGeolocationMock : NSObject {
    4429}
    4530
    46 void GeolocationService::positionChanged()
    47 {
    48     m_geolocationServiceClient->geolocationServicePositionChanged(this);
    49 }
    50 
    51 void GeolocationService::errorOccurred()
    52 {
    53     m_geolocationServiceClient->geolocationServiceErrorOccurred(this);
    54 }
    55 
    56 } // namespace WebCore
     31+ (void)setPosition:(double)latitude:(double)longitude:(double)accuracy;
     32+ (void)setError:(int)code:(NSString *)message;
     33@end
  • trunk/WebKit/mac/WebKit.exp

    r47429 r48144  
    1313.objc_class_name_WebFrame
    1414.objc_class_name_WebFrameView
     15.objc_class_name_WebGeolocationMock
    1516.objc_class_name_WebHTMLRepresentation
    1617.objc_class_name_WebHTMLView
  • trunk/WebKitTools/ChangeLog

    r48131 r48144  
     12009-09-07  Steve Block  <steveblock@google.com>
     2
     3        Reviewed by Adam Barth.
     4
     5        Adds a mock Geolocation service. This will be used to provide predictable behavior of the
     6        Geolocation API for use in LayoutTests. Later changes will integrate the the mock
     7        Geolocation service with DumpRenderTree.
     8        https://bugs.webkit.org/show_bug.cgi?id=28264
     9
     10        * DumpRenderTree/LayoutTestController.cpp: Modified.
     11        (setMockGeolocationPositionCallback): Added. Configures the mock Geolocation service.
     12        (setMockGeolocationErrorCallback): Added. Configures the mock Geolocation service.
     13        (LayoutTestController::staticFunctions): Added. Registers the above functions on the LayoutTestController.
     14        * DumpRenderTree/LayoutTestController.h: Modified.
     15        * DumpRenderTree/mac/LayoutTestControllerMac.mm: Modified.
     16        (LayoutTestController::setMockGeolocationPosition): Added. Configures the mock Geolocation service.
     17        (LayoutTestController::setMockGeolocationError): Added. Configures the mock Geolocation service.
     18
    1192009-09-07  Drew Wilson  <atwilson@google.com>
    220
  • trunk/WebKitTools/DumpRenderTree/LayoutTestController.cpp

    r48057 r48144  
    3737#include <wtf/Assertions.h>
    3838#include <wtf/MathExtras.h>
     39#include <wtf/RefPtr.h>
    3940
    4041LayoutTestController::LayoutTestController(const std::string& testPathOrURL, const std::string& expectedPixelHash)
     
    629630    return JSValueMakeUndefined(context);
    630631
     632}
     633
     634static JSValueRef setMockGeolocationPositionCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
     635{
     636    if (argumentCount < 3)
     637        return JSValueMakeUndefined(context);
     638
     639    LayoutTestController* controller = reinterpret_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
     640    controller->setMockGeolocationPosition(JSValueToNumber(context, arguments[0], NULL),  // latitude
     641                                           JSValueToNumber(context, arguments[1], NULL),  // longitude
     642                                           JSValueToNumber(context, arguments[2], NULL));  // accuracy
     643
     644    return JSValueMakeUndefined(context);
     645}
     646
     647static JSValueRef setMockGeolocationErrorCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
     648{
     649    if (argumentCount < 2)
     650        return JSValueMakeUndefined(context);
     651
     652    int code = JSValueToNumber(context, arguments[0], NULL);
     653    JSRetainPtr<JSStringRef> message(Adopt, JSValueToStringCopy(context, arguments[1], exception));
     654    ASSERT(!*exception);
     655
     656    LayoutTestController* controller = reinterpret_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
     657    controller->setMockGeolocationError(code, message.get());
     658
     659    return JSValueMakeUndefined(context);
    631660}
    632661
     
    10561085        { "setCustomPolicyDelegate", setCustomPolicyDelegateCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    10571086        { "setDatabaseQuota", setDatabaseQuotaCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
     1087        { "setMockGeolocationPosition", setMockGeolocationPositionCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
     1088        { "setMockGeolocationError", setMockGeolocationErrorCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    10581089        { "setIconDatabaseEnabled", setIconDatabaseEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    10591090        { "setJavaScriptProfilingEnabled", setJavaScriptProfilingEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
  • trunk/WebKitTools/DumpRenderTree/LayoutTestController.h

    r48057 r48144  
    6969    void setCustomPolicyDelegate(bool setDelegate, bool permissive);
    7070    void setDatabaseQuota(unsigned long long quota);
     71    void setMockGeolocationPosition(double latitude, double longitude, double accuracy);
     72    void setMockGeolocationError(int code, JSStringRef message);
    7173    void setIconDatabaseEnabled(bool iconDatabaseEnabled);
    7274    void setJavaScriptProfilingEnabled(bool profilingEnabled);
  • trunk/WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp

    r48101 r48144  
    303303}
    304304
     305void LayoutTestController::setMockGeolocationPosition(double latitude, double longitude, double accuracy)
     306{
     307    // FIXME: Implement for Geolocation layout tests.
     308    // See https://bugs.webkit.org/show_bug.cgi?id=28264.
     309}
     310
     311void LayoutTestController::setMockGeolocationError(int code, JSStringRef message)
     312{
     313    // FIXME: Implement for Geolocation layout tests.
     314    // See https://bugs.webkit.org/show_bug.cgi?id=28264.
     315}
     316
    305317void LayoutTestController::setIconDatabaseEnabled(bool flag)
    306318{
  • trunk/WebKitTools/DumpRenderTree/mac/LayoutTestControllerMac.mm

    r48057 r48144  
    5353#import <WebKit/WebHistoryPrivate.h>
    5454#import <WebKit/WebInspector.h>
     55#import <WebKit/WebGeolocationMockPrivate.h>
    5556#import <WebKit/WebNSURLExtras.h>
    5657#import <WebKit/WebPreferences.h>
     
    233234    [origin setQuota:quota];
    234235    [origin release];
     236}
     237
     238void LayoutTestController::setMockGeolocationPosition(double latitude, double longitude, double accuracy)
     239{
     240    [WebGeolocationMock setPosition:latitude:longitude:accuracy];
     241}
     242
     243void LayoutTestController::setMockGeolocationError(int code, JSStringRef message)
     244{
     245    RetainPtr<CFStringRef> messageCF(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, message));
     246    NSString *messageNS = (NSString *)messageCF.get();
     247    [WebGeolocationMock setError:code:messageNS];
    235248}
    236249
  • trunk/WebKitTools/DumpRenderTree/win/LayoutTestControllerWin.cpp

    r48057 r48144  
    312312}
    313313
     314void LayoutTestController::setMockGeolocationPosition(double latitude, double longitude, double accuracy)
     315{
     316    // FIXME: Implement for Geolocation layout tests.
     317    // See https://bugs.webkit.org/show_bug.cgi?id=28264.
     318}
     319
     320void LayoutTestController::setMockGeolocationError(int code, JSStringRef message)
     321{
     322    // FIXME: Implement for Geolocation layout tests.
     323    // See https://bugs.webkit.org/show_bug.cgi?id=28264.
     324}
     325
    314326void LayoutTestController::setIconDatabaseEnabled(bool iconDatabaseEnabled)
    315327{
  • trunk/WebKitTools/DumpRenderTree/wx/LayoutTestControllerWx.cpp

    r48057 r48144  
    240240}
    241241
     242void LayoutTestController::setMockGeolocationPosition(double latitude, double longitude, double accuracy)
     243{
     244    // FIXME: Implement for Geolocation layout tests.
     245    // See https://bugs.webkit.org/show_bug.cgi?id=28264.
     246}
     247
     248void LayoutTestController::setMockGeolocationError(int code, JSStringRef message)
     249{
     250    // FIXME: Implement for Geolocation layout tests.
     251    // See https://bugs.webkit.org/show_bug.cgi?id=28264.
     252}
     253
    242254void LayoutTestController::setIconDatabaseEnabled(bool iconDatabaseEnabled)
    243255{
Note: See TracChangeset for help on using the changeset viewer.