Index: third_party/WebKit/LayoutTests/fast/speechsynthesis/speech-synthesis-utterance-voice.html |
diff --git a/third_party/WebKit/LayoutTests/fast/speechsynthesis/speech-synthesis-utterance-voice.html b/third_party/WebKit/LayoutTests/fast/speechsynthesis/speech-synthesis-utterance-voice.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..f0fa6eac68eeae071128a9376c3dbd1e447c5a47 |
--- /dev/null |
+++ b/third_party/WebKit/LayoutTests/fast/speechsynthesis/speech-synthesis-utterance-voice.html |
@@ -0,0 +1,38 @@ |
+<!DOCTYPE html> |
+<title>SpeechSynthesisUtterance voice attribute</title> |
+<script src="../../resources/testharness.js"></script> |
+<script src="../../resources/testharnessreport.js"></script> |
+<script> |
+test(() => { |
+ const u = new SpeechSynthesisUtterance(); |
+ assert_equals(u.voice, null); |
+}, 'initial state'); |
+ |
+test(() => { |
+ const u = new SpeechSynthesisUtterance(); |
+ u.voice = null; |
+ assert_equals(u.voice, null); |
+ u.voice = undefined; |
+ assert_equals(u.voice, null); |
+}, 'setting to null/undefined'); |
+ |
+test(() => { |
+ const u = new SpeechSynthesisUtterance(); |
+ for (const value of [{}, "", window]) { |
+ assert_throws(new TypeError, () => { u.voice = value; } ); |
+ assert_equals(u.voice, null); |
+ } |
+}, 'setting to non-SpeechSynthesisVoice values'); |
+ |
+test(() => { |
+ internals.enableMockSpeechSynthesizer(document); |
+ |
+ const u = new SpeechSynthesisUtterance(); |
+ const voice = speechSynthesis.getVoices()[0]; |
+ // TODO(foolip): This should test instanceof SpeechSynthesisVoice when that |
+ // interface is exposed. |
+ assert_equals(typeof voice, "object"); |
+ u.voice = voice; |
+ assert_equals(u.voice, voice); |
+}, 'setting to SpeechSynthesisVoice'); |
+</script> |