chromium/third_party/blink/web_tests/fast/events/touch/gesture/long-press-on-draggable-element-in-nested-iframes-triggers-drag.html

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../../../../resources/testharness.js"></script>
<script src="../../../../resources/testharnessreport.js"></script>
<script src="../../../../resources/gesture-util.js"></script>
<script src="../../../../resources/testdriver.js"></script>
<script src="../../../../resources/testdriver-actions.js"></script>
<script src="../../../..//resources/testdriver-vendor.js"></script>
<style>
  iframe {
    height: 200px;
    width: 200px;
    overflow: hidden;
  }
</style>
</head>
<body>
<script>
if (window.internals)
  internals.settings.setTouchDragDropEnabled(true);

// The iframe will call top.dragStarted() or top.mousedownTriggered() on
// receiving the corresponding event.
function mousedownTriggered() {
  rejectDragStartPromise();
}

function dragStarted(element) {
  resolveDragStartPromise(element);
}

let resolveDragStartPromise = undefined;
let rejectDragStartPromise = undefined;
function dragStartEvent() {
  return new Promise((resolve, reject) => {
    resolveDragStartPromise = resolve;
    rejectDragStartPromise = () => {
      reject('missing dragstart event');
    }
  });
}
</script>
<iframe src="resources/drag-inside-nested-iframes2.html"></iframe>
<p>This test checks that a long press gesture on a draggable element in an iframe starts a drag/drop session.</p>
<script>
// The runTest method is triggered via top.runTest when the iframe is loaded.
function runTest() {
  promise_test(async t => {
    preventContextMenu(t);
    const target = document.querySelector('iframe');
    let dragPromise = dragStartEvent();
    let longpressOptions = { x: -50, y: -50, duration: 1200 };
    await touchLongPressElement(target, longpressOptions);
    let result = await dragPromise;
    assert_equals(result.id, 'draggableDiv');
  }, 'Long press gesture on a draggable element in a nested iframe starts a ' +
     'drag/drop session.');
}
</script>
</body>
</html>