<!DOCTYPE html>
<html>
<head>
</head>
<body>
<p>Test to ensure we don't crash when enumerating media devices. The test passes if it does not crash.</p>
<script>
    if (window.testRunner) {
        testRunner.dumpAsText();
        testRunner.waitUntilDone();
    }
</script>
</body>
<script>
function shouldNotCrash() {
    document.addEventListener("webglcontextlost", function () {
        var mediaDevices = window.navigator.mediaDevices;
        mediaDevices.enumerateDevices();
        mediaDevices.getUserMedia({});
        if (window.testRunner)
            testRunner.notifyDone();
    }, true);

    var event = document.createEvent("Event");
    event.initEvent("webglcontextlost", false, false);
    document.dispatchEvent(event);
}
shouldNotCrash();
</script>
</html>

