Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Speech JavaScript API: Add test for constructing SpeechRecognitionErr…
…or events https://bugs.webkit.org/show_bug.cgi?id=88868 Reviewed by Adam Barth. Source/WebCore: This adds a test for constructing SpeechRecognitionError events, and code to make it work. Test: fast/events/constructors/speech-recognition-error-constructor.html * Modules/speech/SpeechRecognitionError.cpp: (WebCore::SpeechRecognitionError::create): (WebCore): (WebCore::SpeechRecognitionError::SpeechRecognitionError): (WebCore::SpeechRecognitionErrorInit::SpeechRecognitionErrorInit): * Modules/speech/SpeechRecognitionError.h: (SpeechRecognitionErrorInit): (WebCore): (SpeechRecognitionError): (WebCore::SpeechRecognitionError::code): * Modules/speech/SpeechRecognitionError.idl: LayoutTests: Add a layout test for constructing SpeechRecognitionError events. * fast/events/constructors/speech-recognition-error-constructor-expected.txt: Added. * fast/events/constructors/speech-recognition-error-constructor.html: Added. Canonical link: https://commits.webkit.org/106803@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@120181 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information
Showing
7 changed files
with
125 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
LayoutTests/fast/events/constructors/speech-recognition-error-constructor-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
This tests the constructor for the SpeechRecognitionError DOM class. | ||
|
||
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". | ||
|
||
|
||
PASS new webkitSpeechRecognitionError('eventType').bubbles is false | ||
PASS new webkitSpeechRecognitionError('eventType').cancelable is false | ||
PASS new webkitSpeechRecognitionError('eventType').code is 0 | ||
PASS new webkitSpeechRecognitionError('eventType').message is "" | ||
PASS new webkitSpeechRecognitionError('eventType', { bubbles: false }).bubbles is false | ||
PASS new webkitSpeechRecognitionError('eventType', { bubbles: true }).bubbles is true | ||
PASS new webkitSpeechRecognitionError('eventType', { cancelable: false }).cancelable is false | ||
PASS new webkitSpeechRecognitionError('eventType', { cancelable: true }).cancelable is true | ||
PASS new webkitSpeechRecognitionError('eventType', { code: 1 }).code is 1 | ||
PASS new webkitSpeechRecognitionError('eventType', { code: 12345 }).code is 12345 | ||
PASS new webkitSpeechRecognitionError('eventType', { message: 'foo' }).message is "foo" | ||
|
39 changes: 39 additions & 0 deletions
39
LayoutTests/fast/events/constructors/speech-recognition-error-constructor.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<script src="../../js/resources/js-test-pre.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"); | ||
shouldBe("new webkitSpeechRecognitionError('eventType').code", "0"); | ||
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. | ||
shouldBe("new webkitSpeechRecognitionError('eventType', { code: 1 }).code", "1"); | ||
shouldBe("new webkitSpeechRecognitionError('eventType', { code: 12345 }).code", "12345"); | ||
|
||
// Test passing message in the initializer. | ||
shouldBeEqualToString("new webkitSpeechRecognitionError('eventType', { message: 'foo' }).message", "foo"); | ||
|
||
</script> | ||
<script src="../../js/resource/js-test-post.js"></script> | ||
</body> | ||
</html> | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters