Commit 2dbe5247 authored by Thomas Guilbert's avatar Thomas Guilbert Committed by Chromium LUCI CQ

Test cancellation of pending rVFC

When VideoFrameCallbackRequesterImpl schedules its callbacks to be run
in the next rendering steps, and the HTMLMediaElement changes its
WebMediaPlayer, we have to make sure to cancel the scheduled callback
execution.

This CL adds a test to make sure we do, as a follow up to the CL in the
linked bug.

Bug: 1158160
Change-Id: I723361671d923a44d84457812fad8da2cefffac0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2595984
Commit-Queue: Thomas Guilbert <tguilbert@chromium.org>
Commit-Queue: Dale Curtis <dalecurtis@chromium.org>
Auto-Submit: Thomas Guilbert <tguilbert@chromium.org>
Reviewed-by: default avatarDale Curtis <dalecurtis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#838266}
parent 4dd159e0
......@@ -321,6 +321,28 @@ TEST_F(VideoFrameCallbackRequesterImplTest,
testing::Mock::VerifyAndClear(function);
}
TEST_F(VideoFrameCallbackRequesterImplTest,
VerifyClearedMediaPlayerCancelsPendingExecution) {
V8TestingScope scope;
auto* function = MockFunction::Create(scope.GetScriptState());
// Queue a request.
vfc_requester().requestVideoFrameCallback(GetCallback(function));
SimulateFramePresented();
// The callback should be scheduled for execution, but not yet run.
EXPECT_CALL(*function, Call(_)).Times(0);
// Simulate the HTMLVideoElement getting changing its WebMediaPlayer.
vfc_requester().OnWebMediaPlayerCleared();
// This should be a no-op, else we could get metadata for a null frame.
SimulateVideoFrameCallback(base::TimeTicks::Now());
testing::Mock::VerifyAndClear(function);
}
TEST_F(VideoFrameCallbackRequesterImplTest, VerifyParameters_WindowRaf) {
auto timing = GetDocument().Loader()->GetTiming();
MetadataHelper::ReinitializeFields(timing.ReferenceMonotonicTime());
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment