blob: fce21af7ddb8813c82a31d3e851fd656e153e36d [file] [log] [blame]
<!DOCTYPE html>
<script src="/resources/js-test-pre.js"></script>
<script src="/resources/notifications-test-pre.js"></script>
<p id="description"></p>
<div id="console"></div>
<script>
if (window.testRunner) {
testRunner.grantWebNotificationPermission(testURL);
testRunner.setCanOpenWindows(true);
testRunner.waitUntilDone();
}
description("This test checks that a script can open windows when the user clicks on a native notification.");
shouldBe("webkitNotifications.checkPermission()", "0");
var n = webkitNotifications.createNotification("", "", "");
n.ondisplay = function() {
if (window.testRunner)
testRunner.simulateWebNotificationClick(this);
};
n.onclick = function() {
window.open('/notifications/resources/window-show-on-click.html');
};
n.show();
function onWindowOpen() {
testPassed('clicking on notification successfully opened a window');
testCompleted();
}
setTimeout(function() {
testFailed('clicking on notification did not open a window');
testCompleted();
}, 100);
</script>