[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

steveblock at google.com steveblock at google.com
Wed Dec 22 11:42:15 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit c96470cd1b7ac464133db3cf6be40a336ba86ff1
Author: steveblock at google.com <steveblock at google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Aug 4 11:13:20 2010 +0000

    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
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@64639 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 27974fd..baeb617 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,18 @@
+2010-08-02  Steve Block  <steveblock at google.com>
+
+        Reviewed by Alexey Proskuryakov.
+
+        Adds Geolocation LayoutTests for the case where permission is not granted or denied immediately
+        https://bugs.webkit.org/show_bug.cgi?id=40002
+
+        * 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
+
 2010-08-03  Alexey Proskuryakov  <ap at apple.com>
 
         Reviewed by Sam Weinig.
diff --git a/LayoutTests/fast/dom/Geolocation/delayed-permission-allowed-expected.txt b/LayoutTests/fast/dom/Geolocation/delayed-permission-allowed-expected.txt
new file mode 100644
index 0000000..bfe4f75
--- /dev/null
+++ b/LayoutTests/fast/dom/Geolocation/delayed-permission-allowed-expected.txt
@@ -0,0 +1,10 @@
+Tests that when a position is available, no callbacks are invoked until permission is allowed.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS Success callback invoked
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/dom/Geolocation/delayed-permission-allowed.html b/LayoutTests/fast/dom/Geolocation/delayed-permission-allowed.html
new file mode 100644
index 0000000..cacdd85
--- /dev/null
+++ b/LayoutTests/fast/dom/Geolocation/delayed-permission-allowed.html
@@ -0,0 +1,13 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href="../../js/resources/js-test-style.css">
+<script src="../../js/resources/js-test-pre.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script src="script-tests/delayed-permission-allowed.js"></script>
+<script src="../../js/resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/fast/dom/Geolocation/delayed-permission-denied-expected.txt b/LayoutTests/fast/dom/Geolocation/delayed-permission-denied-expected.txt
new file mode 100644
index 0000000..292e2ee
--- /dev/null
+++ b/LayoutTests/fast/dom/Geolocation/delayed-permission-denied-expected.txt
@@ -0,0 +1,11 @@
+Tests that when a position is available, no callbacks are invoked until permission is denied.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS error.code is error.PERMISSION_DENIED
+PASS error.message is "User denied Geolocation"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/dom/Geolocation/delayed-permission-denied.html b/LayoutTests/fast/dom/Geolocation/delayed-permission-denied.html
new file mode 100644
index 0000000..0faec6e
--- /dev/null
+++ b/LayoutTests/fast/dom/Geolocation/delayed-permission-denied.html
@@ -0,0 +1,13 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href="../../js/resources/js-test-style.css">
+<script src="../../js/resources/js-test-pre.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script src="script-tests/delayed-permission-denied.js"></script>
+<script src="../../js/resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/fast/dom/Geolocation/script-tests/delayed-permission-allowed.js b/LayoutTests/fast/dom/Geolocation/script-tests/delayed-permission-allowed.js
new file mode 100644
index 0000000..f4242ca
--- /dev/null
+++ b/LayoutTests/fast/dom/Geolocation/script-tests/delayed-permission-allowed.js
@@ -0,0 +1,27 @@
+description("Tests that when a position is available, no callbacks are invoked until permission is allowed.");
+
+if (window.layoutTestController)
+    window.layoutTestController.setMockGeolocationPosition(51.478, -0.166, 100);
+
+function allowPermission() {
+    permissionSet = true;
+    if (window.layoutTestController)
+        layoutTestController.setGeolocationPermission(true);
+}
+
+navigator.geolocation.getCurrentPosition(function() {
+    if (permissionSet) {
+        testPassed('Success callback invoked');
+        finishJSTest();
+        return;
+    }
+    testFailed('Success callback invoked unexpectedly');
+    finishJSTest();
+}, function() {
+    testFailed('Error callback invoked unexpectedly');
+    finishJSTest();
+});
+window.setTimeout(allowPermission, 100);
+
+window.jsTestIsAsync = true;
+window.successfullyParsed = true;
diff --git a/LayoutTests/fast/dom/Geolocation/script-tests/delayed-permission-denied.js b/LayoutTests/fast/dom/Geolocation/script-tests/delayed-permission-denied.js
new file mode 100644
index 0000000..aebd302
--- /dev/null
+++ b/LayoutTests/fast/dom/Geolocation/script-tests/delayed-permission-denied.js
@@ -0,0 +1,30 @@
+description("Tests that when a position is available, no callbacks are invoked until permission is denied.");
+
+if (window.layoutTestController)
+    window.layoutTestController.setMockGeolocationPosition(51.478, -0.166, 100);
+
+function denyPermission() {
+    permissionSet = true;
+    if (window.layoutTestController)
+        layoutTestController.setGeolocationPermission(false);
+}
+
+var error;
+navigator.geolocation.getCurrentPosition(function() {
+    testFailed('Success callback invoked unexpectedly');
+    finishJSTest();
+}, function(e) {
+    if (permissionSet) {
+        error = e;
+        shouldBe('error.code', 'error.PERMISSION_DENIED');
+        shouldBe('error.message', '"User denied Geolocation"');
+        finishJSTest();
+        return;
+    }
+    testFailed('Error callback invoked unexpectedly');
+    finishJSTest();
+});
+window.setTimeout(denyPermission, 100);
+
+window.jsTestIsAsync = true;
+window.successfullyParsed = true;
diff --git a/LayoutTests/platform/gtk/Skipped b/LayoutTests/platform/gtk/Skipped
index 1cbda92..dadb38b 100644
--- a/LayoutTests/platform/gtk/Skipped
+++ b/LayoutTests/platform/gtk/Skipped
@@ -1087,6 +1087,8 @@ fast/dom/DeviceOrientation/create-event.html
 fast/dom/DeviceOrientation/optional-event-properties.html
 fast/dom/DeviceOrientation/window-property.html
 fast/dom/Geolocation/callback-exception.html
+fast/dom/Geolocation/delayed-permission-allowed.html
+fast/dom/Geolocation/delayed-permission-denied.html
 fast/dom/Geolocation/error.html
 fast/dom/Geolocation/multiple-requests.html
 fast/dom/Geolocation/permission-denied-already-clear-watch.html
diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index 2c05ac5..e8b6568 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,42 @@
+2010-08-02  Steve Block  <steveblock at google.com>
+
+        Reviewed by Alexey Proskuryakov.
+
+        Adds Geolocation LayoutTests for the case where permission is not granted or denied immediately
+        https://bugs.webkit.org/show_bug.cgi?id=40002
+
+        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):
+
 2010-08-03  Kent Tamura  <tkent at chromium.org>
 
         Reviewed by Dimitri Glazkov.
diff --git a/WebKitTools/DumpRenderTree/LayoutTestController.cpp b/WebKitTools/DumpRenderTree/LayoutTestController.cpp
index 3d91e0c..27e4c90 100644
--- a/WebKitTools/DumpRenderTree/LayoutTestController.cpp
+++ b/WebKitTools/DumpRenderTree/LayoutTestController.cpp
@@ -1975,7 +1975,7 @@ void LayoutTestController::waitToDumpWatchdogTimerFired()
     notifyDone();
 }
 
-void LayoutTestController::setGeolocationPermission(bool allow)
+void LayoutTestController::setGeolocationPermissionCommon(bool allow)
 {
     m_isGeolocationPermissionSet = true;
     m_geolocationPermission = allow;
diff --git a/WebKitTools/DumpRenderTree/LayoutTestController.h b/WebKitTools/DumpRenderTree/LayoutTestController.h
index 9d15f4c..811d0cb 100644
--- a/WebKitTools/DumpRenderTree/LayoutTestController.h
+++ b/WebKitTools/DumpRenderTree/LayoutTestController.h
@@ -292,6 +292,8 @@ public:
 private:
     LayoutTestController(const std::string& testPathOrURL, const std::string& expectedPixelHash);
 
+    void setGeolocationPermissionCommon(bool allow);
+
     bool m_dumpApplicationCacheDelegateCallbacks;
     bool m_dumpAsPDF;
     bool m_dumpAsText;
diff --git a/WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp b/WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp
index 29a96f1..227e1cc 100644
--- a/WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp
+++ b/WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp
@@ -462,6 +462,12 @@ void LayoutTestController::setMockGeolocationError(int code, JSStringRef message
     // See https://bugs.webkit.org/show_bug.cgi?id=28264.
 }
 
+void LayoutTestController::setGeolocationPermission(bool allow)
+{
+    // FIXME: Implement for Geolocation layout tests.
+    setGeolocationPermissionCommon(allow);
+}
+
 void LayoutTestController::setIconDatabaseEnabled(bool flag)
 {
     // FIXME: implement
diff --git a/WebKitTools/DumpRenderTree/mac/LayoutTestControllerMac.mm b/WebKitTools/DumpRenderTree/mac/LayoutTestControllerMac.mm
index 5edf811..66ada91 100644
--- a/WebKitTools/DumpRenderTree/mac/LayoutTestControllerMac.mm
+++ b/WebKitTools/DumpRenderTree/mac/LayoutTestControllerMac.mm
@@ -33,6 +33,7 @@
 #import "EditingDelegate.h"
 #import "MockGeolocationProvider.h"
 #import "PolicyDelegate.h"
+#import "UIDelegate.h"
 #import "WorkQueue.h"
 #import "WorkQueueItem.h"
 #import <Foundation/Foundation.h>
@@ -355,6 +356,12 @@ void LayoutTestController::setMockGeolocationError(int code, JSStringRef message
     [[MockGeolocationProvider shared] setError:error];
 }
 
+void LayoutTestController::setGeolocationPermission(bool allow)
+{
+    setGeolocationPermissionCommon(allow);
+    [[[mainFrame webView] UIDelegate] didSetMockGeolocationPermission];
+}
+
 void LayoutTestController::setIconDatabaseEnabled(bool iconDatabaseEnabled)
 {
     // FIXME: Workaround <rdar://problem/6480108>
diff --git a/WebKitTools/DumpRenderTree/mac/MockGeolocationProvider.mm b/WebKitTools/DumpRenderTree/mac/MockGeolocationProvider.mm
index 55d7257..e03cae2 100644
--- a/WebKitTools/DumpRenderTree/mac/MockGeolocationProvider.mm
+++ b/WebKitTools/DumpRenderTree/mac/MockGeolocationProvider.mm
@@ -74,6 +74,9 @@
 - (void)registerWebView:(WebView *)webView
 {
     _registeredViews.add(webView);
+
+    if (!_timer)
+        _timer = [NSTimer scheduledTimerWithTimeInterval:0 target:self selector:@selector(timerFired) userInfo:0 repeats:NO];
 }
 
 - (void)unregisterWebView:(WebView *)webView
diff --git a/WebKitTools/DumpRenderTree/mac/UIDelegate.h b/WebKitTools/DumpRenderTree/mac/UIDelegate.h
index da472d6..a8017ad 100644
--- a/WebKitTools/DumpRenderTree/mac/UIDelegate.h
+++ b/WebKitTools/DumpRenderTree/mac/UIDelegate.h
@@ -32,6 +32,10 @@
 
 @private
     NSRect m_frame;
+    NSMutableSet *m_pendingGeolocationPermissionListeners;
+    NSTimer *m_timer;
 }
 
+- (void)didSetMockGeolocationPermission;
+
 @end
diff --git a/WebKitTools/DumpRenderTree/mac/UIDelegate.mm b/WebKitTools/DumpRenderTree/mac/UIDelegate.mm
index 5dba720..f9afdb1 100644
--- a/WebKitTools/DumpRenderTree/mac/UIDelegate.mm
+++ b/WebKitTools/DumpRenderTree/mac/UIDelegate.mm
@@ -185,13 +185,43 @@ DumpRenderTreeDraggingInfo *draggingInfo = nil;
 
 - (void)webView:(WebView *)webView decidePolicyForGeolocationRequestFromOrigin:(WebSecurityOrigin *)origin frame:(WebFrame *)frame listener:(id<WebGeolocationPolicyListener>)listener
 {
-    // FIXME: If mock permission isn't set yet, we should send the response asynchronously.
-    if (gLayoutTestController->isGeolocationPermissionSet() && gLayoutTestController->geolocationPermission())
+    if (!gLayoutTestController->isGeolocationPermissionSet()) {
+        if (!m_pendingGeolocationPermissionListeners)
+            m_pendingGeolocationPermissionListeners = [[NSMutableSet set] retain];
+        [m_pendingGeolocationPermissionListeners addObject:listener];
+        return;
+    }
+
+    if (gLayoutTestController->geolocationPermission())
         [listener allow];
     else
         [listener deny];
 }
 
+- (void)didSetMockGeolocationPermission
+{
+    ASSERT(gLayoutTestController->isGeolocationPermissionSet());
+    if (m_pendingGeolocationPermissionListeners && !m_timer)
+        m_timer = [NSTimer scheduledTimerWithTimeInterval:0 target:self selector:@selector(timerFired) userInfo:0 repeats:NO];
+}
+
+- (void)timerFired
+{
+    ASSERT(gLayoutTestController->isGeolocationPermissionSet());
+    m_timer = 0;
+    NSEnumerator* enumerator = [m_pendingGeolocationPermissionListeners objectEnumerator];
+    id<WebGeolocationPolicyListener> listener;
+    while ((listener = [enumerator nextObject])) {
+        if (gLayoutTestController->geolocationPermission())
+            [listener allow];
+        else
+            [listener deny];
+    }
+    [m_pendingGeolocationPermissionListeners removeAllObjects];
+    [m_pendingGeolocationPermissionListeners release];
+    m_pendingGeolocationPermissionListeners = nil;
+}
+
 - (BOOL)webView:(WebView *)sender shouldHaltPlugin:(DOMNode *)pluginNode
 {
     return NO;
@@ -207,6 +237,8 @@ DumpRenderTreeDraggingInfo *draggingInfo = nil;
 {
     [draggingInfo release];
     draggingInfo = nil;
+    [m_pendingGeolocationPermissionListeners release];
+    m_pendingGeolocationPermissionListeners = nil;
 
     [super dealloc];
 }
diff --git a/WebKitTools/DumpRenderTree/win/LayoutTestControllerWin.cpp b/WebKitTools/DumpRenderTree/win/LayoutTestControllerWin.cpp
index 1755ddf..ade09a7 100644
--- a/WebKitTools/DumpRenderTree/win/LayoutTestControllerWin.cpp
+++ b/WebKitTools/DumpRenderTree/win/LayoutTestControllerWin.cpp
@@ -393,6 +393,12 @@ void LayoutTestController::setMockGeolocationError(int code, JSStringRef message
     // See https://bugs.webkit.org/show_bug.cgi?id=28264.
 }
 
+void LayoutTestController::setGeolocationPermission(bool allow)
+{
+    // FIXME: Implement for Geolocation layout tests.
+    setGeolocationPermissionCommon(allow);
+}
+
 void LayoutTestController::setIconDatabaseEnabled(bool iconDatabaseEnabled)
 {
     // See also <rdar://problem/6480108>
diff --git a/WebKitTools/DumpRenderTree/wx/LayoutTestControllerWx.cpp b/WebKitTools/DumpRenderTree/wx/LayoutTestControllerWx.cpp
index c844942..f969f36 100644
--- a/WebKitTools/DumpRenderTree/wx/LayoutTestControllerWx.cpp
+++ b/WebKitTools/DumpRenderTree/wx/LayoutTestControllerWx.cpp
@@ -299,6 +299,12 @@ void LayoutTestController::setMockGeolocationError(int code, JSStringRef message
     // See https://bugs.webkit.org/show_bug.cgi?id=28264.
 }
 
+void LayoutTestController::setGeolocationPermission(bool allow)
+{
+    // FIXME: Implement for Geolocation layout tests.
+    setGeolocationPermissionCommon(allow);
+}
+
 void LayoutTestController::setIconDatabaseEnabled(bool iconDatabaseEnabled)
 {
     // FIXME: implement

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list