blob: 9a7a18e5f316100b7627f8e5167b1c5a75da401a [file] [log] [blame]
<!DOCTYPE html> <!-- webkit-test-runner [ useFlexibleViewport=true ] -->
<html>
<meta name="viewport" content="initial-scale=5, width=device-width">
<head>
<script src="../../resources/ui-helper.js"></script>
<script>
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.waitUntilDone();
}
if (window.internals)
internals.setTransientActivationDuration(0.01); // Use very short 10ms transient activation duration for testing.
let write = (message) => output.innerHTML += (message + "<br>");
function runTest()
{
document.getElementById("target").addEventListener("click", () => {
fetch("../files/resources/abe.png").then(() => {
// Cause the transient activation to expire with a setTimeout.
setTimeout(() => {
navigator.share({ title: "Example Page", url: "http://webkit.org", text: "text" }).then((result) => {
write("FAIL: Share sheet invoked.");
testRunner.notifyDone();
}, (exception) => {
write("PASS: Share promise was rejected: " + exception);
testRunner.notifyDone();
});
}, 100);
}, (exception) => {
write("FAIL: Fetch promise was rejected");
testRunner.notifyDone();
});
});
UIHelper.activateAt(50, 50);
}
</script>
<style>
#target {
height: 100px;
width: 100px;
background-color: silver;
}
</style>
</head>
<body onload="runTest()">
<pre id="output"></pre>
<button id="target">
</button>
</body>
</html>