mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-11-10 05:08:36 +02:00
Automatic update from web-platform-tests [RTCInsertableStreams] Add web tests for audio insertable streams Drive-by: update video tests to return correct promise and improve style. Bug: 1052765 Change-Id: Id1c31b577f0431b2073f0ae486926283aca41759 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2132200 Commit-Queue: Guido Urdaneta <guidou@chromium.org> Reviewed-by: Marina Ciocea <marinaciocea@chromium.org> Cr-Commit-Position: refs/heads/master@{#755919} -- wpt-commits: b3c42806623c70da7750344b16f3b6d796c9fe17 wpt-pr: 22661
30 lines
1.2 KiB
JavaScript
30 lines
1.2 KiB
JavaScript
// Based on similar tests in html/infrastructure/safe-passing-of-structured-data/shared-array-buffers/.
|
|
"use strict";
|
|
self.importScripts("/resources/testharness.js");
|
|
|
|
let state = "start in worker";
|
|
|
|
self.onmessage = e => {
|
|
if (e.data === "start in window") {
|
|
assert_equals(state, "start in worker");
|
|
e.source.postMessage(state);
|
|
state = "we are expecting a messageerror due to the window sending us an RTCEncodedVideoFrame or RTCEncodedAudioFrame";
|
|
} else {
|
|
e.source.postMessage(`worker onmessage was reached when in state "${state}" and data ${e.data}`);
|
|
}
|
|
};
|
|
|
|
self.onmessageerror = e => {
|
|
if (state === "we are expecting a messageerror due to the window sending us an RTCEncodedVideoFrame or RTCEncodedAudioFrame") {
|
|
assert_equals(e.constructor.name, "ExtendableMessageEvent", "type");
|
|
assert_equals(e.data, null, "data");
|
|
assert_equals(e.origin, self.origin, "origin");
|
|
assert_not_equals(e.source, null, "source");
|
|
assert_equals(e.ports.length, 0, "ports length");
|
|
|
|
state = "onmessageerror was received in worker";
|
|
e.source.postMessage(state);
|
|
} else {
|
|
e.source.postMessage(`worker onmessageerror was reached when in state "${state}" and data ${e.data}`);
|
|
}
|
|
};
|