From 26a029d407be480d791972afb5975cf62c9360a6 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 02:47:55 +0200 Subject: Adding upstream version 124.0.1. Signed-off-by: Daniel Baumann --- testing/web-platform/tests/speech-api/META.yml | 5 + .../SpeechRecognition-abort-manual.https.html | 43 ++++++ .../speech-api/SpeechRecognition-basics.https.html | 14 ++ .../SpeechRecognition-onerror-manual.https.html | 42 ++++++ .../SpeechRecognition-onresult-manual.https.html | 157 +++++++++++++++++++++ .../SpeechRecognition-stop-manual.https.html | 40 ++++++ .../SpeechSynthesis-pause-resume.tentative.html | 50 +++++++ .../speech-api/SpeechSynthesis-speak-events.html | 22 +++ .../speech-api/SpeechSynthesis-speak-twice.html | 23 +++ ...s-speak-without-activation-fails.tentative.html | 16 +++ .../SpeechSynthesisErrorEvent-constructor.html | 88 ++++++++++++ .../SpeechSynthesisEvent-constructor.html | 70 +++++++++ .../SpeechSynthesisEvent-properties.html | 25 ++++ .../SpeechSynthesisUtterance-basics.https.html | 51 +++++++ .../SpeechSynthesisUtterance-volume-manual.html | 64 +++++++++ .../web-platform/tests/speech-api/historical.html | 34 +++++ .../tests/speech-api/idlharness.window.js | 51 +++++++ testing/web-platform/tests/speech-api/webspeech.js | 111 +++++++++++++++ 18 files changed, 906 insertions(+) create mode 100644 testing/web-platform/tests/speech-api/META.yml create mode 100644 testing/web-platform/tests/speech-api/SpeechRecognition-abort-manual.https.html create mode 100644 testing/web-platform/tests/speech-api/SpeechRecognition-basics.https.html create mode 100644 testing/web-platform/tests/speech-api/SpeechRecognition-onerror-manual.https.html create mode 100644 testing/web-platform/tests/speech-api/SpeechRecognition-onresult-manual.https.html create mode 100644 testing/web-platform/tests/speech-api/SpeechRecognition-stop-manual.https.html create mode 100644 testing/web-platform/tests/speech-api/SpeechSynthesis-pause-resume.tentative.html create mode 100644 testing/web-platform/tests/speech-api/SpeechSynthesis-speak-events.html create mode 100644 testing/web-platform/tests/speech-api/SpeechSynthesis-speak-twice.html create mode 100644 testing/web-platform/tests/speech-api/SpeechSynthesis-speak-without-activation-fails.tentative.html create mode 100644 testing/web-platform/tests/speech-api/SpeechSynthesisErrorEvent-constructor.html create mode 100644 testing/web-platform/tests/speech-api/SpeechSynthesisEvent-constructor.html create mode 100644 testing/web-platform/tests/speech-api/SpeechSynthesisEvent-properties.html create mode 100644 testing/web-platform/tests/speech-api/SpeechSynthesisUtterance-basics.https.html create mode 100644 testing/web-platform/tests/speech-api/SpeechSynthesisUtterance-volume-manual.html create mode 100644 testing/web-platform/tests/speech-api/historical.html create mode 100644 testing/web-platform/tests/speech-api/idlharness.window.js create mode 100644 testing/web-platform/tests/speech-api/webspeech.js (limited to 'testing/web-platform/tests/speech-api') diff --git a/testing/web-platform/tests/speech-api/META.yml b/testing/web-platform/tests/speech-api/META.yml new file mode 100644 index 0000000000..2b7a03e245 --- /dev/null +++ b/testing/web-platform/tests/speech-api/META.yml @@ -0,0 +1,5 @@ +spec: https://wicg.github.io/speech-api/ +suggested_reviewers: + - andrenatal + - foolip + - marcoscaceres diff --git a/testing/web-platform/tests/speech-api/SpeechRecognition-abort-manual.https.html b/testing/web-platform/tests/speech-api/SpeechRecognition-abort-manual.https.html new file mode 100644 index 0000000000..3c9e1ab251 --- /dev/null +++ b/testing/web-platform/tests/speech-api/SpeechRecognition-abort-manual.https.html @@ -0,0 +1,43 @@ + + + + + SpeechRecognition.abort + + + + + +

Instructions: Do NOT speak. Run test in silence. + This test may fail if too much noise.

+
+
+ + + + diff --git a/testing/web-platform/tests/speech-api/SpeechRecognition-basics.https.html b/testing/web-platform/tests/speech-api/SpeechRecognition-basics.https.html new file mode 100644 index 0000000000..dc5d3f5c1d --- /dev/null +++ b/testing/web-platform/tests/speech-api/SpeechRecognition-basics.https.html @@ -0,0 +1,14 @@ + +SpeechRecognition basics + + + diff --git a/testing/web-platform/tests/speech-api/SpeechRecognition-onerror-manual.https.html b/testing/web-platform/tests/speech-api/SpeechRecognition-onerror-manual.https.html new file mode 100644 index 0000000000..b0d5d5ebed --- /dev/null +++ b/testing/web-platform/tests/speech-api/SpeechRecognition-onerror-manual.https.html @@ -0,0 +1,42 @@ + + + + + SpeechRecognition.onerror no-speech + + + + + + +

Instructions: Do NOT speak. Run test in silence. + This test may fail if too much noise.

+
+
+ + + + diff --git a/testing/web-platform/tests/speech-api/SpeechRecognition-onresult-manual.https.html b/testing/web-platform/tests/speech-api/SpeechRecognition-onresult-manual.https.html new file mode 100644 index 0000000000..6a0877bbe1 --- /dev/null +++ b/testing/web-platform/tests/speech-api/SpeechRecognition-onresult-manual.https.html @@ -0,0 +1,157 @@ + + + + + + SpeechRecognition.onresult + + + + + + + Instructions: +

Reload and re-run this test at least 4 times to cover all 4 combinations + of these checkboxes: + continuous + interimResults + +
+ You may also wish to test with various combinations of these: + maxAlternatives: + , + language: + +

+
+
+
+ + + + diff --git a/testing/web-platform/tests/speech-api/SpeechRecognition-stop-manual.https.html b/testing/web-platform/tests/speech-api/SpeechRecognition-stop-manual.https.html new file mode 100644 index 0000000000..e4741b7fc6 --- /dev/null +++ b/testing/web-platform/tests/speech-api/SpeechRecognition-stop-manual.https.html @@ -0,0 +1,40 @@ + + + + + SpeechRecognition.stop + + + + + +

Instructions: Do NOT speak. Run test in silence. + This test may fail if too much noise.

+
+
+ + + + diff --git a/testing/web-platform/tests/speech-api/SpeechSynthesis-pause-resume.tentative.html b/testing/web-platform/tests/speech-api/SpeechSynthesis-pause-resume.tentative.html new file mode 100644 index 0000000000..a7aa2bbf6f --- /dev/null +++ b/testing/web-platform/tests/speech-api/SpeechSynthesis-pause-resume.tentative.html @@ -0,0 +1,50 @@ + + + + + + + diff --git a/testing/web-platform/tests/speech-api/SpeechSynthesis-speak-events.html b/testing/web-platform/tests/speech-api/SpeechSynthesis-speak-events.html new file mode 100644 index 0000000000..cc28b822f3 --- /dev/null +++ b/testing/web-platform/tests/speech-api/SpeechSynthesis-speak-events.html @@ -0,0 +1,22 @@ + + + + + + + diff --git a/testing/web-platform/tests/speech-api/SpeechSynthesis-speak-twice.html b/testing/web-platform/tests/speech-api/SpeechSynthesis-speak-twice.html new file mode 100644 index 0000000000..2f9a401fc4 --- /dev/null +++ b/testing/web-platform/tests/speech-api/SpeechSynthesis-speak-twice.html @@ -0,0 +1,23 @@ + + + + + + + diff --git a/testing/web-platform/tests/speech-api/SpeechSynthesis-speak-without-activation-fails.tentative.html b/testing/web-platform/tests/speech-api/SpeechSynthesis-speak-without-activation-fails.tentative.html new file mode 100644 index 0000000000..676fe05d13 --- /dev/null +++ b/testing/web-platform/tests/speech-api/SpeechSynthesis-speak-without-activation-fails.tentative.html @@ -0,0 +1,16 @@ + + + + + diff --git a/testing/web-platform/tests/speech-api/SpeechSynthesisErrorEvent-constructor.html b/testing/web-platform/tests/speech-api/SpeechSynthesisErrorEvent-constructor.html new file mode 100644 index 0000000000..abefbf9a51 --- /dev/null +++ b/testing/web-platform/tests/speech-api/SpeechSynthesisErrorEvent-constructor.html @@ -0,0 +1,88 @@ + + + + + diff --git a/testing/web-platform/tests/speech-api/SpeechSynthesisEvent-constructor.html b/testing/web-platform/tests/speech-api/SpeechSynthesisEvent-constructor.html new file mode 100644 index 0000000000..e6b29683f7 --- /dev/null +++ b/testing/web-platform/tests/speech-api/SpeechSynthesisEvent-constructor.html @@ -0,0 +1,70 @@ + + + + + diff --git a/testing/web-platform/tests/speech-api/SpeechSynthesisEvent-properties.html b/testing/web-platform/tests/speech-api/SpeechSynthesisEvent-properties.html new file mode 100644 index 0000000000..f6c8f5fc32 --- /dev/null +++ b/testing/web-platform/tests/speech-api/SpeechSynthesisEvent-properties.html @@ -0,0 +1,25 @@ + +Properties of SpeechSynthesisEvent + + + + + + + diff --git a/testing/web-platform/tests/speech-api/SpeechSynthesisUtterance-basics.https.html b/testing/web-platform/tests/speech-api/SpeechSynthesisUtterance-basics.https.html new file mode 100644 index 0000000000..2fd394150e --- /dev/null +++ b/testing/web-platform/tests/speech-api/SpeechSynthesisUtterance-basics.https.html @@ -0,0 +1,51 @@ + +SpeechSynthesisUtterance basics + + + diff --git a/testing/web-platform/tests/speech-api/SpeechSynthesisUtterance-volume-manual.html b/testing/web-platform/tests/speech-api/SpeechSynthesisUtterance-volume-manual.html new file mode 100644 index 0000000000..6031c1dad6 --- /dev/null +++ b/testing/web-platform/tests/speech-api/SpeechSynthesisUtterance-volume-manual.html @@ -0,0 +1,64 @@ + + + + 5.2.3 SpeechSynthesisUtterance volume attribute test - Manual + + + + +
+

Specification:

+ volume attribute +
+ This attribute specifies the speaking volume for the utterance. It ranges between 0 and 1 inclusive, with 0 being the lowest volume and 1 the highest volume, with a default of 1. If SSML is used, this value will be overridden by prosody tags in the markup. +
+
+
+ Click to execute window.speechSynthesis.speak() with volume attribute set to 0, 0.2, 0.4, 0.6, 1. +
+
+
+ + +

Manaul Test:

Does the volume of audio output change? +
+ + diff --git a/testing/web-platform/tests/speech-api/historical.html b/testing/web-platform/tests/speech-api/historical.html new file mode 100644 index 0000000000..99d2fab5f5 --- /dev/null +++ b/testing/web-platform/tests/speech-api/historical.html @@ -0,0 +1,34 @@ + +Historical Speech API features + + +
+ diff --git a/testing/web-platform/tests/speech-api/idlharness.window.js b/testing/web-platform/tests/speech-api/idlharness.window.js new file mode 100644 index 0000000000..77eb6a1be9 --- /dev/null +++ b/testing/web-platform/tests/speech-api/idlharness.window.js @@ -0,0 +1,51 @@ +// META: script=/resources/WebIDLParser.js +// META: script=/resources/idlharness.js +// META: timeout=long + +'use strict'; + +// https://w3c.github.io/speech-api/#dom-speechsynthesis-getvoices can +// return an empty list and a voiceschanged event is fired if the list of +// voices is determined asynchronously. +function getVoices() { + return new Promise(resolve => { + const voices = speechSynthesis.getVoices(); + if (voices.length) { + resolve(voices); + } else { + // wait for voiceschanged event + speechSynthesis.addEventListener('voiceschanged', () => { + resolve(speechSynthesis.getVoices()); + }, { once: true }); + } + }); +} + +idl_test( + ['speech-api'], + ['dom', 'html'], + (idl_array, t) => { + idl_array.add_objects({ + SpeechGrammar: ['new SpeechGrammar()'], + SpeechGrammarList: ['new SpeechGrammarList()'], + SpeechRecognition: ['new SpeechRecognition()'], + // TODO: SpeechRecognitionAlternative + // TODO: SpeechRecognitionErrorEvent + // TODO: SpeechRecognitionEvent + // TODO: SpeechRecognitionResult + // TODO: SpeechRecognitionResultList + SpeechSynthesis: ['speechSynthesis'], + // TODO: SpeechSynthesisErrorEvent + // TODO: SpeechSynthesisEvent + SpeechSynthesisUtterance: ['new SpeechSynthesisUtterance()'], + SpeechSynthesisVoice: ['voice'], + Window: ['self'], + }); + + const awaitVoice = getVoices().then(voices => self.voice = voices[0]); + const timeout = new Promise((_, reject) => { + t.step_timeout(() => reject('Timed out waiting for voice'), 3000); + }); + return Promise.race([awaitVoice, timeout]); + } +); diff --git a/testing/web-platform/tests/speech-api/webspeech.js b/testing/web-platform/tests/speech-api/webspeech.js new file mode 100644 index 0000000000..f2f51b694c --- /dev/null +++ b/testing/web-platform/tests/speech-api/webspeech.js @@ -0,0 +1,111 @@ +var DELAY = 500; // In milliseconds. +var TIMEOUT = 2000; // In milliseconds. Used for most tests. +if (typeof(TIMEOUT_OVERRIDE) != 'undefined') { + TIMEOUT = TIMEOUT_OVERRIDE; +} +GLOBAL_TIMEOUT = TIMEOUT + 2000; // In milliseconds. +setup({timeout: GLOBAL_TIMEOUT}); +var onstarted = false; +var neverFireTest = async_test('Events that should not fire'); +var onstartTest = async_test('onstart'); +var reco = new SpeechRecognition(); + +reco.onstart = onstartTest.step_func(function(event) { + assert_false(onstarted, 'onstart should only fire once.'); + onstarted = true; + onstartTest.done(); + beginTest(); +}); + +reco.onend = function() { + neverFireTest.done(); + for (var i = 0; i < doneOnEndTestList.length; i++) { + doneOnEndTestList[i].done(); + } +}; + +function neverFireEvent(name) { + return neverFireTest.step_func(function(event) { + assert_unreached(name + ' should not fire.'); + }); +} + +var doneOnEndTestList = []; // List of all test objects to call done at onend. + +// Tally calls to count() and test against min/max when test ends. +// A max value of 0 indicates no maximum. +function CountTest(name, min, max) { + doneOnEndTestList.push(this); + this.name = name; + this.min = min; + this.max = max; + this.sum = 0; + this.asyncTest = async_test(name); + + this.count = function(increment) { this.sum += increment; }; + + this.test = function() { return this.asyncTest; }; + + this.done = function() { + var cTest = this; + this.asyncTest.step(function() { + notes.innerHTML += cTest.name + ' occurred ' + cTest.sum + ' times.
'; + if (cTest.min == cTest.max) { + assert_equals(cTest.sum, cTest.min, cTest.name + ' occurred ' + + cTest.sum + ' times and should have occurred ' + + cTest.min + ' times.'); + } else { + assert_true(cTest.sum >= cTest.min, cTest.name + ' occurred ' + + cTest.sum + ' times and should have occurred at least ' + + cTest.min + ' times.'); + assert_true(cTest.max == 0 || cTest.sum <= cTest.max, cTest.name + + ' occurred ' + cTest.sum + + ' times and should have occurred at most ' + cTest.max + ' times.'); + } + if (cTest.whenDone) { + cTest.whenDone(); + } + }); + this.asyncTest.done(); + }; +} + +// Test for proper cycling of startEvent followed by endEvent. +function CycleTest(name) { + doneOnEndTestList.push(this); + this.name = name; + this.count = 0; // Counts number of start / end cycles. + this.started = false; // Tracks whether last event was a start or end event. + this.test = async_test(name + ' start/stop'); + + this.startEvent = function() { + var cycle = this; + return this.test.step_func(function(event) { + assert_true(onstarted, cycle.name + 'start fired before onstart.'); + assert_false(cycle.started, cycle.name + 'start fired twice without ' + + cycle.name + 'stop.'); + cycle.started = true; + }); + }; + + this.endEvent = function() { + var cycle = this; + return this.test.step_func(function(event) { + assert_true(cycle.started, cycle.name + 'end fired before ' + + cycle.name + 'start.'); + cycle.started = false; + cycle.count += 1; + }); + }; + + this.done = function() { + var cycle = this; + this.test.step(function() { + assert_false(cycle.started, cycle.name + 'start fired but not ' + + cycle.name + 'end.'); + assert_true(cycle.count > 0, cycle.name + 'start never fired.'); + notes.innerHTML += cycle.name + ' cycled ' + cycle.count + ' times.
'; + }); + this.test.done(); + }; +} -- cgit v1.2.3