Skip to content

Commit

Permalink
[WebRTC] webrtc/video-remote-mute.html can be potentially flaky
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=259654

Reviewed by Eric Carlson.

* LayoutTests/webrtc/video-remote-mute.html: Re-use the isVideoBlack() from routines.js because it
is more reliable and thus we no longer need to hard-code waitFor() calls in this test.

Canonical link: https://commits.webkit.org/266681@main
  • Loading branch information
philn committed Aug 8, 2023
1 parent e9d28ce commit 0902da8
Showing 1 changed file with 3 additions and 21 deletions.
24 changes: 3 additions & 21 deletions LayoutTests/webrtc/video-remote-mute.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,6 @@
video = document.getElementById("video");
canvas = document.getElementById("canvas");

function isVideoBlack()
{
canvas.width = video.videoWidth;
canvas.height = video.videoHeight;
canvas.getContext('2d').drawImage(video, 0, 0, canvas.width, canvas.height);

imageData = canvas.getContext('2d').getImageData(10, 325, 250, 1);
data = imageData.data;
for (var cptr = 0; cptr < canvas.width * canvas.height; ++cptr) {
if (data[4 * cptr] || data[4 * cptr + 1] || data[4 * cptr + 2])
return false;
}
return true;
}

var track;
promise_test((test) => {
if (window.testRunner)
Expand All @@ -48,16 +33,13 @@
track = remoteStream.getVideoTracks()[0];
return video.play();
}).then(() => {
assert_false(isVideoBlack());
return checkVideoBlack(false, canvas, video, "enabled track is black");
}).then(() => {
track.enabled = false;
return waitFor(500);
return checkVideoBlack(true, canvas, video, "disabled track is not black");
}).then(() => {
assert_true(isVideoBlack());
track.enabled = true;
return waitFor(500);
}).then(() => {
assert_false(isVideoBlack());
return checkVideoBlack(false, canvas, video, "enabled track is black");
});
}, "Incoming muted/unmuted video track");
</script>
Expand Down

0 comments on commit 0902da8

Please sign in to comment.