blob: 3e3f37f592a7d7279166175311e218e01098f828 [file] [log] [blame]
<!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>