Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(478)

Unified Diff: third_party/WebKit/Source/core/html/HTMLVideoElementTest.cpp

Issue 1856373004: Fix potential null pointer access in HTMLMediaElement::seek (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/html/HTMLVideoElementTest.cpp
diff --git a/third_party/WebKit/Source/core/html/HTMLVideoElementTest.cpp b/third_party/WebKit/Source/core/html/HTMLVideoElementTest.cpp
index 61e2b501371780c3dc4932c32ea3943aa943fcc2..506d03e06a2cf33877644ccb903a8c4b53eec3a1 100644
--- a/third_party/WebKit/Source/core/html/HTMLVideoElementTest.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLVideoElementTest.cpp
@@ -88,6 +88,22 @@ protected:
testing::runPendingTasks();
}
+ void breakReadyState()
+ {
+ // Manually setup a situation when ready state goes out of sync with
+ // m_webMediaPlayer. The real call sequence that results in error is unkown.
philipj_slow 2016/04/06 15:08:01 This isn't very reassuring. Can you look at all th
pavor 2016/05/12 12:03:36 I tried to figure it out, but without any success.
+ m_video->setPreload("none");
+ setSrc("http://foo.bar/");
+ m_video->setReadyState(HTMLMediaElement::HAVE_FUTURE_DATA);
+ m_video->remoteRouteAvailabilityChanged(true);
+ }
+
+ void callPrivateWebMediaPlayerAccessors()
+ {
+ m_video->updatePlayState();
+ m_video->audioTracksTimerFired(nullptr);
+ }
+
MockWebMediaPlayer* webMediaPlayer()
{
return static_cast<MockWebMediaPlayer*>(m_video->webMediaPlayer());
@@ -143,4 +159,22 @@ TEST_F(HTMLVideoElementTest, setBufferingStrategy_UserPause)
::testing::Mock::VerifyAndClearExpectations(player);
}
+TEST_F(HTMLVideoElementTest, webMediaPlayerOutOfSyncWithReadyState)
+{
+ breakReadyState();
+
+ MockWebMediaPlayer* player = webMediaPlayer();
+ ASSERT_FALSE(player);
+
+ // Call public methods that access m_webMediaPlayer
+ // If a check of m_webMediaPlayer for nullptr is missing,
+ // the test crashes.
+ m_video->setCurrentTime(0.0);
+ m_video->requestRemotePlayback();
+ m_video->requestRemotePlaybackControl();
+ m_video->selectedVideoTrackChanged(nullptr);
+
+ callPrivateWebMediaPlayerAccessors();
+}
+
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698