Commit a98c719c authored by Dale Curtis's avatar Dale Curtis Committed by Commit Bot

Fix flakiness in new WMPI::Load() tests.

Expecting readyStateChanged() to quit the message loop and do
nothing else appears to be unreliable due to us having configured
our ScopedTaskEnvironment for asynchronous execution. Switching to
a manually queued version would be painfully verbose given all the
happenings of the underlying demuxers and decoders; so instead
wait for loading to complete instead of quitting mid-way through
the loading process.

BUG=831566
TEST=tests don't flake under tsan.

Change-Id: If59ab647bb349bf996050545bb63b0e65cc471e2
Reviewed-on: https://chromium-review.googlesource.com/1011642
Commit-Queue: Dale Curtis <dalecurtis@chromium.org>
Commit-Queue: Chrome Cunningham <chcunningham@chromium.org>
Reviewed-by: default avatarChrome Cunningham <chcunningham@chromium.org>
Cr-Commit-Position: refs/heads/master@{#550506}
parent e129764f
......@@ -656,18 +656,21 @@ class WebMediaPlayerImplTest : public testing::Test {
data->data_size());
client->DidFinishLoading(0);
// This runs until we reach the have metadata state.
base::RunLoop loop;
EXPECT_CALL(client_, ReadyStateChanged())
.WillOnce(RunClosure(loop.QuitClosure()));
loop.Run();
// Verify we made it to pipeline startup.
EXPECT_EQ(blink::WebMediaPlayer::kReadyStateHaveMetadata,
wmpi_->GetReadyState());
// This runs until we reach the have current data state. Attempting to wait
// for states < kReadyStateHaveCurrentData is unreliable due to asynchronous
// execution of tasks on the base::test:ScopedTaskEnvironment.
while (wmpi_->GetReadyState() <
blink::WebMediaPlayer::kReadyStateHaveCurrentData) {
base::RunLoop loop;
EXPECT_CALL(client_, ReadyStateChanged())
.WillOnce(RunClosure(loop.QuitClosure()));
loop.Run();
}
// Verify we made it through pipeline startup.
EXPECT_TRUE(wmpi_->data_source_);
EXPECT_TRUE(wmpi_->demuxer_);
EXPECT_TRUE(wmpi_->seeking_);
EXPECT_FALSE(wmpi_->seeking_);
}
BlinkPlatformWithTaskEnvironment platform_;
......@@ -740,14 +743,7 @@ TEST_F(WebMediaPlayerImplTest, LoadAndDestroy) {
}
// Verify that preload=metadata suspend works properly.
// Flaky on Linux MSan and TSan. http://crbug.com/831566.
#if defined(OS_LINUX) && \
(defined(MEMORY_SANITIZER) || defined(THREAD_SANITIZER))
#define MAYBE_LoadPreloadMetadataSuspend DISABLED_LoadPreloadMetadataSuspend
#else
#define MAYBE_LoadPreloadMetadataSuspend LoadPreloadMetadataSuspend
#endif
TEST_F(WebMediaPlayerImplTest, MAYBE_LoadPreloadMetadataSuspend) {
TEST_F(WebMediaPlayerImplTest, LoadPreloadMetadataSuspend) {
base::test::ScopedFeatureList scoped_feature_list;
scoped_feature_list.InitAndEnableFeature(media::kPreloadMetadataSuspend);
InitializeWebMediaPlayerImpl();
......
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