<!DOCTYPE html>
<script src="/js-test-resources/js-test.js"></script>
<script>
description("This tests Notification.permission's returned Promise");
jsTestIsAsync = true;

if (!window.internals)
    finishJSTest();

function step1() {
    debug("Requesting permission with default permission without user gesture");
    shouldBeEqualToString("Notification.permission", "default");
    internals.withoutUserGesture(() => {
        Notification.requestPermission().then((permission) => {
            if (permission == 'denied')
                testPassed("permission is denied");
            else
                testFailed("permission should be denied, but is " + permission);
            shouldBeEqualToString("Notification.permission", "default");
            setTimeout(step2, 0);
        });
    });
}

function step2() {
    debug("Requesting permission with default permission with user gesture");
    shouldBeEqualToString("Notification.permission", "default");
    internals.withUserGesture(() => {
        Notification.requestPermission().then((permission) => {
            if (permission == 'granted')
                testPassed("permission is granted");
            else
                testFailed("permission should be granted, but is " + permission);
            shouldBeEqualToString("Notification.permission", "granted");
            setTimeout(step3, 0);
        });
    });
}

function step3() {
    debug("Requesting permission with non-default permission");
    testRunner.denyWebNotificationPermission(self.origin);
    internals.withUserGesture(() => {
        Notification.requestPermission().then((permission) => {
            if (permission == 'denied')
                testPassed("permission is denied");
            else
                testFailed("permission should be denied, but is " + permission);
            shouldBeEqualToString("Notification.permission", "denied");
            finishJSTest();
        });
    });
}

step1();
</script>
