blob: f2bb17a8cf92db5043b07b35248c71ab844ac473 [file] [log] [blame]
<!DOCTYPE html> <!-- webkit-test-runner [ useFlexibleViewport=true ] -->
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
<script src="../../../resources/js-test.js"></script>
<script src="../../../resources/ui-helper.js"></script>
<html>
<head>
<style>
body {
width: 100%;
height: 100%;
font-family: system-ui;
font-size: 18px;
pointer-events: none;
}
iframe {
border: red 2px solid;
top: -100px;
width: 100px;
height: 100px;
position: fixed;
box-sizing: border-box;
}
.vertical-space {
width: 100%;
height: 2000px;
}
.text {
text-align: center;
-webkit-user-select: none;
}
</style>
</head>
<body>
<iframe srcdoc="
<body>
<a>&nbsp;</a>
<script>
getSelection().setPosition(document.body, 0);
document.designMode = 'on';
</script>
</body>
"></iframe>
<body id="lorem-body">
<div id="description" class="text"></div>
<div class="vertical-space"></div>
<div id="console"></div>
</body>
<script>
jsTestIsAsync = true;
description("This test verifies that the UI process doesn't hang if the user taps during a loupe gesture if focus is inside editable content in a same-origin child frame. To run the test manually, long press and drag on the page with one finger, and tap the page several times with the other finger at the same time. The UI process should not permanently hang as a result.");
function performLoupeGestureAndSingleTap()
{
return new Promise(resolve => {
testRunner.runUIScript(`
(function() {
const eventStream = {
events : [
{
// First finger down.
interpolate : "linear",
timestep: 0.016,
coordinateSpace : "content",
startEvent : {
inputType : "hand",
timeOffset : 0,
touches : [
{
inputType : "finger",
phase : "began",
id : 1,
x : 100,
y : 100,
pressure : 0
}
]
},
endEvent : {
inputType : "hand",
timeOffset : 0.5,
touches : [
{
inputType : "finger",
phase : "moved",
id : 1,
x : 100,
y : 100,
pressure : 0
}
]
}
},
{
// First finger drag.
interpolate : "linear",
timestep: 0.016,
coordinateSpace : "content",
startEvent : {
inputType : "hand",
timeOffset : 0.5,
touches : [
{
inputType : "finger",
phase : "moved",
id : 1,
x : 100,
y : 100,
pressure : 0
}
]
},
endEvent : {
inputType : "hand",
timeOffset : 1,
touches : [
{
inputType : "finger",
phase : "moved",
id : 1,
x : 100,
y : 450,
pressure : 0
}
]
}
},
{
// Second finger down.
interpolate : "linear",
timestep: 0.016,
coordinateSpace : "content",
startEvent : {
inputType : "hand",
timeOffset : 1,
touches : [
{
inputType : "finger",
phase : "began",
id : 2,
x : 200,
y : 200,
pressure : 0
}
]
},
endEvent : {
inputType : "hand",
timeOffset : 1,
touches : [
{
inputType : "finger",
phase : "stationary",
id : 2,
x : 200,
y : 200,
pressure : 0
}
]
}
},
{
// Second finger up.
interpolate : "linear",
timestep: 0.016,
coordinateSpace : "content",
startEvent : {
inputType : "hand",
timeOffset : 1,
touches : [
{
inputType : "finger",
phase : "stationary",
id : 2,
x : 200,
y : 200,
pressure : 0
}
]
},
endEvent : {
inputType : "hand",
timeOffset : 1,
touches : [
{
inputType : "finger",
phase : "ended",
id : 2,
x : 200,
y : 200,
pressure : 0
}
]
}
},
{
// First finger up.
interpolate : "linear",
timestep: 0.016,
coordinateSpace : "content",
startEvent : {
inputType : "hand",
timeOffset : 1,
touches : [
{
inputType : "finger",
phase : "moved",
id : 1,
x : 100,
y : 450,
pressure : 0
}
]
},
endEvent : {
inputType : "hand",
timeOffset : 1,
touches : [
{
inputType : "finger",
phase : "ended",
id : 1,
x : 100,
y : 450,
pressure : 0
}
]
}
}
]
};
uiController.sendEventStream(JSON.stringify(eventStream), () => {
uiController.uiScriptComplete();
});
})();
`, resolve);
});
}
addEventListener("load", async () => {
const subframe = document.querySelector("iframe");
subframe.focus();
subframe.blur();
await performLoupeGestureAndSingleTap();
testPassed("Did not hang.");
finishJSTest();
});
</script>
</body>
</html>