chromium/third_party/blink/web_tests/media/remove-from-document.html

<!DOCTYPE html>
<title>Test that removing a media element from the tree pauses playback but does not unload the media.</title>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<video autoplay></video>
<script>
async_test(function(t) {
  const video = document.querySelector("video");
  video.src = "content/test.ogv";

  video.oncanplaythrough = t.step_func(() => {
    assert_not_equals(video.networkState, HTMLMediaElement.NETWORK_EMPTY);
    assert_false(video.paused);

    document.body.removeChild(video);

    assert_not_equals(video.networkState, HTMLMediaElement.NETWORK_EMPTY);

    setTimeout(t.step_func_done(() => {
      assert_true(video.paused);
    }));
  });
});
</script>