Title: [127364] trunk/LayoutTests
- Revision
- 127364
- Author
- [email protected]
- Date
- 2012-09-01 00:49:07 -0700 (Sat, 01 Sep 2012)
Log Message
[Tests] Add a test for all notification events
https://bugs.webkit.org/show_bug.cgi?id=95609
<rdar://problem/12218309>
Reviewed by Jessie Berlin.
This test tests for the onshow, onclick, and onclose events. onerror is called only if the
origin did not have permission to show the notification, and that is covered in
http/tests/notifications/{legacy,}/show.html.
* http/tests/notifications/events-expected.txt: Added.
* http/tests/notifications/events.html: Added.
* http/tests/notifications/legacy/events-expected.txt: Added.
* http/tests/notifications/legacy/events.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (127363 => 127364)
--- trunk/LayoutTests/ChangeLog 2012-09-01 07:45:01 UTC (rev 127363)
+++ trunk/LayoutTests/ChangeLog 2012-09-01 07:49:07 UTC (rev 127364)
@@ -1,5 +1,22 @@
2012-08-31 Jon Lee <[email protected]>
+ [Tests] Add a test for all notification events
+ https://bugs.webkit.org/show_bug.cgi?id=95609
+ <rdar://problem/12218309>
+
+ Reviewed by Jessie Berlin.
+
+ This test tests for the onshow, onclick, and onclose events. onerror is called only if the
+ origin did not have permission to show the notification, and that is covered in
+ http/tests/notifications/{legacy,}/show.html.
+
+ * http/tests/notifications/events-expected.txt: Added.
+ * http/tests/notifications/events.html: Added.
+ * http/tests/notifications/legacy/events-expected.txt: Added.
+ * http/tests/notifications/legacy/events.html: Added.
+
+2012-08-31 Jon Lee <[email protected]>
+
[Tests] Move fast/notifications/notifications-event-listener-crash.html to http/tests/notifications
https://bugs.webkit.org/show_bug.cgi?id=95535
<rdar://problem/12213781>
Added: trunk/LayoutTests/http/tests/notifications/events-expected.txt (0 => 127364)
--- trunk/LayoutTests/http/tests/notifications/events-expected.txt (rev 0)
+++ trunk/LayoutTests/http/tests/notifications/events-expected.txt 2012-09-01 07:49:07 UTC (rev 127364)
@@ -0,0 +1,14 @@
+This test looks for the dispatch of the event handlers.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Granting permission to http://127.0.0.1:8000
+PASS Notification.permission is "granted"
+PASS onshow event handler was called
+PASS onclick event handler was called
+PASS onclose event handler was called
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/http/tests/notifications/events.html (0 => 127364)
--- trunk/LayoutTests/http/tests/notifications/events.html (rev 0)
+++ trunk/LayoutTests/http/tests/notifications/events.html 2012-09-01 07:49:07 UTC (rev 127364)
@@ -0,0 +1,38 @@
+<!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 event handlers.");
+
+if (window.testRunner) {
+ debug("Granting permission to " + testURL);
+ testRunner.grantWebNotificationPermission(testURL);
+}
+
+shouldBeEqualToString("Notification.permission", "granted");
+
+var n = new Notification("title");
+n._onshow_ = function() {
+ testPassed("onshow event handler was called");
+ testRunner.simulateWebNotificationClick(this);
+};
+n._onclick_ = function() {
+ testPassed("onclick event handler was called");
+ this.close();
+};
+n._onclose_ = function() {
+ testPassed("onclose event handler was called");
+ testCompleted();
+};
+n._onerror_ = function() {
+ testFailed("onerror event handler should not be called");
+ testCompleted();
+};
+
+setTimeout(testCompleted, 100);
+</script>
Added: trunk/LayoutTests/http/tests/notifications/legacy/events-expected.txt (0 => 127364)
--- trunk/LayoutTests/http/tests/notifications/legacy/events-expected.txt (rev 0)
+++ trunk/LayoutTests/http/tests/notifications/legacy/events-expected.txt 2012-09-01 07:49:07 UTC (rev 127364)
@@ -0,0 +1,14 @@
+This test looks for the dispatch of the event handlers.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Granting permission to http://127.0.0.1:8000
+PASS webkitNotifications.checkPermission() is 0
+PASS ondisplay event handler was called
+PASS onclick event handler was called
+PASS onclose event handler was called
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/http/tests/notifications/legacy/events.html (0 => 127364)
--- trunk/LayoutTests/http/tests/notifications/legacy/events.html (rev 0)
+++ trunk/LayoutTests/http/tests/notifications/legacy/events.html 2012-09-01 07:49:07 UTC (rev 127364)
@@ -0,0 +1,39 @@
+<!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 event handlers.");
+
+if (window.testRunner) {
+ debug("Granting permission to " + testURL);
+ testRunner.grantWebNotificationPermission(testURL);
+}
+
+shouldBe("webkitNotifications.checkPermission()", "0");
+
+var n = webkitNotifications.createNotification("", "title", "body");
+n._ondisplay_ = function() {
+ testPassed("ondisplay event handler was called");
+ testRunner.simulateWebNotificationClick(this);
+};
+n._onclick_ = function() {
+ testPassed("onclick event handler was called");
+ this.cancel();
+};
+n._onclose_ = function() {
+ testPassed("onclose event handler was called");
+ testCompleted();
+};
+n._onerror_ = function() {
+ testFailed("onerror event handler should not be called");
+ testCompleted();
+};
+n.show();
+
+setTimeout(testCompleted, 100);
+</script>
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes