<!DOCTYPE html>
<html>
<head>
<script src="../../http/tests/inspector/resources/inspector-test.js"></script>
<script>

function load() {
    document.getElementById("test").addEventListener("click", (event) => {
        if (window.internals)
            TestPage.addResult(window.internals.hasTransientActivation() ? "Has transient activation" : "No transient activation");
    });

    runTest();
}

function test()
{
    let suite = InspectorTest.createAsyncSuite("Runtime.callFunctionOn");

    suite.addTestCase({
        name: "Runtime.callFunctionOn.emulateUserGesture.hasTransientActivation.false",
        description: "Check that callFunctionOn is not considered a user interaction when emulateUserGesture is false.",
        async test() {
            let testElement = await RuntimeAgent.evaluate.invoke({expression: `document.getElementById("test")`});
            await RuntimeAgent.callFunctionOn.invoke({functionDeclaration: `function() { this.click(); }`, emulateUserGesture: false, objectId: testElement.result.objectId});
        },
    });

    suite.addTestCase({
        name: "Runtime.callFunctionOn.emulateUserGesture.hasTransientActivation.true",
        description: "Check that callFunctionOn is considered a user interaction when emulateUserGesture is true.",
        async test() {
            let testElement = await RuntimeAgent.evaluate.invoke({expression: `document.getElementById("test")`});
            await RuntimeAgent.callFunctionOn.invoke({functionDeclaration: `function() { this.click(); }`, emulateUserGesture: true, objectId: testElement.result.objectId});
        },
    });

    suite.runTestCasesAndFinish();
}
</script>
</head>
<body onload="load()">
    <p>Tests for Runtime.callFunctionOn emulateUserGesture option.</p>
    <a id="test"></a>
</body>
</html>
