Source/WebCore: [Mac] Add SPI to WK1 to retrieve internal IDs for web notifications
authorjonlee@apple.com <jonlee@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 28 Aug 2012 19:08:32 +0000 (19:08 +0000)
committerjonlee@apple.com <jonlee@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 28 Aug 2012 19:08:32 +0000 (19:08 +0000)
https://bugs.webkit.org/show_bug.cgi?id=95099
<rdar://problem/12180186>

Reviewed by Jessie Berlin.

This is work toward providing Mac support for web notifications in DRT and WTR (77969).

Expose functions to convert JSValue to Notification, and to get the NotificationController from a page.

* WebCore.exp.in:
* WebCore.xcodeproj/project.pbxproj: Promote NotificationController.h and JSNotification.h to private headers.

Source/WebKit/mac: [Mac] Add SPI to WK1 to retrieve internal IDs for web notifications
https://bugs.webkit.org/show_bug.cgi?id=95099
<rdar://problem/12180186>

Reviewed by Jessie Berlin.

This is work toward providing Mac support for web notifications in DRT and WTR (77969).

Add function to retrieve the internal ID for a notification. This is needed by layout tests to support simulating
a user click on a notification.

* WebCoreSupport/WebNotificationClient.h:
(WebNotificationClient):
* WebCoreSupport/WebNotificationClient.mm:
(WebNotificationClient::notificationIDForTesting): Converts the JS notification to a WebCore notification, and passes
that to [WebView _notificationIDForTesting:].
* WebView/WebView.mm:
(-[WebView _notificationIDForTesting:]): Retrieves the notification ID based on the WebCore notification instance.
* WebView/WebViewPrivate.h:

Tools: Update TestRunner API for web notifications
https://bugs.webkit.org/show_bug.cgi?id=95093
<rdar://problem/12179649>

Reviewed by Jessie Berlin.

This is work toward providing Mac support for web notifications in DRT and WTR (77969).

Some of the legacy APIs are less than ideal, and not tenable with the WTR infrastructure.
This first patch renames the TestRunner calls to use the term "web notifications" instead of
"desktop notifications", deprecates a couple API calls that are not used by anyone, and adds
additional calls that will be used in the tests that test the standard API.

* DumpRenderTree/TestRunner.h:
(TestRunner): For consistency, rename a couple member variables. Remove unused checkDesktopNotificationPermission()
and areDesktopNotificationPermissionRequestsIgnored(). Remove origin mapping since each port implements its own solution.
* DumpRenderTree/TestRunner.cpp: Push grantWebNotificationPermission() to individual ports.
(TestRunner::TestRunner):
(ignoreLegacyWebNotificationPermissionRequestsCallback): Renamed.
(simulateLegacyWebNotificationClickCallback): Renamed.
(grantWebNotificationPermissionCallback): Renamed.
(denyWebNotificationPermissionCallback): Added.
(removeAllWebNotificationPermissionsCallback): Added.
(simulateWebNotificationClickCallback): Added.
(TestRunner::staticFunctions):
(TestRunner::ignoreLegacyWebNotificationPermissionRequests):

* DumpRenderTree/chromium/DRTTestRunner.cpp:
(DRTTestRunner::DRTTestRunner): Added bindings for new APIs.
(DRTTestRunner::grantWebNotificationPermission):
(DRTTestRunner::denyWebNotificationPermission): Stub.
(DRTTestRunner::removeAllWebNotificationPermissions): Stub.
(DRTTestRunner::simulateWebNotificationClick): Stub.
(DRTTestRunner::simulateLegacyWebNotificationClick):
* DumpRenderTree/chromium/DRTTestRunner.h:
(DRTTestRunner):

Added stubs.
* DumpRenderTree/blackberry/TestRunnerBlackBerry.cpp:
* DumpRenderTree/efl/TestRunnerEfl.cpp:
* DumpRenderTree/gtk/TestRunnerGtk.cpp:
* DumpRenderTree/mac/TestRunnerMac.mm: Later patch will contain implementation of this API.
* DumpRenderTree/qt/TestRunnerQt.cpp: Added Qt-based stubs.
* DumpRenderTree/win/TestRunnerWin.cpp:

LayoutTests: Update TestRunner API for web notifications
https://bugs.webkit.org/show_bug.cgi?id=95093
<rdar://problem/12179649>

Reviewed by Jessie Berlin.

This is work toward providing Mac support for web notifications in DRT and WTR (77969).

Refactor the tests to use the renamed legacy API calls.

* fast/notifications/notifications-check-permission.html:
* fast/notifications/notifications-click-event-focus.html:
* fast/notifications/notifications-click-event.html:
* fast/notifications/notifications-display-close-events.html:
* fast/notifications/notifications-document-close-crash.html: Also, convert from Windows to UNIX line endings.
* fast/notifications/notifications-double-show.html:
* fast/notifications/notifications-event-stop-propagation.html-disabled:
* fast/notifications/notifications-multi-events.html-disabled:
* fast/notifications/notifications-no-icon.html:
* fast/notifications/notifications-replace.html:
* fast/notifications/notifications-rtl.html:
* fast/notifications/notifications-with-permission.html:
* fast/notifications/notifications-without-permission.html:
* fast/notifications/resources/notifications-cancel-request-permission.html:
* platform/qt-5.0-wk2/Skipped:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@126909 268f45cc-cd09-0410-ab3c-d52691b4dbfc

36 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/notifications/notifications-check-permission.html
LayoutTests/fast/notifications/notifications-click-event-focus.html
LayoutTests/fast/notifications/notifications-click-event.html
LayoutTests/fast/notifications/notifications-display-close-events.html
LayoutTests/fast/notifications/notifications-document-close-crash.html
LayoutTests/fast/notifications/notifications-double-show.html
LayoutTests/fast/notifications/notifications-event-stop-propagation.html-disabled
LayoutTests/fast/notifications/notifications-multi-events.html-disabled
LayoutTests/fast/notifications/notifications-no-icon.html
LayoutTests/fast/notifications/notifications-replace.html
LayoutTests/fast/notifications/notifications-rtl.html
LayoutTests/fast/notifications/notifications-with-permission.html
LayoutTests/fast/notifications/notifications-without-permission.html
LayoutTests/fast/notifications/resources/notifications-cancel-request-permission.html
LayoutTests/platform/qt-5.0-wk2/Skipped
Source/WebCore/ChangeLog
Source/WebCore/WebCore.exp.in
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/WebCoreSupport/WebNotificationClient.h
Source/WebKit/mac/WebCoreSupport/WebNotificationClient.mm
Source/WebKit/mac/WebView/WebView.mm
Source/WebKit/mac/WebView/WebViewPrivate.h
Tools/ChangeLog
Tools/DumpRenderTree/TestRunner.cpp
Tools/DumpRenderTree/TestRunner.h
Tools/DumpRenderTree/blackberry/TestRunnerBlackBerry.cpp
Tools/DumpRenderTree/chromium/DRTTestRunner.cpp
Tools/DumpRenderTree/chromium/DRTTestRunner.h
Tools/DumpRenderTree/efl/TestRunnerEfl.cpp
Tools/DumpRenderTree/gtk/TestRunnerGtk.cpp
Tools/DumpRenderTree/mac/TestRunnerMac.mm
Tools/DumpRenderTree/qt/TestRunnerQt.cpp
Tools/DumpRenderTree/qt/TestRunnerQt.h
Tools/DumpRenderTree/win/TestRunnerWin.cpp

index d069d0f..901d651 100644 (file)
@@ -1,3 +1,31 @@
+2012-08-24  Jon Lee  <jonlee@apple.com>
+
+        Update TestRunner API for web notifications
+        https://bugs.webkit.org/show_bug.cgi?id=95093
+        <rdar://problem/12179649>
+
+        Reviewed by Jessie Berlin.
+
+        This is work toward providing Mac support for web notifications in DRT and WTR (77969).
+
+        Refactor the tests to use the renamed legacy API calls.
+
+        * fast/notifications/notifications-check-permission.html:
+        * fast/notifications/notifications-click-event-focus.html:
+        * fast/notifications/notifications-click-event.html:
+        * fast/notifications/notifications-display-close-events.html:
+        * fast/notifications/notifications-document-close-crash.html: Also, convert from Windows to UNIX line endings.
+        * fast/notifications/notifications-double-show.html:
+        * fast/notifications/notifications-event-stop-propagation.html-disabled:
+        * fast/notifications/notifications-multi-events.html-disabled:
+        * fast/notifications/notifications-no-icon.html:
+        * fast/notifications/notifications-replace.html:
+        * fast/notifications/notifications-rtl.html:
+        * fast/notifications/notifications-with-permission.html:
+        * fast/notifications/notifications-without-permission.html:
+        * fast/notifications/resources/notifications-cancel-request-permission.html:
+        * platform/qt-5.0-wk2/Skipped:
+
 2012-08-28  Dominic Mazzoni  <dmazzoni@google.com>
 
         AX: Should be able to tab to focus a link in a canvas subtree
index 591bc91..c893858 100644 (file)
@@ -25,7 +25,7 @@
             }
             
             if (window.testRunner) {
-                testRunner.grantDesktopNotificationPermission("file://");
+                testRunner.grantWebNotificationPermission("file://");
             }
             
             N = window.webkitNotifications.checkPermission();
index ceee195..bb39a0c 100644 (file)
@@ -10,7 +10,7 @@
         function runTests()
         {
             if (window.testRunner) {
-                testRunner.grantDesktopNotificationPermission("file://");
+                testRunner.grantWebNotificationPermission("file://");
                 testRunner.dumpAsText();
                 testRunner.waitUntilDone();
                 testRunner.setCanOpenWindows();
@@ -32,7 +32,7 @@
             N.show();
 
             if (window.testRunner) {
-                testRunner.simulateDesktopNotificationClick("New E-mail");
+                testRunner.simulateLegacyWebNotificationClick("New E-mail");
                 testRunner.notifyDone();
             }
         }
index 0ee7fd9..5836a5b 100644 (file)
@@ -10,7 +10,7 @@
         function runTests()
         {
             if (window.testRunner) {
-                testRunner.grantDesktopNotificationPermission("file://");
+                testRunner.grantWebNotificationPermission("file://");
                 testRunner.dumpAsText();
                 testRunner.waitUntilDone();
             }
@@ -23,7 +23,7 @@
             N.onclick = function() { log("PASS: click event fired."); N.cancel();  }
             N.show();
             if (window.testRunner) {
-                testRunner.simulateDesktopNotificationClick("New E-mail");
+                testRunner.simulateLegacyWebNotificationClick("New E-mail");
                 testRunner.notifyDone();
             }
         }
index 794ca44..3147048 100644 (file)
@@ -10,7 +10,7 @@
         function runTests()
         {
             if (window.testRunner) {
-                testRunner.grantDesktopNotificationPermission("file://");
+                testRunner.grantWebNotificationPermission("file://");
                 testRunner.dumpAsText();
                 testRunner.waitUntilDone();
             }
index 7b3ba2d..37ac369 100644 (file)
@@ -1,50 +1,50 @@
-<html>\r
-    <body>\r
-        <div id="result"></div>\r
-        <script>\r
-            if (window.testRunner)\r
-            {\r
-                testRunner.dumpAsText();\r
-                testRunner.setCanOpenWindows();\r
-                testRunner.grantDesktopNotificationPermission("file://");\r
-                testRunner.waitUntilDone();\r
-            }\r
-            \r
-            if (!window.webkitNotifications) {\r
-                log("FAIL: No webkitNotifications interface!");\r
-            }\r
-\r
-            var target = window.open("about:blank");\r
-            var notification = target.webkitNotifications;\r
-            target.location.reload();\r
-            var timer = setInterval("crash()", 60);\r
-            setTimeout("finish()", 100);\r
-\r
-            function crash()\r
-            {\r
-                var a = [];\r
-                for (var i = 0; i < 0x100; i++)\r
-                {\r
-                    try\r
-                    {\r
-                        a.push(new WebGLByteArray());\r
-                    } \r
-                    catch (e) {}\r
-                    a.push(Array(i).join("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"));\r
-                }\r
-                delete a;\r
-                notification.requestPermission();\r
-            }\r
-            \r
-            function finish()\r
-            {\r
-                clearInterval(timer);\r
-                document.getElementById("result").innerHTML = "PASS";\r
-                target.close();\r
-                if (window.testRunner)\r
-                    testRunner.notifyDone();\r
-            }\r
-        </script>\r
-    </body>\r
-</html>\r
-\r
+<html>
+    <body>
+        <div id="result"></div>
+        <script>
+            if (window.testRunner)
+            {
+                testRunner.dumpAsText();
+                testRunner.setCanOpenWindows();
+                testRunner.grantWebNotificationPermission("file://");
+                testRunner.waitUntilDone();
+            }
+
+            if (!window.webkitNotifications) {
+                log("FAIL: No webkitNotifications interface!");
+            }
+
+            var target = window.open("about:blank");
+            var notification = target.webkitNotifications;
+            target.location.reload();
+            var timer = setInterval("crash()", 60);
+            setTimeout("finish()", 100);
+
+            function crash()
+            {
+                var a = [];
+                for (var i = 0; i < 0x100; i++)
+                {
+                    try
+                    {
+                        a.push(new WebGLByteArray());
+                    }
+                    catch (e) {}
+                    a.push(Array(i).join("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"));
+                }
+                delete a;
+                notification.requestPermission();
+            }
+
+            function finish()
+            {
+                clearInterval(timer);
+                document.getElementById("result").innerHTML = "PASS";
+                target.close();
+                if (window.testRunner)
+                    testRunner.notifyDone();
+            }
+        </script>
+    </body>
+</html>
+
index 8c6f7bc..5b0ca3f 100644 (file)
@@ -10,7 +10,7 @@
         function runTests()
         {
             if (window.testRunner) {
-                testRunner.grantDesktopNotificationPermission("file://");
+                testRunner.grantWebNotificationPermission("file://");
                 testRunner.dumpAsText();
                 testRunner.waitUntilDone();
             }
index 4edb8f9..2d8d043 100644 (file)
@@ -10,7 +10,7 @@
         function runTests()
         {
             if (window.testRunner) {
-                testRunner.grantDesktopNotificationPermission("file://");
+                testRunner.grantWebNotificationPermission("file://");
                 testRunner.dumpAsText();
             }
 
index 3270f23..7244828 100644 (file)
@@ -10,7 +10,7 @@
         function runTests()
         {
             if (window.testRunner) {
-                testRunner.grantDesktopNotificationPermission("file://");
+                testRunner.grantWebNotificationPermission("file://");
                 testRunner.dumpAsText();
             }
 
index b062943..489b7f5 100644 (file)
@@ -10,7 +10,7 @@
         function runTests()
         {
             if (window.testRunner) {
-                testRunner.grantDesktopNotificationPermission("file://");
+                testRunner.grantWebNotificationPermission("file://");
                 testRunner.dumpAsText();
             }
 
index 24b9ced..e3cdaf2 100644 (file)
@@ -10,7 +10,7 @@
         function runTests()
         {
             if (window.testRunner) {
-                testRunner.grantDesktopNotificationPermission("file://");
+                testRunner.grantWebNotificationPermission("file://");
                 testRunner.dumpAsText();
             }
 
index 6abdf68..c4fde3d 100644 (file)
@@ -10,7 +10,7 @@
         function runTests()
         {
             if (window.testRunner) {
-                testRunner.grantDesktopNotificationPermission("file://");
+                testRunner.grantWebNotificationPermission("file://");
                 testRunner.dumpAsText();
             }
 
index 54161a4..e0ea3e0 100644 (file)
@@ -10,7 +10,7 @@
         function runTests()
         {
             if (window.testRunner) {
-                testRunner.grantDesktopNotificationPermission("file://");
+                testRunner.grantWebNotificationPermission("file://");
                 testRunner.dumpAsText();
                 testRunner.waitUntilDone();
             }
index 654a294..40ae65a 100644 (file)
@@ -10,7 +10,7 @@
         function runTests()
         {
             if (window.testRunner) {
-                // NO PERMISSION testRunner.grantDesktopNotificationPermission("file://");
+                // NO PERMISSION testRunner.grantWebNotificationPermission("file://");
                 testRunner.dumpAsText();
             }
 
index 7b4cb4c..43897c9 100644 (file)
@@ -13,7 +13,7 @@
             }
 
             if (window.testRunner) {
-                testRunner.ignoreDesktopNotificationPermissionRequests();
+                testRunner.ignoreLegacyWebNotificationPermissionRequests();
             }
 
             window.webkitNotifications.requestPermission(
index f365637..a564b5b 100644 (file)
@@ -141,7 +141,7 @@ fast/text/format-control.html
 fast/url/anchor.html
 http/tests/websocket/tests/hixie76/bad-sub-protocol-non-ascii.html
 
-# layoutTestController.ignoreDesktopNotificationPermissionRequests is unimplemented
+# layoutTestController.ignoreLegacyWebNotificationPermissionRequests is unimplemented
 fast/notifications
 
 # layoutTestController.setScrollbarPolicy is unimplemented
index 7d3688d..fe83c6c 100644 (file)
@@ -1,3 +1,18 @@
+2012-08-27  Jon Lee  <jonlee@apple.com>
+
+        [Mac] Add SPI to WK1 to retrieve internal IDs for web notifications
+        https://bugs.webkit.org/show_bug.cgi?id=95099
+        <rdar://problem/12180186>
+
+        Reviewed by Jessie Berlin.
+
+        This is work toward providing Mac support for web notifications in DRT and WTR (77969).
+
+        Expose functions to convert JSValue to Notification, and to get the NotificationController from a page.
+
+        * WebCore.exp.in:
+        * WebCore.xcodeproj/project.pbxproj: Promote NotificationController.h and JSNotification.h to private headers.
+
 2012-08-28  Dominic Mazzoni  <dmazzoni@google.com>
 
         AX: Should be able to tab to focus a link in a canvas subtree
index dd677fd..bea14d8 100644 (file)
@@ -2323,7 +2323,9 @@ __ZN7WebCore12Notification17dispatchShowEventEv
 __ZN7WebCore12Notification18dispatchClickEventEv
 __ZN7WebCore12Notification18dispatchCloseEventEv
 __ZN7WebCore12Notification18dispatchErrorEventEv
+__ZN7WebCore14toNotificationEN3JSC7JSValueE
 __ZN7WebCore19provideNotificationEPNS_4PageEPNS_18NotificationClientE
+__ZN7WebCore22NotificationController10clientFromEPNS_4PageE
 #endif
 
 #if ENABLE(NOTIFICATIONS)
index fa76592..f540881 100644 (file)
                31288E740E3005D6003619AE /* WebKitCSSKeyframesRule.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 31288E700E3005D6003619AE /* WebKitCSSKeyframesRule.cpp */; };
                31288E750E3005D6003619AE /* WebKitCSSKeyframesRule.h in Headers */ = {isa = PBXBuildFile; fileRef = 31288E710E3005D6003619AE /* WebKitCSSKeyframesRule.h */; };
                3128CA68147331520074C72A /* NotificationController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3128CA67147331520074C72A /* NotificationController.cpp */; };
-               3128CA6B147331630074C72A /* NotificationController.h in Headers */ = {isa = PBXBuildFile; fileRef = 3128CA6A147331630074C72A /* NotificationController.h */; };
+               3128CA6B147331630074C72A /* NotificationController.h in Headers */ = {isa = PBXBuildFile; fileRef = 3128CA6A147331630074C72A /* NotificationController.h */; settings = {ATTRIBUTES = (Private, ); }; };
                312C0C41146DC6CC0016C911 /* Notification.h in Headers */ = {isa = PBXBuildFile; fileRef = 333F704F0FB49CA2008E12A6 /* Notification.h */; settings = {ATTRIBUTES = (Private, ); }; };
                312D67B11535691F00563D0D /* Dictionary.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 312D67B01535691F00563D0D /* Dictionary.cpp */; };
                31313F651443B35F006E2A90 /* FilterEffectRenderer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 31313F631443B35E006E2A90 /* FilterEffectRenderer.cpp */; };
                3314ACEC10892086000F0E56 /* JSExceptionBase.h in Headers */ = {isa = PBXBuildFile; fileRef = 3314ACEA10892086000F0E56 /* JSExceptionBase.h */; };
                33503C9A10179A74003B47E1 /* NotificationClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 33503C9910179A74003B47E1 /* NotificationClient.h */; settings = {ATTRIBUTES = (Private, ); }; };
                33503CA310179AD7003B47E1 /* JSNotification.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 33503C9F10179AD7003B47E1 /* JSNotification.cpp */; };
-               33503CA410179AD7003B47E1 /* JSNotification.h in Headers */ = {isa = PBXBuildFile; fileRef = 33503CA010179AD7003B47E1 /* JSNotification.h */; };
+               33503CA410179AD7003B47E1 /* JSNotification.h in Headers */ = {isa = PBXBuildFile; fileRef = 33503CA010179AD7003B47E1 /* JSNotification.h */; settings = {ATTRIBUTES = (Private, ); }; };
                33503CA510179AD7003B47E1 /* JSNotificationCenter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 33503CA110179AD7003B47E1 /* JSNotificationCenter.cpp */; };
                33503CA610179AD7003B47E1 /* JSNotificationCenter.h in Headers */ = {isa = PBXBuildFile; fileRef = 33503CA210179AD7003B47E1 /* JSNotificationCenter.h */; };
                33503CC010179C1A003B47E1 /* JSDesktopNotificationsCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 33503CBF10179C1A003B47E1 /* JSDesktopNotificationsCustom.cpp */; };
index 5907a36..5db57e0 100644 (file)
@@ -1,3 +1,25 @@
+2012-08-28  Jon Lee  <jonlee@apple.com>
+
+        [Mac] Add SPI to WK1 to retrieve internal IDs for web notifications
+        https://bugs.webkit.org/show_bug.cgi?id=95099
+        <rdar://problem/12180186>
+
+        Reviewed by Jessie Berlin.
+
+        This is work toward providing Mac support for web notifications in DRT and WTR (77969).
+
+        Add function to retrieve the internal ID for a notification. This is needed by layout tests to support simulating
+        a user click on a notification.
+
+        * WebCoreSupport/WebNotificationClient.h:
+        (WebNotificationClient):
+        * WebCoreSupport/WebNotificationClient.mm:
+        (WebNotificationClient::notificationIDForTesting): Converts the JS notification to a WebCore notification, and passes
+        that to [WebView _notificationIDForTesting:].
+        * WebView/WebView.mm:
+        (-[WebView _notificationIDForTesting:]): Retrieves the notification ID based on the WebCore notification instance.
+        * WebView/WebViewPrivate.h:
+
 2012-08-27  Sheriff Bot  <webkit.review.bot@gmail.com>
 
         Unreviewed, rolling out r126836.
index 94535d3..d6949ea 100644 (file)
@@ -48,6 +48,11 @@ public:
     WebNotificationClient(WebView *);
     WebView *webView() { return m_webView; }
 
+#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
+    // For testing purposes.
+    uint64_t notificationIDForTesting(WebCore::Notification*);
+#endif
+
 private:
     virtual bool show(WebCore::Notification*) OVERRIDE;
     virtual void cancel(WebCore::Notification*) OVERRIDE;
index e2a05c6..fd8547a 100644 (file)
@@ -230,6 +230,11 @@ NotificationClient::Permission WebNotificationClient::checkPermission(ScriptExec
 }
 
 #if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
+uint64_t WebNotificationClient::notificationIDForTesting(WebCore::Notification* notification)
+{
+    return [m_notificationMap.get(notification).get() notificationID];
+}
+
 @implementation WebNotificationPolicyListener
 
 #if ENABLE(NOTIFICATIONS)
index 2bfaf24..6e55b26 100644 (file)
 #import <WebCore/JSDocument.h>
 #import <WebCore/JSElement.h>
 #import <WebCore/JSNodeList.h>
+#import <WebCore/JSNotification.h>
 #import <WebCore/Logging.h>
 #import <WebCore/MemoryPressureHandler.h>
 #import <WebCore/MIMETypeRegistry.h>
 #import <WebCore/NodeList.h>
+#import <WebCore/Notification.h>
+#import <WebCore/NotificationController.h>
 #import <WebCore/Page.h>
 #import <WebCore/PageCache.h>
 #import <WebCore/PageGroup.h>
@@ -6546,6 +6549,13 @@ static void glibContextIterationCallback(CFRunLoopObserverRef, CFRunLoopActivity
 {
     [[self _notificationProvider] webView:self didCloseNotifications:notificationIDs];
 }
+
+- (uint64_t)_notificationIDForTesting:(JSValueRef)jsNotification
+{
+    JSContextRef context = [[self mainFrame] globalContext];
+    WebCore::Notification* notification = toNotification(toJS(toJS(context), jsNotification));
+    return static_cast<WebNotificationClient*>(NotificationController::clientFrom(_private->page))->notificationIDForTesting(notification);
+}
 @end
 
 @implementation WebView (WebViewPrivateStyleInfo)
index c20daab..adb0ce9 100644 (file)
@@ -739,6 +739,8 @@ Could be worth adding to the API.
 - (void)_notificationDidShow:(uint64_t)notificationID;
 - (void)_notificationDidClick:(uint64_t)notificationID;
 - (void)_notificationsDidClose:(NSArray *)notificationIDs;
+
+- (uint64_t)_notificationIDForTesting:(JSValueRef)jsNotification;
 @end
 
 @interface WebView (WebViewPrivateStyleInfo)
index b009a00..2ed7e3c 100644 (file)
@@ -1,3 +1,50 @@
+2012-08-27  Jon Lee  <jonlee@apple.com>
+
+        Update TestRunner API for web notifications
+        https://bugs.webkit.org/show_bug.cgi?id=95093
+        <rdar://problem/12179649>
+
+        Reviewed by Jessie Berlin.
+
+        This is work toward providing Mac support for web notifications in DRT and WTR (77969).
+
+        Some of the legacy APIs are less than ideal, and not tenable with the WTR infrastructure.
+        This first patch renames the TestRunner calls to use the term "web notifications" instead of
+        "desktop notifications", deprecates a couple API calls that are not used by anyone, and adds
+        additional calls that will be used in the tests that test the standard API.
+
+        * DumpRenderTree/TestRunner.h:
+        (TestRunner): For consistency, rename a couple member variables. Remove unused checkDesktopNotificationPermission()
+        and areDesktopNotificationPermissionRequestsIgnored(). Remove origin mapping since each port implements its own solution.
+        * DumpRenderTree/TestRunner.cpp: Push grantWebNotificationPermission() to individual ports.
+        (TestRunner::TestRunner):
+        (ignoreLegacyWebNotificationPermissionRequestsCallback): Renamed.
+        (simulateLegacyWebNotificationClickCallback): Renamed.
+        (grantWebNotificationPermissionCallback): Renamed.
+        (denyWebNotificationPermissionCallback): Added.
+        (removeAllWebNotificationPermissionsCallback): Added.
+        (simulateWebNotificationClickCallback): Added.
+        (TestRunner::staticFunctions):
+        (TestRunner::ignoreLegacyWebNotificationPermissionRequests):
+
+        * DumpRenderTree/chromium/DRTTestRunner.cpp:
+        (DRTTestRunner::DRTTestRunner): Added bindings for new APIs.
+        (DRTTestRunner::grantWebNotificationPermission):
+        (DRTTestRunner::denyWebNotificationPermission): Stub.
+        (DRTTestRunner::removeAllWebNotificationPermissions): Stub.
+        (DRTTestRunner::simulateWebNotificationClick): Stub.
+        (DRTTestRunner::simulateLegacyWebNotificationClick):
+        * DumpRenderTree/chromium/DRTTestRunner.h:
+        (DRTTestRunner):
+
+        Added stubs.
+        * DumpRenderTree/blackberry/TestRunnerBlackBerry.cpp:
+        * DumpRenderTree/efl/TestRunnerEfl.cpp:
+        * DumpRenderTree/gtk/TestRunnerGtk.cpp:
+        * DumpRenderTree/mac/TestRunnerMac.mm: Later patch will contain implementation of this API.
+        * DumpRenderTree/qt/TestRunnerQt.cpp: Added Qt-based stubs.
+        * DumpRenderTree/win/TestRunnerWin.cpp:
+
 2012-08-28  Szilard Ledan  <szledan@inf.u-szeged.hu>
 
         [webkit-patch] gets stuck into an infinite loop if bugzilla doesn't respond in time.
index 229bf06..d5e799d 100644 (file)
@@ -92,7 +92,7 @@ TestRunner::TestRunner(const std::string& testPathOrURL, const std::string& expe
     , m_useDeferredFrameLoading(false)
     , m_shouldPaintBrokenImage(true)
     , m_shouldStayOnPageAfterHandlingBeforeUnload(false)
-    , m_areDesktopNotificationPermissionRequestsIgnored(false)
+    , m_areLegacyWebNotificationPermissionRequestsIgnored(false)
     , m_customFullScreenBehavior(false) 
     , m_testPathOrURL(testPathOrURL)
     , m_expectedPixelHash(expectedPixelHash)
@@ -648,19 +648,6 @@ static JSValueRef goBackCallback(JSContextRef context, JSObjectRef function, JSO
     return JSValueMakeUndefined(context);
 }
 
-static JSValueRef grantDesktopNotificationPermissionCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
-{
-    // Has Windows implementation
-    if (argumentCount < 1)
-        return JSValueMakeUndefined(context);
-
-    TestRunner* controller = static_cast<TestRunner*>(JSObjectGetPrivate(thisObject));
-
-    controller->grantDesktopNotificationPermission(JSValueToStringCopy(context, arguments[0], NULL));
-        
-    return JSValueMakeUndefined(context);
-}
-
 static JSValueRef isCommandEnabledCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
 {
     // Has Mac implementation.
@@ -2134,18 +2121,18 @@ static bool setGlobalFlagCallback(JSContextRef context, JSObjectRef thisObject,
     return true;
 }
 
-static JSValueRef ignoreDesktopNotificationPermissionRequestsCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+static JSValueRef ignoreLegacyWebNotificationPermissionRequestsCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
 {
     TestRunner* controller = static_cast<TestRunner*>(JSObjectGetPrivate(thisObject));
-    controller->ignoreDesktopNotificationPermissionRequests();
+    controller->ignoreLegacyWebNotificationPermissionRequests();
     return JSValueMakeUndefined(context);
 }
 
-static JSValueRef simulateDesktopNotificationClickCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+static JSValueRef simulateLegacyWebNotificationClickCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
 {
     TestRunner* controller = static_cast<TestRunner*>(JSObjectGetPrivate(thisObject)); 
     JSRetainPtr<JSStringRef> title(Adopt, JSValueToStringCopy(context, arguments[0], exception));
-    controller->simulateDesktopNotificationClick(title.get());
+    controller->simulateLegacyWebNotificationClick(title.get());
     return JSValueMakeUndefined(context);
 }
 
@@ -2200,6 +2187,59 @@ static JSValueRef setStorageDatabaseIdleIntervalCallback(JSContextRef context, J
     return JSValueMakeUndefined(context);
 }
 
+static JSValueRef grantWebNotificationPermissionCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+    if (argumentCount < 1)
+        return JSValueMakeUndefined(context);
+
+    TestRunner* controller = static_cast<TestRunner*>(JSObjectGetPrivate(thisObject));
+
+    JSRetainPtr<JSStringRef> origin(Adopt, JSValueToStringCopy(context, arguments[0], exception));
+    ASSERT(!*exception);
+    controller->grantWebNotificationPermission(origin.get());
+
+    return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef denyWebNotificationPermissionCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+    if (argumentCount < 1)
+        return JSValueMakeUndefined(context);
+
+    TestRunner* controller = static_cast<TestRunner*>(JSObjectGetPrivate(thisObject));
+
+    JSRetainPtr<JSStringRef> origin(Adopt, JSValueToStringCopy(context, arguments[0], exception));
+    ASSERT(!*exception);
+    controller->denyWebNotificationPermission(origin.get());
+
+    return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef removeAllWebNotificationPermissionsCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+    TestRunner* controller = static_cast<TestRunner*>(JSObjectGetPrivate(thisObject));
+
+    controller->removeAllWebNotificationPermissions();
+
+    return JSValueMakeUndefined(context);
+}
+
+
+static JSValueRef simulateWebNotificationClickCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+    // Has Windows implementation
+    if (argumentCount < 1)
+        return JSValueMakeUndefined(context);
+
+    TestRunner* controller = static_cast<TestRunner*>(JSObjectGetPrivate(thisObject));
+
+    controller->simulateWebNotificationClick(arguments[0]);
+
+    return JSValueMakeUndefined(context);
+}
+
 static void testRunnerObjectFinalize(JSObjectRef object)
 {
     TestRunner* controller = static_cast<TestRunner*>(JSObjectGetPrivate(object));
@@ -2302,8 +2342,7 @@ JSStaticFunction* TestRunner::staticFunctions()
         { "findString", findStringCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
         { "originsWithApplicationCache", originsWithApplicationCacheCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
         { "goBack", goBackCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 
-        { "grantDesktopNotificationPermission", grantDesktopNotificationPermissionCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 
-        { "ignoreDesktopNotificationPermissionRequests", ignoreDesktopNotificationPermissionRequestsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+        { "ignoreLegacyWebNotificationPermissionRequests", ignoreLegacyWebNotificationPermissionRequestsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
         { "isCommandEnabled", isCommandEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
         { "keepWebHistory", keepWebHistoryCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
         { "layerTreeAsText", layerTreeAsTextCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
@@ -2392,7 +2431,7 @@ JSStaticFunction* TestRunner::staticFunctions()
         { "setXSSAuditorEnabled", setXSSAuditorEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
         { "setAsynchronousSpellCheckingEnabled", setAsynchronousSpellCheckingEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
         { "showWebInspector", showWebInspectorCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
-        { "simulateDesktopNotificationClick", simulateDesktopNotificationClickCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+        { "simulateLegacyWebNotificationClick", simulateLegacyWebNotificationClickCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
         { "testOnscreen", testOnscreenCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
         { "testRepaint", testRepaintCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
         { "waitForPolicyDelegate", waitForPolicyDelegateCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
@@ -2417,6 +2456,10 @@ JSStaticFunction* TestRunner::staticFunctions()
         { "preciseTime", preciseTimeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
         { "setHasCustomFullScreenBehavior", setHasCustomFullScreenBehaviorCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
         { "setStorageDatabaseIdleInterval", setStorageDatabaseIdleIntervalCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+        { "grantWebNotificationPermission", grantWebNotificationPermissionCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+        { "denyWebNotificationPermission", denyWebNotificationPermissionCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+        { "removeAllWebNotificationPermissions", removeAllWebNotificationPermissionsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+        { "simulateWebNotificationClick", simulateWebNotificationClickCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
         { 0, 0, 0 }
     };
 
@@ -2458,26 +2501,9 @@ void TestRunner::queueReload()
     WorkQueue::shared()->queue(new ReloadItem);
 }
 
-void TestRunner::grantDesktopNotificationPermission(JSStringRef origin)
-{
-    m_desktopNotificationAllowedOrigins.push_back(JSStringRetain(origin));
-}
-
-bool TestRunner::checkDesktopNotificationPermission(JSStringRef origin)
-{
-    std::vector<JSStringRef>::iterator i;
-    for (i = m_desktopNotificationAllowedOrigins.begin();
-         i != m_desktopNotificationAllowedOrigins.end();
-         ++i) {
-        if (JSStringIsEqual(*i, origin))
-            return true;
-    }
-    return false;
-}
-
-void TestRunner::ignoreDesktopNotificationPermissionRequests()
+void TestRunner::ignoreLegacyWebNotificationPermissionRequests()
 {
-    m_areDesktopNotificationPermissionRequestsIgnored = false;
+    m_areLegacyWebNotificationPermissionRequestsIgnored = false;
 }
 
 void TestRunner::waitToDumpWatchdogTimerFired()
index 885b1de..89eb935 100644 (file)
@@ -136,11 +136,12 @@ public:
     JSRetainPtr<JSStringRef> platformName() const;
 #endif
 
-    void grantDesktopNotificationPermission(JSStringRef origin);
-    bool checkDesktopNotificationPermission(JSStringRef origin);
-    void ignoreDesktopNotificationPermissionRequests();
-    bool areDesktopNotificationPermissionRequestsIgnored() const { return m_areDesktopNotificationPermissionRequestsIgnored; }
-    void simulateDesktopNotificationClick(JSStringRef title);
+    void ignoreLegacyWebNotificationPermissionRequests();
+    void simulateLegacyWebNotificationClick(JSStringRef title);
+    void grantWebNotificationPermission(JSStringRef origin);
+    void denyWebNotificationPermission(JSStringRef origin);
+    void removeAllWebNotificationPermissions();
+    void simulateWebNotificationClick(JSValueRef notification);
 
     bool elementDoesAutoCompleteForElementWithId(JSStringRef id);
 
@@ -417,7 +418,7 @@ private:
     bool m_useDeferredFrameLoading;
     bool m_shouldPaintBrokenImage;
     bool m_shouldStayOnPageAfterHandlingBeforeUnload;
-    bool m_areDesktopNotificationPermissionRequestsIgnored;
+    bool m_areLegacyWebNotificationPermissionRequestsIgnored;
     bool m_customFullScreenBehavior;
 
     std::string m_authenticationUsername;
@@ -430,9 +431,6 @@ private:
     
     // base64 encoded WAV audio data is stored here.
     std::string m_encodedAudioData;
-    
-    // origins which have been granted desktop notification access
-    std::vector<JSStringRef> m_desktopNotificationAllowedOrigins;
 
     std::map<std::string, std::string> m_URLsToRedirect;
     
index f6395fb..6074614 100644 (file)
@@ -818,7 +818,23 @@ void TestRunner::setMockSpeechInputDumpRect(bool)
 {
 }
 
-void TestRunner::simulateDesktopNotificationClick(JSStringRef title)
+void TestRunner::grantWebNotificationPermission(JSStringRef origin)
+{
+}
+
+void TestRunner::denyWebNotificationPermission(JSStringRef jsOrigin)
+{
+}
+
+void TestRunner::removeAllWebNotificationPermissions()
+{
+}
+
+void TestRunner::simulateWebNotificationClick(JSValueRef jsNotification)
+{
+}
+
+void TestRunner::simulateLegacyWebNotificationClick(JSStringRef title)
 {
 }
 
index bbc9f9b..f937cad 100644 (file)
@@ -155,7 +155,10 @@ DRTTestRunner::DRTTestRunner(TestShell* shell)
     bindMethod("execCommand", &DRTTestRunner::execCommand);
     bindMethod("forceRedSelectionColors", &DRTTestRunner::forceRedSelectionColors);
 #if ENABLE(NOTIFICATIONS)
-    bindMethod("grantDesktopNotificationPermission", &DRTTestRunner::grantDesktopNotificationPermission);
+    bindMethod("grantWebNotificationPermission", &DRTTestRunner::grantWebNotificationPermission);
+    bindMethod("denyWebNotificationPermission", &DRTTestRunner::denyWebNotificationPermission);
+    bindMethod("removeAllWebNotificationPermissions", &DRTTestRunner::removeAllWebNotificationPermissions);
+    bindMethod("simulateWebNotificationClick", &DRTTestRunner::simulateWebNotificationClick);
 #endif
     bindMethod("findString", &DRTTestRunner::findString);
     bindMethod("isCommandEnabled", &DRTTestRunner::isCommandEnabled);
@@ -233,7 +236,7 @@ DRTTestRunner::DRTTestRunner(TestShell* shell)
     bindMethod("setAsynchronousSpellCheckingEnabled", &DRTTestRunner::setAsynchronousSpellCheckingEnabled);
     bindMethod("showWebInspector", &DRTTestRunner::showWebInspector);
 #if ENABLE(NOTIFICATIONS)
-    bindMethod("simulateDesktopNotificationClick", &DRTTestRunner::simulateDesktopNotificationClick);
+    bindMethod("simulateLegacyWebNotificationClick", &DRTTestRunner::simulateLegacyWebNotificationClick);
 #endif
     bindMethod("startSpeechInput", &DRTTestRunner::startSpeechInput);
     bindMethod("testRepaint", &DRTTestRunner::testRepaint);
@@ -1178,7 +1181,7 @@ void DRTTestRunner::callShouldCloseOnWebView(const CppArgumentList&, CppVariant*
 }
 
 #if ENABLE(NOTIFICATIONS)
-void DRTTestRunner::grantDesktopNotificationPermission(const CppArgumentList& arguments, CppVariant* result)
+void DRTTestRunner::grantWebNotificationPermission(const CppArgumentList& arguments, CppVariant* result)
 {
     if (arguments.size() != 1 || !arguments[0].isString()) {
         result->set(false);
@@ -1190,7 +1193,25 @@ void DRTTestRunner::grantDesktopNotificationPermission(const CppArgumentList& ar
     result->set(true);
 }
 
-void DRTTestRunner::simulateDesktopNotificationClick(const CppArgumentList& arguments, CppVariant* result)
+void DRTTestRunner::denyWebNotificationPermission(const CppArgumentList& arguments, CppVariant* result)
+{
+    // FIXME: Implement.
+    result->setNull();
+}
+
+void DRTTestRunner::removeAllWebNotificationPermissions(const CppArgumentList& arguments, CppVariant* result)
+{
+    // FIXME: Implement.
+    result->setNull();
+}
+
+void DRTTestRunner::simulateWebNotificationClick(const CppArgumentList& arguments, CppVariant* result)
+{
+    // FIXME: Implement.
+    result->setNull();
+}
+
+void DRTTestRunner::simulateLegacyWebNotificationClick(const CppArgumentList& arguments, CppVariant* result)
 {
     if (arguments.size() != 1 || !arguments[0].isString()) {
         result->set(false);
index e9c0171..2fffd59 100644 (file)
@@ -234,9 +234,12 @@ public:
 
 #if ENABLE(NOTIFICATIONS)
     // Grants permission for desktop notifications to an origin
-    void grantDesktopNotificationPermission(const CppArgumentList&, CppVariant*);
+    void grantWebNotificationPermission(const CppArgumentList&, CppVariant*);
+    void denyWebNotificationPermission(const CppArgumentList&, CppVariant*);
+    void removeAllWebNotificationPermissions(const CppArgumentList&, CppVariant*);
+    void simulateWebNotificationClick(const CppArgumentList&, CppVariant*);
     // Simulates a click on a desktop notification.
-    void simulateDesktopNotificationClick(const CppArgumentList&, CppVariant*);
+    void simulateLegacyWebNotificationClick(const CppArgumentList&, CppVariant*);
 #endif
 
     void setDomainRelaxationForbiddenForURLScheme(const CppArgumentList&, CppVariant*);
index 1b1dca3..8b91080 100644 (file)
@@ -880,7 +880,23 @@ void TestRunner::setBackingScaleFactor(double)
     notImplemented();
 }
 
-void TestRunner::simulateDesktopNotificationClick(JSStringRef title)
+void TestRunner::grantWebNotificationPermission(JSStringRef origin)
+{
+}
+
+void TestRunner::denyWebNotificationPermission(JSStringRef jsOrigin)
+{
+}
+
+void TestRunner::removeAllWebNotificationPermissions()
+{
+}
+
+void TestRunner::simulateWebNotificationClick(JSValueRef jsNotification)
+{
+}
+
+void TestRunner::simulateLegacyWebNotificationClick(JSStringRef title)
 {
 }
 
index 41575d7..848f78c 100644 (file)
@@ -967,7 +967,23 @@ void TestRunner::setBackingScaleFactor(double)
 {
 }
 
-void TestRunner::simulateDesktopNotificationClick(JSStringRef title)
+void TestRunner::grantWebNotificationPermission(JSStringRef origin)
+{
+}
+
+void TestRunner::denyWebNotificationPermission(JSStringRef jsOrigin)
+{
+}
+
+void TestRunner::removeAllWebNotificationPermissions()
+{
+}
+
+void TestRunner::simulateWebNotificationClick(JSValueRef jsNotification)
+{
+}
+
+void TestRunner::simulateLegacyWebNotificationClick(JSStringRef title)
 {
 }
 
index 1d7de85..b36a8ac 100644 (file)
@@ -1163,9 +1163,8 @@ void TestRunner::setBackingScaleFactor(double backingScaleFactor)
     [[mainFrame webView] _setCustomBackingScaleFactor:backingScaleFactor];
 }
 
-void TestRunner::simulateDesktopNotificationClick(JSStringRef title)
+void TestRunner::simulateLegacyWebNotificationClick(JSStringRef jsTitle)
 {
-    // FIXME: Implement.
 }
 
 void TestRunner::resetPageVisibility()
@@ -1187,3 +1186,21 @@ void TestRunner::deliverWebIntent(JSStringRef, JSStringRef, JSStringRef)
 {
     // FIXME: Implement.
 }
+
+
+void TestRunner::grantWebNotificationPermission(JSStringRef jsOrigin)
+{
+}
+
+void TestRunner::denyWebNotificationPermission(JSStringRef jsOrigin)
+{
+}
+
+void TestRunner::removeAllWebNotificationPermissions()
+{
+}
+
+void TestRunner::simulateWebNotificationClick(JSValueRef jsNotification)
+{
+}
+
index f35fe26..5e3624f 100644 (file)
@@ -202,24 +202,34 @@ int TestRunner::windowCount()
     return m_drt->windowCount();
 }
 
-void TestRunner::grantDesktopNotificationPermission(const QString& origin)
+void TestRunner::grantWebNotificationPermission(const QString& origin)
 {
     QWebFrame* frame = m_drt->webPage()->mainFrame();
     m_drt->webPage()->setFeaturePermission(frame, QWebPage::Notifications, QWebPage::PermissionGrantedByUser);
     m_desktopNotificationAllowedOrigins.append(origin);
 }
 
-void TestRunner::ignoreDesktopNotificationPermissionRequests()
+void TestRunner::ignoreLegacyWebNotificationPermissionRequests()
 {
     m_ignoreDesktopNotification = true;
 }
 
-bool TestRunner::checkDesktopNotificationPermission(const QString& origin)
+void TestRunner::denyWebNotificationPermission(const QString& origin)
 {
-    return !m_ignoreDesktopNotification && m_desktopNotificationAllowedOrigins.contains(origin);
+    // FIXME: implement.
 }
 
-void TestRunner::simulateDesktopNotificationClick(const QString& title)
+void TestRunner::removeAllWebNotificationPermissions()
+{
+    // FIXME: implement.
+}
+
+void TestRunner::simulateWebNotificationClick(const QWebElement& notification)
+{
+    // FIXME: implement.
+}
+
+void TestRunner::simulateLegacyWebNotificationClick(const QString& title)
 {
     DumpRenderTreeSupportQt::simulateDesktopNotificationClick(title);
 }
index 52d512c..36d9d1b 100644 (file)
@@ -134,10 +134,12 @@ public Q_SLOTS:
     void provisionalLoad();
     void setCloseRemainingWindowsWhenComplete(bool = false) { }
     int windowCount();
-    void grantDesktopNotificationPermission(const QString& origin);
-    void ignoreDesktopNotificationPermissionRequests();
-    bool checkDesktopNotificationPermission(const QString& origin);
-    void simulateDesktopNotificationClick(const QString& title);
+    void ignoreLegacyWebNotificationPermissionRequests();
+    void simulateLegacyWebNotificationClick(const QString& title);
+    void grantWebNotificationPermission(const QString& origin);
+    void denyWebNotificationPermission(const QString& origin);
+    void removeAllWebNotificationPermissions();
+    void simulateWebNotificationClick(const QWebElement&);
     void display();
     void displayInvalidatedRegion();
     void clearBackForwardList();
index a2c15e3..530260b 100644 (file)
@@ -1434,7 +1434,23 @@ void TestRunner::setBackingScaleFactor(double)
 {
 }
 
-void TestRunner::simulateDesktopNotificationClick(JSStringRef title)
+void TestRunner::grantWebNotificationPermission(JSStringRef origin)
+{
+}
+
+void TestRunner::denyWebNotificationPermission(JSStringRef jsOrigin)
+{
+}
+
+void TestRunner::removeAllWebNotificationPermissions()
+{
+}
+
+void TestRunner::simulateWebNotificationClick(JSValueRef jsNotification)
+{
+}
+
+void TestRunner::simulateLegacyWebNotificationClick(JSStringRef title)
 {
     // FIXME: Implement.
 }