chromium/third_party/blink/web_tests/fast/speechsynthesis/speech-synthesis-speak.html

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../../resources/js-test.js"></script>
</head>
<body id="body">

<div id="console"></div>

<script>

    if (window.internals)
        internals.enableMockSpeechSynthesizer(window);

    description("This tests that the basic mechanisms of speaking text work, including sending the job and receiving the callback.");

    if (window.testRunner)
        testRunner.waitUntilDone();

    window.jsTestIsAsync = true;

    // Start a very short speaking job that will finish quickly.
    var u = new SpeechSynthesisUtterance(" ");

    u.onstart = function(event) {
       shouldBeTrue("event.elapsedTime >= 0");
       shouldBeTrue("event.elapsedTime < 1000");
       shouldBeTrue("speechSynthesis.speaking");
    }
    u.onend = function(event) {
       shouldBeTrue("event.elapsedTime > 0");
       shouldBeTrue("event.elapsedTime < 10000");
       shouldBeFalse("speechSynthesis.speaking");
       finishJSTest();
    }

    shouldBeFalse("speechSynthesis.speaking");
    speechSynthesis.speak(u);

</script>

</body>
</html>