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

Side by Side Diff: third_party/WebKit/Source/core/html/HTMLMediaElementTest.cpp

Issue 1856373004: Fix potential null pointer access in HTMLMediaElement::seek (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: correct review comments Created 4 years, 7 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 unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLMediaElement.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "core/html/HTMLMediaElement.h"
6
7 #include "core/dom/Document.h"
8 #include "core/html/HTMLVideoElement.h"
9 #include "core/loader/EmptyClients.h"
10 #include "core/testing/DummyPageHolder.h"
11 #include "platform/testing/UnitTestHelpers.h"
12 #include "public/platform/WebMediaPlayer.h"
13 #include "public/platform/WebSize.h"
14 #include "testing/gtest/include/gtest/gtest.h"
15
16 namespace blink {
17
18 class HTMLMediaElementTest : public ::testing::Test {
19 protected:
20 HTMLMediaElementTest()
21 : m_dummyPageHolder(DummyPageHolder::create(IntSize(640, 360), nullptr, EmptyFrameLoaderClient::create()))
22 {
23 m_video = HTMLVideoElement::create(m_dummyPageHolder->document());
24 }
25
26 void breakReadyState()
27 {
28 // Manually setup a situation when ready state goes out of sync with
29 // m_webMediaPlayer. The real call sequence that results in error is unk own.
30 m_video->setPreload("none");
31 m_video->setSrc("http://foo.bar/");
32 testing::runPendingTasks();
33 m_video->setReadyState(HTMLMediaElement::HAVE_FUTURE_DATA);
34 m_video->remoteRouteAvailabilityChanged(true);
mlamouri (slow - plz ping) 2016/05/19 13:13:03 Do you really need this line?
35 }
36
37 OwnPtr<DummyPageHolder> m_dummyPageHolder;
38 Persistent<HTMLVideoElement> m_video;
39 };
40
41 TEST_F(HTMLMediaElementTest, webMediaPlayerOutOfSyncWithReadyState)
42 {
43 breakReadyState();
44
45 WebMediaPlayer* player = m_video->webMediaPlayer();
46 ASSERT_FALSE(player);
47
48 // Call setCurrentTime that accesses m_webMediaPlayer
49 // If a check of m_webMediaPlayer for nullptr is missing,
50 // the test crashes.
51 m_video->setCurrentTime(0.0);
52 }
53
54 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLMediaElement.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698