https://github.com/web-platform-tests/wpt
Raw File
Tip revision: f7b5d90ef08a5419317a2456d9804aa664661507 authored by xiaoyu3x on 22 March 2018, 02:15:48 UTC
Add CEReactions tests for HTMLButtonElement
Tip revision: f7b5d90
picture-in-picture-helpers.js
function callWithTrustedClick(callback) {
  return new Promise(resolve => {
    let button = document.createElement('button');
    button.textContent = 'click to continue test';
    button.style.display = 'block';
    button.style.fontSize = '20px';
    button.style.padding = '10px';
    button.onclick = () => {
      document.body.removeChild(button);
      resolve(callback());
    };
    document.body.appendChild(button);
    test_driver.click(button);
  });
}

// Calls requestPictureInPicture() in a context that's 'allowed to request PiP'.
function requestPictureInPictureWithTrustedClick(videoElement) {
  return callWithTrustedClick(
      () => videoElement.requestPictureInPicture());
}
back to top