chromium/third_party/blink/web_tests/fast/events/constructors/speech-recognition-error-constructor.html

<!DOCTYPE html>
<html>
<head>
<script src="../../../resources/js-test.js"></script>
</head>
<body>
<p id="description"></p>
<div id="console"></div>
<script>

description("This tests the constructor for the SpeechRecognitionError DOM class.");

// Test constructor without initializer.
shouldBe("new webkitSpeechRecognitionError('eventType').bubbles", "false");
shouldBe("new webkitSpeechRecognitionError('eventType').cancelable", "false");
shouldBeEqualToString("new webkitSpeechRecognitionError('eventType').error", "");
shouldBeEqualToString("new webkitSpeechRecognitionError('eventType').message", "");

// Test passing bubbles in the initializer.
shouldBe("new webkitSpeechRecognitionError('eventType', { bubbles: false }).bubbles", "false");
shouldBe("new webkitSpeechRecognitionError('eventType', { bubbles: true }).bubbles", "true");

// Test passing cancelable in the initializer.
shouldBe("new webkitSpeechRecognitionError('eventType', { cancelable: false }).cancelable", "false");
shouldBe("new webkitSpeechRecognitionError('eventType', { cancelable: true }).cancelable", "true");

// Test passing code in the initializer.
shouldBeEqualToString("new webkitSpeechRecognitionError('eventType', { error: 'bar' }).error", "bar");

// Test passing message in the initializer.
shouldBeEqualToString("new webkitSpeechRecognitionError('eventType', { message: 'foo' }).message", "foo");

</script>
</body>
</html>