chromium/third_party/blink/web_tests/fast/media/print-restores-previous-mediatype.html

<html>
<head>
<title>Test that print restores previous media type</title>
<script type="text/javascript" src="resources/media-utils.js"></script>
<script type="text/javascript" charset="utf-8">
  if (window.testRunner) {
    testRunner.dumpAsText();
    internals.settings.setMediaTypeOverride("handheld");
  }

  function shouldBe(expected) {
    if (window.styleMedia.type === expected) {
      log(`PASS: window.styleMedia.type should be '${expected}' and is.`);
    } else {
      log(`FAIL: window.styleMedia.type should be '${expected}' but instead is ${window.styleMedia.type}.`);
    }
  }

  function runTests() {
    log("Media type is set to 'handheld' to be different than the default 'screen'");
    shouldBe("handheld");
    log("<br>The page is printed, which changes the media type to 'print', and then back");
    window.print();
    shouldBe("handheld");
  }
</script>
</head>
<body onload="runTests()">
  <div id="results"></div>
</body>
</html>