chromium/third_party/blink/web_tests/editing/execCommand/clipboard-access-with-userGesture.html

<!DOCTYPE html>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script>
var copyEventSeen;
var cutEventSeen;

function runTest()
{
    test(() => {
      assert_own_property(window, 'testRunner');
      testRunner.setJavaScriptCanAccessClipboard(false);
      clickButton("copy");
    }, 'Copy');

    test(() => {
      assert_own_property(window, 'testRunner');
      testRunner.setJavaScriptCanAccessClipboard(false);
      clickButton("cut");
    }, 'Cut');
}

function clickButton(id)
{
    var button = document.getElementById(id);
    eventSender.mouseMoveTo(button.offsetLeft + button.offsetWidth / 2, button.offsetTop + button.offsetHeight / 2);
    eventSender.mouseDown();
    eventSender.mouseUp();
}

function onClickCopy()
{
    copyEventSeen = false;
    assert_true(document.execCommand('copy'));
    assert_true(copyEventSeen);
}

function onClickCut()
{
    cutEventSeend = false;
    assert_true(document.execCommand('cut'));
    assert_true(cutEventSeen);
}

function onCopy()
{
    copyEventSeen = true;
}

function onCut()
{
    cutEventSeen = true;
}
</script>
<body oncopy="onCopy()" oncut="onCut()">
<p>To manually test, click one of the buttons below. The result should be two 'PASS' events for either button.
<div>
<button id="copy" onclick="onClickCopy()">Copy</button>
<button id="cut" onclick="onClickCut()">Cut</button>
</div>
<script>
runTest();
</script>
</body>