<!DOCTYPE html>
<title>Verify that moving a video element to document pip, still plays it normally</title>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<video></video>
<script>
async_test(function(t) {
var video = document.querySelector('video');
video.src = "content/test.ogv";
video.onloadeddata = this.step_func(function() {
video.onloadeddata = null;
assert_true(video.networkState == video.NETWORK_IDLE || video.networkState == video.NETWORK_LOADING);
assert_greater_than(video.readyState, video.HAVE_METADATA);
// Simulate user activation to enable document pip.
let mouseAction =
[{"source": "mouse",
"actions": [
{ "name": "pointerDown", "x": 0, "y": 0 },
{ "name": "pointerUp" }]}]
chrome.gpuBenchmarking.pointerActionSequence(mouseAction, this.step_func(function() {
documentPictureInPicture.requestWindow().then(this.step_func_done(function(pipWindow) {
// Move video to document pip and verify that it plays properly.
pipWindow.document.body.append(video);
assert_true(video.networkState == video.NETWORK_IDLE || video.networkState == video.NETWORK_LOADING);
assert_greater_than(video.readyState, video.HAVE_METADATA);
}));
}));
});
});
</script>