Changeset 64639 in webkit


Ignore:
Timestamp:
Aug 4, 2010 4:13:20 AM (14 years ago)
Author:
steveblock@google.com
Message:

Adds Geolocation LayoutTests for the case where permission is not granted or denied immediately
https://bugs.webkit.org/show_bug.cgi?id=40002

Reviewed by Alexey Proskuryakov.

WebKitTools:

The code in LayoutTestController::setGeolocationPermission() was moved to
setGeolocationPermissionCommon() to allow each port to provide its own
implementation of setGeolocationPermission().

For the Mac port, setGeolocationPermission() notifies the UIDelegate of the
new permission, so it can call back to WebCore if permission requests are in
progress and are waiting for a response. A minor fix to the Mac
MockGeolocationProvider was also required to make sure that the mock provider
calls back to WebCore when it is first started.

For other ports, LayoutTestController::setGeolocationPermission() is not
implemented.

  • DumpRenderTree/LayoutTestController.cpp:

(LayoutTestController::setGeolocationPermissionCommon):

  • DumpRenderTree/LayoutTestController.h:
  • DumpRenderTree/gtk/LayoutTestControllerGtk.cpp:

(LayoutTestController::setGeolocationPermission):

  • DumpRenderTree/mac/LayoutTestControllerMac.mm:

(LayoutTestController::setGeolocationPermission):

  • DumpRenderTree/mac/MockGeolocationProvider.mm:

(-[MockGeolocationProvider registerWebView:]):

  • DumpRenderTree/mac/UIDelegate.h:
  • DumpRenderTree/mac/UIDelegate.mm:

(-[UIDelegate webView:decidePolicyForGeolocationRequestFromOrigin:frame:listener:]):
(-[UIDelegate setGeolocationPermission:]):
(-[UIDelegate dealloc]):

  • DumpRenderTree/win/LayoutTestControllerWin.cpp:

(LayoutTestController::setGeolocationPermission):

  • DumpRenderTree/wx/LayoutTestControllerWx.cpp:

(LayoutTestController::setGeolocationPermission):

LayoutTests:

  • fast/dom/Geolocation/delayed-permission-allowed-expected.txt: Added.
  • fast/dom/Geolocation/delayed-permission-allowed.html: Added.
  • fast/dom/Geolocation/delayed-permission-denied-expected.txt: Added.
  • fast/dom/Geolocation/delayed-permission-denied.html: Added.
  • fast/dom/Geolocation/script-tests/delayed-permission-allowed.js: Added.
  • fast/dom/Geolocation/script-tests/delayed-permission-denied.js: Added.
  • platform/gtk/Skipped: Added new tests to GTK skipped lists
Location:
trunk
Files:
6 added
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r64631 r64639  
     12010-08-02  Steve Block  <steveblock@google.com>
     2
     3        Reviewed by Alexey Proskuryakov.
     4
     5        Adds Geolocation LayoutTests for the case where permission is not granted or denied immediately
     6        https://bugs.webkit.org/show_bug.cgi?id=40002
     7
     8        * fast/dom/Geolocation/delayed-permission-allowed-expected.txt: Added.
     9        * fast/dom/Geolocation/delayed-permission-allowed.html: Added.
     10        * fast/dom/Geolocation/delayed-permission-denied-expected.txt: Added.
     11        * fast/dom/Geolocation/delayed-permission-denied.html: Added.
     12        * fast/dom/Geolocation/script-tests/delayed-permission-allowed.js: Added.
     13        * fast/dom/Geolocation/script-tests/delayed-permission-denied.js: Added.
     14        * platform/gtk/Skipped: Added new tests to GTK skipped lists
     15
    1162010-08-03  Alexey Proskuryakov  <ap@apple.com>
    217
  • trunk/LayoutTests/platform/gtk/Skipped

    r64617 r64639  
    10881088fast/dom/DeviceOrientation/window-property.html
    10891089fast/dom/Geolocation/callback-exception.html
     1090fast/dom/Geolocation/delayed-permission-allowed.html
     1091fast/dom/Geolocation/delayed-permission-denied.html
    10901092fast/dom/Geolocation/error.html
    10911093fast/dom/Geolocation/multiple-requests.html
  • trunk/WebKitTools/ChangeLog

    r64615 r64639  
     12010-08-02  Steve Block  <steveblock@google.com>
     2
     3        Reviewed by Alexey Proskuryakov.
     4
     5        Adds Geolocation LayoutTests for the case where permission is not granted or denied immediately
     6        https://bugs.webkit.org/show_bug.cgi?id=40002
     7
     8        The code in LayoutTestController::setGeolocationPermission() was moved to
     9        setGeolocationPermissionCommon() to allow each port to provide its own
     10        implementation of setGeolocationPermission().
     11
     12        For the Mac port, setGeolocationPermission() notifies the UIDelegate of the
     13        new permission, so it can call back to WebCore if permission requests are in
     14        progress and are waiting for a response. A minor fix to the Mac
     15        MockGeolocationProvider was also required to make sure that the mock provider
     16        calls back to WebCore when it is first started.
     17
     18        For other ports, LayoutTestController::setGeolocationPermission() is not
     19        implemented.
     20
     21        * DumpRenderTree/LayoutTestController.cpp:
     22        (LayoutTestController::setGeolocationPermissionCommon):
     23        * DumpRenderTree/LayoutTestController.h:
     24        * DumpRenderTree/gtk/LayoutTestControllerGtk.cpp:
     25        (LayoutTestController::setGeolocationPermission):
     26        * DumpRenderTree/mac/LayoutTestControllerMac.mm:
     27        (LayoutTestController::setGeolocationPermission):
     28        * DumpRenderTree/mac/MockGeolocationProvider.mm:
     29        (-[MockGeolocationProvider registerWebView:]):
     30        * DumpRenderTree/mac/UIDelegate.h:
     31        * DumpRenderTree/mac/UIDelegate.mm:
     32        (-[UIDelegate webView:decidePolicyForGeolocationRequestFromOrigin:frame:listener:]):
     33        (-[UIDelegate setGeolocationPermission:]):
     34        (-[UIDelegate dealloc]):
     35        * DumpRenderTree/win/LayoutTestControllerWin.cpp:
     36        (LayoutTestController::setGeolocationPermission):
     37        * DumpRenderTree/wx/LayoutTestControllerWx.cpp:
     38        (LayoutTestController::setGeolocationPermission):
     39
    1402010-08-03  Kent Tamura  <tkent@chromium.org>
    241
  • trunk/WebKitTools/DumpRenderTree/LayoutTestController.cpp

    r64613 r64639  
    19761976}
    19771977
    1978 void LayoutTestController::setGeolocationPermission(bool allow)
     1978void LayoutTestController::setGeolocationPermissionCommon(bool allow)
    19791979{
    19801980    m_isGeolocationPermissionSet = true;
  • trunk/WebKitTools/DumpRenderTree/LayoutTestController.h

    r64613 r64639  
    293293    LayoutTestController(const std::string& testPathOrURL, const std::string& expectedPixelHash);
    294294
     295    void setGeolocationPermissionCommon(bool allow);
     296
    295297    bool m_dumpApplicationCacheDelegateCallbacks;
    296298    bool m_dumpAsPDF;
  • trunk/WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp

    r64613 r64639  
    463463}
    464464
     465void LayoutTestController::setGeolocationPermission(bool allow)
     466{
     467    // FIXME: Implement for Geolocation layout tests.
     468    setGeolocationPermissionCommon(allow);
     469}
     470
    465471void LayoutTestController::setIconDatabaseEnabled(bool flag)
    466472{
  • trunk/WebKitTools/DumpRenderTree/mac/LayoutTestControllerMac.mm

    r64613 r64639  
    3434#import "MockGeolocationProvider.h"
    3535#import "PolicyDelegate.h"
     36#import "UIDelegate.h"
    3637#import "WorkQueue.h"
    3738#import "WorkQueueItem.h"
     
    356357}
    357358
     359void LayoutTestController::setGeolocationPermission(bool allow)
     360{
     361    setGeolocationPermissionCommon(allow);
     362    [[[mainFrame webView] UIDelegate] didSetMockGeolocationPermission];
     363}
     364
    358365void LayoutTestController::setIconDatabaseEnabled(bool iconDatabaseEnabled)
    359366{
  • trunk/WebKitTools/DumpRenderTree/mac/MockGeolocationProvider.mm

    r60488 r64639  
    7575{
    7676    _registeredViews.add(webView);
     77
     78    if (!_timer)
     79        _timer = [NSTimer scheduledTimerWithTimeInterval:0 target:self selector:@selector(timerFired) userInfo:0 repeats:NO];
    7780}
    7881
  • trunk/WebKitTools/DumpRenderTree/mac/UIDelegate.h

    r29663 r64639  
    3333@private
    3434    NSRect m_frame;
     35    NSMutableSet *m_pendingGeolocationPermissionListeners;
     36    NSTimer *m_timer;
    3537}
    3638
     39- (void)didSetMockGeolocationPermission;
     40
    3741@end
  • trunk/WebKitTools/DumpRenderTree/mac/UIDelegate.mm

    r64613 r64639  
    186186- (void)webView:(WebView *)webView decidePolicyForGeolocationRequestFromOrigin:(WebSecurityOrigin *)origin frame:(WebFrame *)frame listener:(id<WebGeolocationPolicyListener>)listener
    187187{
    188     // FIXME: If mock permission isn't set yet, we should send the response asynchronously.
    189     if (gLayoutTestController->isGeolocationPermissionSet() && gLayoutTestController->geolocationPermission())
     188    if (!gLayoutTestController->isGeolocationPermissionSet()) {
     189        if (!m_pendingGeolocationPermissionListeners)
     190            m_pendingGeolocationPermissionListeners = [[NSMutableSet set] retain];
     191        [m_pendingGeolocationPermissionListeners addObject:listener];
     192        return;
     193    }
     194
     195    if (gLayoutTestController->geolocationPermission())
    190196        [listener allow];
    191197    else
     
    193199}
    194200
     201- (void)didSetMockGeolocationPermission
     202{
     203    ASSERT(gLayoutTestController->isGeolocationPermissionSet());
     204    if (m_pendingGeolocationPermissionListeners && !m_timer)
     205        m_timer = [NSTimer scheduledTimerWithTimeInterval:0 target:self selector:@selector(timerFired) userInfo:0 repeats:NO];
     206}
     207
     208- (void)timerFired
     209{
     210    ASSERT(gLayoutTestController->isGeolocationPermissionSet());
     211    m_timer = 0;
     212    NSEnumerator* enumerator = [m_pendingGeolocationPermissionListeners objectEnumerator];
     213    id<WebGeolocationPolicyListener> listener;
     214    while ((listener = [enumerator nextObject])) {
     215        if (gLayoutTestController->geolocationPermission())
     216            [listener allow];
     217        else
     218            [listener deny];
     219    }
     220    [m_pendingGeolocationPermissionListeners removeAllObjects];
     221    [m_pendingGeolocationPermissionListeners release];
     222    m_pendingGeolocationPermissionListeners = nil;
     223}
     224
    195225- (BOOL)webView:(WebView *)sender shouldHaltPlugin:(DOMNode *)pluginNode
    196226{
     
    208238    [draggingInfo release];
    209239    draggingInfo = nil;
     240    [m_pendingGeolocationPermissionListeners release];
     241    m_pendingGeolocationPermissionListeners = nil;
    210242
    211243    [super dealloc];
  • trunk/WebKitTools/DumpRenderTree/win/LayoutTestControllerWin.cpp

    r64613 r64639  
    394394}
    395395
     396void LayoutTestController::setGeolocationPermission(bool allow)
     397{
     398    // FIXME: Implement for Geolocation layout tests.
     399    setGeolocationPermissionCommon(allow);
     400}
     401
    396402void LayoutTestController::setIconDatabaseEnabled(bool iconDatabaseEnabled)
    397403{
  • trunk/WebKitTools/DumpRenderTree/wx/LayoutTestControllerWx.cpp

    r64613 r64639  
    300300}
    301301
     302void LayoutTestController::setGeolocationPermission(bool allow)
     303{
     304    // FIXME: Implement for Geolocation layout tests.
     305    setGeolocationPermissionCommon(allow);
     306}
     307
    302308void LayoutTestController::setIconDatabaseEnabled(bool iconDatabaseEnabled)
    303309{
Note: See TracChangeset for help on using the changeset viewer.