Skip to content

Commit

Permalink
Reland "Add WPT for Web Speech API events"
Browse files Browse the repository at this point in the history
This reverts commit b259ae00ad118c94e05fe99a5e963cda2e3c485c.

Reason for revert: Fixing the on-error test

Original change's description:
> Revert "Add WPT for Web Speech API events"
>
> This reverts commit 6b9b281088f658531546eddf186fb5076aa442a4.
>
> Reason for revert: Step "chrome_wpt_tests (retry shards) on Windows-11" failing on builder "chromium/ci/win11-arm64-rel-tests"
>
> Example failing build: ci.chromium.org/ui/p/chromium/builders/ci/win11-arm64-rel-tests/3472/overview
>
> Original change's description:
> > Add WPT for Web Speech API events
> >
> > This CL adds some basic web platform tests to ensure that the onstart, onend, and onerror events are fired for the Web Speech API.
> >
> > Change-Id: Ieeaab551b95b56503917e468f9ec33d857790dad
> > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6137598
> > Commit-Queue: Evan Liu <[email protected]>
> > Reviewed-by: Yiren Wang <[email protected]>
> > Cr-Commit-Position: refs/heads/main@{#1402727}
>
> Change-Id: I6073a364b704f0aa9df1d7ed38820b3ae5ba4d78
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6147490
> Bot-Commit: Rubber Stamper <[email protected]>
> Commit-Queue: Rubber Stamper <[email protected]>
> Auto-Submit: Joshua Hood <[email protected]>
> Cr-Commit-Position: refs/heads/main@{#1402940}

Change-Id: If34212a75aa5ac4bddc33d13846409a815ec9ff4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6149075
Reviewed-by: Yiren Wang <[email protected]>
Commit-Queue: Evan Liu <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1403265}
  • Loading branch information
evliu-google authored and chromium-wpt-export-bot committed Jan 7, 2025
1 parent 0a499ef commit a057897
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 0 deletions.
26 changes: 26 additions & 0 deletions speech-api/SpeechRecognition-onerror.https.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<!DOCTYPE html>
<title>SpeechRecognition onerror event</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
promise_test(async t => {
window.SpeechRecognition = window.SpeechRecognition || window.webkitSpeechRecognition;
const recognition = new SpeechRecognition();

// Promise that resolves when the 'error' event is fired.
const errorPromise = new Promise(resolve => {
recognition.onerror = (event) => {
resolve();
};
});

// Start speech recognition.
recognition.start();

// Wait for the 'error' event.
await errorPromise;

// Stop speech recognition.
recognition.stop();
}, 'Speech recognition onerror event is called.');
</script>
36 changes: 36 additions & 0 deletions speech-api/SpeechRecognition-onstart-onend.https.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<!DOCTYPE html>
<title>SpeechRecognition onstart and onend events</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
promise_test(async t => {
window.SpeechRecognition = window.SpeechRecognition || window.webkitSpeechRecognition;
const recognition = new SpeechRecognition();

// Promise that resolves when the 'start' event is fired.
const startPromise = new Promise(resolve => {
recognition.onstart = () => {
resolve();
};
});

// Promise that resolves when the 'end' event is fired.
const endPromise = new Promise(resolve => {
recognition.onend = () => {
resolve();
};
});

// Start speech recognition.
recognition.start();

// Wait for the 'start' event.
await startPromise;

// Stop speech recognition.
recognition.stop();

// Wait for the 'end' event.
await endPromise;
}, 'Speech recognition onstart and onend events are called.');
</script>

0 comments on commit a057897

Please sign in to comment.