Diff
Modified: trunk/LayoutTests/ChangeLog (127298 => 127299)
--- trunk/LayoutTests/ChangeLog 2012-08-31 18:55:50 UTC (rev 127298)
+++ trunk/LayoutTests/ChangeLog 2012-08-31 19:08:50 UTC (rev 127299)
@@ -1,3 +1,41 @@
+2012-08-31 Jon Lee <[email protected]>
+
+ [Tests] Add basic tests to http/tests/notifications
+ https://bugs.webkit.org/show_bug.cgi?id=95493
+ <rdar://problem/12209303>
+
+ Reviewed by Alexey Proskuryakov.
+
+ * http/tests/notifications/request-expected.txt: Added.
+ * http/tests/notifications/request.html: Added. This test requests permission. DRT/WTR
+ is expected to accept it, and we verify that both the parameter in the callback function,
+ and Notification.permission, are both set to "granted".
+ * http/tests/notifications/show-expected.txt: Added.
+ * http/tests/notifications/show.html: Added. This test checks that the various permission
+ APIs on TestRunner work.
+
+ Legacy analog to above tests.
+ * http/tests/notifications/legacy/request-expected.txt: Added.
+ * http/tests/notifications/legacy/request.html: Added.
+ * http/tests/notifications/legacy/show-expected.txt: Added.
+ * http/tests/notifications/legacy/show.html: Added.
+
+ * http/tests/resources/js-test-post-async.js: Added. This will be used for most tests since
+ the events are called asynchronously.
+ * http/tests/resources/js-test-pre.js: Updated from fast/js/resources.
+ * http/tests/resources/notifications-test-pre.js: Added. Adds a helper function to complete
+ the test, and defines the domain of http/tests.
+ (testCompleted):
+
+ Skip.
+ * platform/chromium/TestExpectations: Skip on Android. Filed 95506 to bring Chromium support.
+ * platform/efl/TestExpectations:
+ * platform/gtk/TestExpectations:
+ * platform/mac/Skipped:
+ * platform/qt/Skipped: Filed 95507 to bring Qt support.
+ * platform/win/Skipped:
+ * platform/wincairo/Skipped:
+
2012-08-31 Philip Rogers <[email protected]>
Unreviewed update of test expectations.
Added: trunk/LayoutTests/http/tests/notifications/legacy/request-expected.txt (0 => 127299)
--- trunk/LayoutTests/http/tests/notifications/legacy/request-expected.txt (rev 0)
+++ trunk/LayoutTests/http/tests/notifications/legacy/request-expected.txt 2012-08-31 19:08:50 UTC (rev 127299)
@@ -0,0 +1,11 @@
+This test checks that a request for permission is made.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS window.webkitNotifications.checkPermission() is 1
+PASS window.webkitNotifications.checkPermission() is 0
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/http/tests/notifications/legacy/request.html (0 => 127299)
--- trunk/LayoutTests/http/tests/notifications/legacy/request.html (rev 0)
+++ trunk/LayoutTests/http/tests/notifications/legacy/request.html 2012-08-31 19:08:50 UTC (rev 127299)
@@ -0,0 +1,21 @@
+<!DOCTYPE html>
+<script src=""
+<script src=""
+<p id="description"></p>
+<div id="console"></div>
+<script>
+if (window.testRunner)
+ testRunner.waitUntilDone();
+
+description("This test checks that a request for permission is made.");
+
+if (window.testRunner) {
+ shouldBe("window.webkitNotifications.checkPermission()", "1");
+ Notification.requestPermission(function() {
+ shouldBe("window.webkitNotifications.checkPermission()", "0");
+ testCompleted();
+ });
+}
+
+setTimeout(testCompleted, 100);
+</script>
Added: trunk/LayoutTests/http/tests/notifications/legacy/show-expected.txt (0 => 127299)
--- trunk/LayoutTests/http/tests/notifications/legacy/show-expected.txt (rev 0)
+++ trunk/LayoutTests/http/tests/notifications/legacy/show-expected.txt 2012-08-31 19:08:50 UTC (rev 127299)
@@ -0,0 +1,19 @@
+This test looks for the dispatch of the onshow event handler.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS window.webkitNotifications.checkPermission() is 1
+PASS window.webkitNotifications.createNotification('', 'title 1', 'body'); threw exception Error: SECURITY_ERR: DOM Exception 18.
+Granting permission to http://127.0.0.1:8000
+PASS window.webkitNotifications.checkPermission() is 0
+PASS ondisplay event handler was called
+Denying permission to http://127.0.0.1:8000
+PASS window.webkitNotifications.checkPermission() is 2
+PASS window.webkitNotifications.createNotification('', 'title 3', 'body'); threw exception Error: SECURITY_ERR: DOM Exception 18.
+Resetting all permissions
+PASS window.webkitNotifications.checkPermission() is 1
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/http/tests/notifications/legacy/show.html (0 => 127299)
--- trunk/LayoutTests/http/tests/notifications/legacy/show.html (rev 0)
+++ trunk/LayoutTests/http/tests/notifications/legacy/show.html 2012-08-31 19:08:50 UTC (rev 127299)
@@ -0,0 +1,54 @@
+<!DOCTYPE html>
+<script src=""
+<script src=""
+<p id="description"></p>
+<div id="console"></div>
+<script>
+if (window.testRunner)
+ testRunner.waitUntilDone();
+
+description("This test looks for the dispatch of the onshow event handler.");
+
+var n = null;
+function part1() {
+ shouldBe("window.webkitNotifications.checkPermission()", "1");
+ shouldThrow("window.webkitNotifications.createNotification('', 'title 1', 'body');");
+ setTimeout(part2, 0);
+}
+
+function part2() {
+ debug("Granting permission to " + testURL);
+ testRunner.grantWebNotificationPermission(testURL);
+ shouldBe("window.webkitNotifications.checkPermission()", "0");
+
+ n = window.webkitNotifications.createNotification("", "title 2", "body");
+ n._onshow_ = function() {
+ testPassed("ondisplay event handler was called");
+ setTimeout(part3, 0);
+ };
+ n._onerror_ = function() {
+ testFailed("onerror event handler should not be called");
+ setTimeout(part3, 0);
+ };
+ n.show();
+}
+
+function part3() {
+ debug("Denying permission to " + testURL);
+ testRunner.denyWebNotificationPermission(testURL);
+ shouldBe("window.webkitNotifications.checkPermission()", "2");
+ shouldThrow("window.webkitNotifications.createNotification('', 'title 3', 'body');");
+ setTimeout(part4, 0);
+}
+
+function part4() {
+ debug("Resetting all permissions");
+ testRunner.removeAllWebNotificationPermissions();
+ shouldBe("window.webkitNotifications.checkPermission()", "1");
+ testCompleted();
+}
+
+part1();
+
+setTimeout(testCompleted, 100);
+</script>
Added: trunk/LayoutTests/http/tests/notifications/request-expected.txt (0 => 127299)
--- trunk/LayoutTests/http/tests/notifications/request-expected.txt (rev 0)
+++ trunk/LayoutTests/http/tests/notifications/request-expected.txt 2012-08-31 19:08:50 UTC (rev 127299)
@@ -0,0 +1,12 @@
+This test checks that a request for permission is made.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS Notification.permission is "default"
+PASS permission is granted.
+PASS Notification.permission is "granted"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/http/tests/notifications/request.html (0 => 127299)
--- trunk/LayoutTests/http/tests/notifications/request.html (rev 0)
+++ trunk/LayoutTests/http/tests/notifications/request.html 2012-08-31 19:08:50 UTC (rev 127299)
@@ -0,0 +1,25 @@
+<!DOCTYPE html>
+<script src=""
+<script src=""
+<p id="description"></p>
+<div id="console"></div>
+<script>
+if (window.testRunner)
+ testRunner.waitUntilDone();
+
+description("This test checks that a request for permission is made.");
+
+if (window.testRunner) {
+ shouldBeEqualToString("Notification.permission", "default");
+ Notification.requestPermission(function(permission) {
+ if (permission == 'granted')
+ testPassed("permission is granted.");
+ else
+ testFailed("permission should be granted, but is " + permission + ".");
+ shouldBeEqualToString("Notification.permission", "granted");
+ testCompleted();
+ });
+}
+
+setTimeout(testCompleted, 100);
+</script>
Added: trunk/LayoutTests/http/tests/notifications/show-expected.txt (0 => 127299)
--- trunk/LayoutTests/http/tests/notifications/show-expected.txt (rev 0)
+++ trunk/LayoutTests/http/tests/notifications/show-expected.txt 2012-08-31 19:08:50 UTC (rev 127299)
@@ -0,0 +1,19 @@
+This test looks for the dispatch of the onshow event handler.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS Notification.permission is "default"
+PASS onerror event handler was called
+Granting permission to http://127.0.0.1:8000
+PASS Notification.permission is "granted"
+PASS onshow event handler was called
+Denying permission to http://127.0.0.1:8000
+PASS Notification.permission is "denied"
+PASS onerror event handler was called
+Resetting all permissions
+PASS Notification.permission is "default"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/http/tests/notifications/show.html (0 => 127299)
--- trunk/LayoutTests/http/tests/notifications/show.html (rev 0)
+++ trunk/LayoutTests/http/tests/notifications/show.html 2012-08-31 19:08:50 UTC (rev 127299)
@@ -0,0 +1,69 @@
+<!DOCTYPE html>
+<script src=""
+<script src=""
+<p id="description"></p>
+<div id="console"></div>
+<script>
+if (window.testRunner)
+ testRunner.waitUntilDone();
+
+description("This test looks for the dispatch of the onshow event handler.");
+
+var n = null;
+function part1() {
+ shouldBeEqualToString("Notification.permission", "default");
+
+ n = new Notification("title 1");
+ n._onshow_ = function() {
+ testFailed("onshow event handler should not be called");
+ setTimeout(part2, 0);
+ };
+ n._onerror_ = function() {
+ testPassed("onerror event handler was called");
+ setTimeout(part2, 0);
+ };
+}
+
+function part2() {
+ debug("Granting permission to " + testURL);
+ testRunner.grantWebNotificationPermission(testURL);
+ shouldBeEqualToString("Notification.permission", "granted");
+
+ n = new Notification("title 2");
+ n._onshow_ = function() {
+ testPassed("onshow event handler was called");
+ setTimeout(part3, 0);
+ };
+ n._onerror_ = function() {
+ testFailed("onerror event handler should not be called");
+ setTimeout(part3, 0);
+ };
+}
+
+function part3() {
+ debug("Denying permission to " + testURL);
+ testRunner.denyWebNotificationPermission(testURL);
+ shouldBeEqualToString("Notification.permission", "denied");
+
+ n = new Notification("title 3");
+ n._onshow_ = function() {
+ testFailed("onshow event handler should not be called");
+ setTimeout(part4, 0);
+ };
+ n._onerror_ = function() {
+ testPassed("onerror event handler was called");
+ setTimeout(part4, 0);
+ };
+}
+
+function part4() {
+ debug("Resetting all permissions");
+ testRunner.removeAllWebNotificationPermissions();
+ shouldBeEqualToString("Notification.permission", "default");
+ testCompleted();
+}
+
+part1();
+
+setTimeout(testCompleted, 100);
+</script>
Added: trunk/LayoutTests/http/tests/resources/js-test-post-async.js (0 => 127299)
--- trunk/LayoutTests/http/tests/resources/js-test-post-async.js (rev 0)
+++ trunk/LayoutTests/http/tests/resources/js-test-post-async.js 2012-08-31 19:08:50 UTC (rev 127299)
@@ -0,0 +1,7 @@
+if (!errorMessage)
+ successfullyParsed = true;
+shouldBeTrue("successfullyParsed");
+debug('<br /><span class="pass">TEST COMPLETE</span>');
+
+if (window.testRunner)
+ testRunner.notifyDone();
Modified: trunk/LayoutTests/http/tests/resources/js-test-pre.js (127298 => 127299)
--- trunk/LayoutTests/http/tests/resources/js-test-pre.js 2012-08-31 18:55:50 UTC (rev 127298)
+++ trunk/LayoutTests/http/tests/resources/js-test-pre.js 2012-08-31 19:08:50 UTC (rev 127299)
@@ -68,7 +68,7 @@
styleElement.textContent = css;
(document.head || document.documentElement).appendChild(styleElement);
}
-
+
if (!isWorker())
insertStyleSheet();
@@ -258,7 +258,9 @@
function shouldBeEqualToString(a, b)
{
- var unevaledString = '"' + b.replace(/\\/g, "\\\\").replace(/"/g, "\"").replace(/\n/g, "\\n").replace(/\r/g, "\\r") + '"';
+ if (typeof a !== "string" || typeof b !== "string")
+ debug("WARN: shouldBeEqualToString() expects string arguments");
+ var unevaledString = JSON.stringify(b);
shouldBe(a, unevaledString);
}
@@ -394,6 +396,15 @@
testPassed(_a + " is >= " + _b);
}
+function shouldNotThrow(_a) {
+ try {
+ eval(_a);
+ testPassed(_a + " did not throw exception.");
+ } catch (e) {
+ testFailed(_a + " should not throw exception. Threw exception " + e + ".");
+ }
+}
+
function shouldThrow(_a, _e)
{
var exception;
@@ -474,9 +485,7 @@
{
self.jsTestIsAsync = true;
debug('Starting worker: ' + testScriptURL);
- var worker = shared ? new SharedWorker(testScriptURL) : new Worker(testScriptURL);
- if (shared)
- worker.port._onmessage_ = function(event) { worker.onmessage(event); };
+ var worker = shared ? new SharedWorker(testScriptURL, "Shared Worker") : new Worker(testScriptURL);
worker._onmessage_ = function(event)
{
var workerPrefix = "[Worker] ";
@@ -504,23 +513,52 @@
finishJSTest();
}
+ if (shared) {
+ worker.port._onmessage_ = function(event) { worker.onmessage(event); };
+ worker.port.start();
+ }
return worker;
}
if (isWorker()) {
+ var workerPort = self;
+ if (self.name == "Shared Worker") {
+ self._onconnect_ = function(e) {
+ workerPort = e.ports[0];
+ workerPort._onmessage_ = function(event)
+ {
+
+ var colon = event.data.indexOf(":");
+ if (colon == -1) {
+ testFailed("Unrecognized message to shared worker: " + event.data);
+ return;
+ }
+ var code = event.data.substring(0, colon);
+ var payload = event.data.substring(colon + 1);
+ try {
+ if (code == "IMPORT")
+ importScripts(payload);
+ else
+ testFailed("Unrecognized message to shared worker: " + event.data);
+ } catch (ex) {
+ testFailed("Caught exception in shared worker onmessage: " + ex);
+ }
+ };
+ };
+ }
description = function(msg, quiet) {
- postMessage('DESC:' + msg);
+ workerPort.postMessage('DESC:' + msg);
}
testFailed = function(msg) {
- postMessage('FAIL:' + msg);
+ workerPort.postMessage('FAIL:' + msg);
}
testPassed = function(msg) {
- postMessage('PASS:' + msg);
+ workerPort.postMessage('PASS:' + msg);
}
finishJSTest = function() {
- postMessage('DONE:');
+ workerPort.postMessage('DONE:');
}
debug = function(msg) {
- postMessage(msg);
+ workerPort.postMessage(msg);
}
}
Added: trunk/LayoutTests/http/tests/resources/notifications-test-pre.js (0 => 127299)
--- trunk/LayoutTests/http/tests/resources/notifications-test-pre.js (rev 0)
+++ trunk/LayoutTests/http/tests/resources/notifications-test-pre.js 2012-08-31 19:08:50 UTC (rev 127299)
@@ -0,0 +1,8 @@
+var testURL = "http://127.0.0.1:8000";
+
+function testCompleted()
+{
+ var scriptElement = document.createElement("script");
+ scriptElement.src = ""
+ document.body.appendChild(scriptElement);
+}
Modified: trunk/LayoutTests/platform/chromium/TestExpectations (127298 => 127299)
--- trunk/LayoutTests/platform/chromium/TestExpectations 2012-08-31 18:55:50 UTC (rev 127298)
+++ trunk/LayoutTests/platform/chromium/TestExpectations 2012-08-31 19:08:50 UTC (rev 127299)
@@ -897,6 +897,7 @@
BUGCR145338 WONTFIX ANDROID SKIP : fast/mediastream = PASS
BUGCR145338 WONTFIX ANDROID SKIP : fast/notifications = PASS
BUGCR145338 WONTFIX ANDROID SKIP : fast/speech = PASS
+BUGCR145338 WONTFIX ANDROID SKIP : http/tests/notifications = PASS
BUGCR145338 WONTFIX ANDROID SKIP : platform/chromium/fast/forms/color = PASS
BUGCR145338 WONTFIX ANDROID SKIP : platform/chromium/media/video-capture-preview.html = PASS // Uses mediastream
BUGCR145338 WONTFIX ANDROID SKIP : webaudio = PASS
@@ -3635,3 +3636,5 @@
BUGWK80394 MAC WIN : fast/block/margin-collapse/025.html = TEXT
BUGWK80394 MAC WIN : fast/block/margin-collapse/block-inside-inline/025.html = TEXT
+// Does not yet support new web notifications TestRunner API
+BUGWK95506 SKIP : http/tests/notifications = PASS
Modified: trunk/LayoutTests/platform/efl/TestExpectations (127298 => 127299)
--- trunk/LayoutTests/platform/efl/TestExpectations 2012-08-31 18:55:50 UTC (rev 127298)
+++ trunk/LayoutTests/platform/efl/TestExpectations 2012-08-31 19:08:50 UTC (rev 127299)
@@ -598,6 +598,7 @@
// Requires support for Web notifications
BUGWK73544 SKIP : fast/notifications = TEXT
+BUGWK73544 SKIP : http/tests/notifications = TEXT
// This tests fails by one on 32 bits machines due to rounding issues.
BUGWKEFL : fast/css/percentage-non-integer.html = TEXT PASS
Modified: trunk/LayoutTests/platform/gtk/TestExpectations (127298 => 127299)
--- trunk/LayoutTests/platform/gtk/TestExpectations 2012-08-31 18:55:50 UTC (rev 127298)
+++ trunk/LayoutTests/platform/gtk/TestExpectations 2012-08-31 19:08:50 UTC (rev 127299)
@@ -161,6 +161,7 @@
// Desktop notifications are not supported.
BUGWKGTK SKIP : fast/notifications = TEXT
+BUGWKGTK SKIP : http/tests/notifications = TEXT
// We lack userscripts support.
BUGWKGTK SKIP : userscripts = TEXT
Modified: trunk/LayoutTests/platform/mac/Skipped (127298 => 127299)
--- trunk/LayoutTests/platform/mac/Skipped 2012-08-31 18:55:50 UTC (rev 127298)
+++ trunk/LayoutTests/platform/mac/Skipped 2012-08-31 19:08:50 UTC (rev 127299)
@@ -41,7 +41,7 @@
# https://bugs.webkit.org/show_bug.cgi?id=21913 Repaint pixel test failure
fast/repaint/body-background-image.html
-# This port doesn't support Notifications.
+# https://bugs.webkit.org/show_bug.cgi?id=81697 Skip file:// based notifications tests
fast/notifications
# Skipped while Eric Carlson works on a fix.
Modified: trunk/LayoutTests/platform/qt/Skipped (127298 => 127299)
--- trunk/LayoutTests/platform/qt/Skipped 2012-08-31 18:55:50 UTC (rev 127298)
+++ trunk/LayoutTests/platform/qt/Skipped 2012-08-31 19:08:50 UTC (rev 127299)
@@ -2789,3 +2789,6 @@
# REGRESSION (r127202): http/tests/security/inactive-document-with-empty-security-origin.html failing on JSC ports
# https://bugs.webkit.org/show_bug.cgi?id=95530
http/tests/security/inactive-document-with-empty-security-origin.html
+
+# https://bugs.webkit.org/show_bug.cgi?id=95507
+http/tests/notifications
Modified: trunk/LayoutTests/platform/win/Skipped (127298 => 127299)
--- trunk/LayoutTests/platform/win/Skipped 2012-08-31 18:55:50 UTC (rev 127298)
+++ trunk/LayoutTests/platform/win/Skipped 2012-08-31 19:08:50 UTC (rev 127299)
@@ -832,6 +832,7 @@
# This port doesn't support Notifications.
fast/notifications
+http/tests/notifications
# These media tests regressed on the bots. Skipping to make the bots green again.
# https://bugs.webkit.org/show_bug.cgi?id=28281
@@ -2166,4 +2167,3 @@
# As usual, DRT on Windows has problems knowing how to continue a test when focus moves to a popup window, in this case the file chooser
# https://bugs.webkit.org/show_bug.cgi?id=87469
fast/events/domactivate-sets-underlying-click-event-as-handled.html
-
Modified: trunk/LayoutTests/platform/wincairo/Skipped (127298 => 127299)
--- trunk/LayoutTests/platform/wincairo/Skipped 2012-08-31 18:55:50 UTC (rev 127298)
+++ trunk/LayoutTests/platform/wincairo/Skipped 2012-08-31 19:08:50 UTC (rev 127299)
@@ -1349,6 +1349,7 @@
# This port doesn't support Notifications.
fast/notifications
+http/tests/notifications
# These media tests regressed on the bots. Skipping to make the bots green again.
# https://bugs.webkit.org/show_bug.cgi?id=28281
Modified: trunk/Source/WebKit2/ChangeLog (127298 => 127299)
--- trunk/Source/WebKit2/ChangeLog 2012-08-31 18:55:50 UTC (rev 127298)
+++ trunk/Source/WebKit2/ChangeLog 2012-08-31 19:08:50 UTC (rev 127299)
@@ -1,3 +1,26 @@
+2012-08-31 Jon Lee <[email protected]>
+
+ [Tests] Add basic tests to http/tests/notifications
+ https://bugs.webkit.org/show_bug.cgi?id=95493
+ <rdar://problem/12209303>
+
+ Reviewed by Alexey Proskuryakov.
+
+ Simplify the passing of the permission policy to just a boolean instead of converting it
+ back and forth from the NotificationClient::Permission enum.
+
+ * WebProcess/InjectedBundle/API/c/WKBundlePrivate.h: Move the declaration to the section
+ of functions that are TestRunner SPI.
+ * WebProcess/InjectedBundle/InjectedBundle.cpp:
+ (WebKit::InjectedBundle::setWebNotificationPermission): Use a boolean.
+ * WebProcess/Notifications/NotificationPermissionRequestManager.cpp:
+ (WebKit::NotificationPermissionRequestManager::setPermissionLevelForTesting):
+ * WebProcess/Notifications/NotificationPermissionRequestManager.h:
+ (NotificationPermissionRequestManager):
+
+ * win/WebKit2.vcproj: Add WKNotificationPermissionRequest.{h,cpp}.
+ * win/WebKit2Generated.make: Export WKNotificationPermissionRequest.h.
+
2012-08-31 Balazs Kelemen <[email protected]>
[Qt] ASSERT(m_useFixedLayout) in WebPage when using QRawWebView without setting fixed layout
Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePrivate.h (127298 => 127299)
--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePrivate.h 2012-08-31 18:55:50 UTC (rev 127298)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePrivate.h 2012-08-31 19:08:50 UTC (rev 127299)
@@ -75,6 +75,7 @@
WK_EXPORT void WKBundleSetUserStyleSheetLocation(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, WKStringRef location);
WK_EXPORT void WKBundleSetWebNotificationPermission(WKBundleRef bundle, WKBundlePageRef page, WKStringRef originStringRef, bool allowed);
WK_EXPORT void WKBundleRemoveAllWebNotificationPermissions(WKBundleRef bundle, WKBundlePageRef page);
+WK_EXPORT uint64_t WKBundleGetWebNotificationID(WKBundleRef bundle, JSContextRef context, JSValueRef notification);
// UserContent API
WK_EXPORT void WKBundleAddUserScript(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, WKBundleScriptWorldRef scriptWorld, WKStringRef source, WKURLRef url, WKArrayRef whitelist, WKArrayRef blacklist, WKUserScriptInjectionTime injectionTime, WKUserContentInjectedFrames injectedFrames);
@@ -102,8 +103,6 @@
WK_EXPORT void WKBundleSetPageVisibilityState(WKBundleRef bundle, WKBundlePageRef page, int state, bool isInitialState);
-WK_EXPORT uint64_t WKBundleGetWebNotificationID(WKBundleRef bundle, JSContextRef context, JSValueRef notificaiton);
-
#ifdef __cplusplus
}
#endif
Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp (127298 => 127299)
--- trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp 2012-08-31 18:55:50 UTC (rev 127298)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp 2012-08-31 19:08:50 UTC (rev 127299)
@@ -539,7 +539,7 @@
void InjectedBundle::setWebNotificationPermission(WebPage* page, const String& originString, bool allowed)
{
#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
- page->notificationPermissionRequestManager()->setPermissionLevelForTesting(originString, allowed ? NotificationClient::PermissionAllowed : NotificationClient::PermissionDenied);
+ page->notificationPermissionRequestManager()->setPermissionLevelForTesting(originString, allowed);
#else
UNUSED_PARAM(page);
UNUSED_PARAM(originString);
Modified: trunk/Source/WebKit2/WebProcess/Notifications/NotificationPermissionRequestManager.cpp (127298 => 127299)
--- trunk/Source/WebKit2/WebProcess/Notifications/NotificationPermissionRequestManager.cpp 2012-08-31 18:55:50 UTC (rev 127298)
+++ trunk/Source/WebKit2/WebProcess/Notifications/NotificationPermissionRequestManager.cpp 2012-08-31 19:08:50 UTC (rev 127299)
@@ -128,13 +128,13 @@
#endif
}
-void NotificationPermissionRequestManager::setPermissionLevelForTesting(const String& originString, WebCore::NotificationClient::Permission permission)
+void NotificationPermissionRequestManager::setPermissionLevelForTesting(const String& originString, bool allowed)
{
#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
- WebProcess::shared().notificationManager().didUpdateNotificationDecision(originString, permission);
+ WebProcess::shared().notificationManager().didUpdateNotificationDecision(originString, allowed);
#else
UNUSED_PARAM(originString);
- UNUSED_PARAM(permission);
+ UNUSED_PARAM(allowed);
#endif
}
Modified: trunk/Source/WebKit2/WebProcess/Notifications/NotificationPermissionRequestManager.h (127298 => 127299)
--- trunk/Source/WebKit2/WebProcess/Notifications/NotificationPermissionRequestManager.h 2012-08-31 18:55:50 UTC (rev 127298)
+++ trunk/Source/WebKit2/WebProcess/Notifications/NotificationPermissionRequestManager.h 2012-08-31 19:08:50 UTC (rev 127299)
@@ -59,7 +59,7 @@
WebCore::NotificationClient::Permission permissionLevel(WebCore::SecurityOrigin*);
// For testing purposes only.
- void setPermissionLevelForTesting(const String& originString, WebCore::NotificationClient::Permission);
+ void setPermissionLevelForTesting(const String& originString, bool allowed);
void removeAllPermissionsForTesting();
void didReceiveNotificationPermissionDecision(uint64_t notificationID, bool allowed);
Modified: trunk/Source/WebKit2/win/WebKit2.vcproj (127298 => 127299)
--- trunk/Source/WebKit2/win/WebKit2.vcproj 2012-08-31 18:55:50 UTC (rev 127298)
+++ trunk/Source/WebKit2/win/WebKit2.vcproj 2012-08-31 19:08:50 UTC (rev 127299)
@@ -3509,6 +3509,14 @@
>
</File>
<File
+ RelativePath="..\UIProcess\API\C\WKNotificationPermissionRequest.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\UIProcess\API\C\WKNotificationPermissionRequest.h"
+ >
+ </File>
+ <File
RelativePath="..\UIProcess\API\C\WKNotificationProvider.h"
>
</File>
Modified: trunk/Source/WebKit2/win/WebKit2Generated.make (127298 => 127299)
--- trunk/Source/WebKit2/win/WebKit2Generated.make 2012-08-31 18:55:50 UTC (rev 127298)
+++ trunk/Source/WebKit2/win/WebKit2Generated.make 2012-08-31 19:08:50 UTC (rev 127299)
@@ -74,6 +74,7 @@
xcopy /y /d "..\UIProcess\API\C\WKNavigationData.h" "%ConfigurationBuildDir%\include\WebKit2"
xcopy /y /d "..\UIProcess\API\C\WKNotification.h" "%ConfigurationBuildDir%\include\WebKit2"
xcopy /y /d "..\UIProcess\API\C\WKNotificationManager.h" "%ConfigurationBuildDir%\include\WebKit2"
+ xcopy /y /d "..\UIProcess\API\C\WKNotificationPermissionRequest.h" "%ConfigurationBuildDir%\include\WebKit2"
xcopy /y /d "..\UIProcess\API\C\WKNotificationProvider.h" "%ConfigurationBuildDir%\include\WebKit2"
xcopy /y /d "..\UIProcess\API\C\WKOpenPanelParameters.h" "%ConfigurationBuildDir%\include\WebKit2"
xcopy /y /d "..\UIProcess\API\C\WKOpenPanelResultListener.h" "%ConfigurationBuildDir%\include\WebKit2"
Modified: trunk/Tools/ChangeLog (127298 => 127299)
--- trunk/Tools/ChangeLog 2012-08-31 18:55:50 UTC (rev 127298)
+++ trunk/Tools/ChangeLog 2012-08-31 19:08:50 UTC (rev 127299)
@@ -1,5 +1,21 @@
2012-08-31 Jon Lee <[email protected]>
+ [Tests] Add basic tests to http/tests/notifications
+ https://bugs.webkit.org/show_bug.cgi?id=95493
+ <rdar://problem/12209303>
+
+ Reviewed by Alexey Proskuryakov.
+
+ Add permission request support for WTR.
+
+ * WebKitTestRunner/TestController.cpp:
+ (WTR::TestController::initialize):
+ (WTR::TestController::decidePolicyForNotificationPermissionRequest): Always allow.
+ * WebKitTestRunner/TestController.h:
+ (TestController):
+
+2012-08-31 Jon Lee <[email protected]>
+
[DRT] Make simulating a web click on a notification a queued task
https://bugs.webkit.org/show_bug.cgi?id=95546
<rdar://problem/12214170>
Modified: trunk/Tools/WebKitTestRunner/TestController.cpp (127298 => 127299)
--- trunk/Tools/WebKitTestRunner/TestController.cpp 2012-08-31 18:55:50 UTC (rev 127298)
+++ trunk/Tools/WebKitTestRunner/TestController.cpp 2012-08-31 19:08:50 UTC (rev 127299)
@@ -32,6 +32,7 @@
#include <WebKit2/WKContextPrivate.h>
#include <WebKit2/WKNotification.h>
#include <WebKit2/WKNotificationManager.h>
+#include <WebKit2/WKNotificationPermissionRequest.h>
#include <WebKit2/WKNumber.h>
#include <WebKit2/WKPageGroup.h>
#include <WebKit2/WKPagePrivate.h>
@@ -388,7 +389,7 @@
0, // shouldInterruptJavaScript
createOtherPage,
0, // mouseDidMoveOverElement
- 0, // decidePolicyForNotificationPermissionRequest
+ decidePolicyForNotificationPermissionRequest, // decidePolicyForNotificationPermissionRequest
0, // unavailablePluginButtonClicked
};
WKPageSetPageUIClient(m_mainWebView->page(), &pageUIClient);
@@ -952,4 +953,14 @@
m_webNotificationProvider.simulateWebNotificationClick(notificationID);
}
+void TestController::decidePolicyForNotificationPermissionRequest(WKPageRef page, WKSecurityOriginRef origin, WKNotificationPermissionRequestRef request, const void* clientInfo)
+{
+ static_cast<TestController*>(const_cast<void*>(clientInfo))->decidePolicyForNotificationPermissionRequest(page, origin, request);
+}
+
+void TestController::decidePolicyForNotificationPermissionRequest(WKPageRef, WKSecurityOriginRef, WKNotificationPermissionRequestRef request)
+{
+ WKNotificationPermissionRequestAllow(request);
+}
+
} // namespace WTR
Modified: trunk/Tools/WebKitTestRunner/TestController.h (127298 => 127299)
--- trunk/Tools/WebKitTestRunner/TestController.h 2012-08-31 18:55:50 UTC (rev 127298)
+++ trunk/Tools/WebKitTestRunner/TestController.h 2012-08-31 19:08:50 UTC (rev 127299)
@@ -97,6 +97,9 @@
static void processDidCrash(WKPageRef, const void* clientInfo);
void processDidCrash();
+ static void decidePolicyForNotificationPermissionRequest(WKPageRef, WKSecurityOriginRef, WKNotificationPermissionRequestRef, const void*);
+ void decidePolicyForNotificationPermissionRequest(WKPageRef, WKSecurityOriginRef, WKNotificationPermissionRequestRef);
+
static WKPageRef createOtherPage(WKPageRef oldPage, WKURLRequestRef, WKDictionaryRef, WKEventModifiers, WKEventMouseButton, const void*);
static void runModal(WKPageRef, const void* clientInfo);