chromium/third_party/blink/web_tests/fast/dom/HTMLStyleElement/style-onload2.html

<!DOCTYPE html>
<html>
<head>
<script src="../HTMLLinkElement/resources/link-load-utilities.js"></script>
<script>
var numberOfFiredLoadEvents = 0;
var expectedNumberOfFiredLoadEvents = 2;

function checkIfDone(elementName)
{
  ++numberOfFiredLoadEvents;

  if (numberOfFiredLoadEvents < expectedNumberOfFiredLoadEvents && elementName === 'body') {
    log("FAIL Fired window Load event before style Load events.");
    testFinished();
  }
  if (numberOfFiredLoadEvents === expectedNumberOfFiredLoadEvents) {
    log("PASS Fired " + numberOfFiredLoadEvents + " Load events.");
    testFinished();
  }
}
</script>
<style onload="checkIfDone('style1')"></style>
<style onload="checkIfDone('style2')"></style>
</head>
<body onload="checkIfDone('body')">
<p>This tests that we fire two Load events on a page with two HTML Style elements and that both events are fired before the Load event for the window is dispatched. This test PASSED if you see the word PASS below. Otherwise, it FAILED.
<pre id="console"></pre>
</body>
</html>