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

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

Issue 1576283003: Have HTMLMediaElement::play() return a Promise. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/html/HTMLVideoElement.h" 5 #include "core/html/HTMLVideoElement.h"
6 6
7 #include "core/dom/Document.h" 7 #include "core/dom/Document.h"
8 #include "core/loader/EmptyClients.h" 8 #include "core/loader/EmptyClients.h"
9 #include "core/page/NetworkStateNotifier.h" 9 #include "core/page/NetworkStateNotifier.h"
10 #include "core/testing/DummyPageHolder.h" 10 #include "core/testing/DummyPageHolder.h"
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 }; 97 };
98 98
99 TEST_F(HTMLVideoElementTest, setBufferingStrategy_NonUserPause) 99 TEST_F(HTMLVideoElementTest, setBufferingStrategy_NonUserPause)
100 { 100 {
101 setSrc("http://foo.bar/"); 101 setSrc("http://foo.bar/");
102 MockWebMediaPlayer* player = webMediaPlayer(); 102 MockWebMediaPlayer* player = webMediaPlayer();
103 ASSERT_TRUE(player); 103 ASSERT_TRUE(player);
104 104
105 // On play, the strategy is set to normal. 105 // On play, the strategy is set to normal.
106 EXPECT_CALL(*player, setBufferingStrategy(WebMediaPlayer::BufferingStrategy: :Normal)); 106 EXPECT_CALL(*player, setBufferingStrategy(WebMediaPlayer::BufferingStrategy: :Normal));
107 m_video->play(); 107 m_video->playInternal();
108 ::testing::Mock::VerifyAndClearExpectations(player); 108 ::testing::Mock::VerifyAndClearExpectations(player);
109 109
110 // On a non-user pause, the strategy is not changed. 110 // On a non-user pause, the strategy is not changed.
111 m_video->pause(); 111 m_video->pause();
112 ::testing::Mock::VerifyAndClearExpectations(player); 112 ::testing::Mock::VerifyAndClearExpectations(player);
113 113
114 // On play, the strategy is set to normal. 114 // On play, the strategy is set to normal.
115 EXPECT_CALL(*player, setBufferingStrategy(WebMediaPlayer::BufferingStrategy: :Normal)); 115 EXPECT_CALL(*player, setBufferingStrategy(WebMediaPlayer::BufferingStrategy: :Normal));
116 m_video->play(); 116 m_video->playInternal();
117 ::testing::Mock::VerifyAndClearExpectations(player); 117 ::testing::Mock::VerifyAndClearExpectations(player);
118 } 118 }
119 119
120 TEST_F(HTMLVideoElementTest, setBufferingStrategy_UserPause) 120 TEST_F(HTMLVideoElementTest, setBufferingStrategy_UserPause)
121 { 121 {
122 setSrc("http://foo.bar/"); 122 setSrc("http://foo.bar/");
123 MockWebMediaPlayer* player = webMediaPlayer(); 123 MockWebMediaPlayer* player = webMediaPlayer();
124 ASSERT_TRUE(player); 124 ASSERT_TRUE(player);
125 125
126 // On play, the strategy is set to normal. 126 // On play, the strategy is set to normal.
127 EXPECT_CALL(*player, setBufferingStrategy(WebMediaPlayer::BufferingStrategy: :Normal)); 127 EXPECT_CALL(*player, setBufferingStrategy(WebMediaPlayer::BufferingStrategy: :Normal));
128 m_video->play(); 128 m_video->playInternal();
129 ::testing::Mock::VerifyAndClearExpectations(player); 129 ::testing::Mock::VerifyAndClearExpectations(player);
130 130
131 // On a user pause, the strategy is set to aggressive. 131 // On a user pause, the strategy is set to aggressive.
132 EXPECT_CALL(*player, setBufferingStrategy(WebMediaPlayer::BufferingStrategy: :Aggressive)); 132 EXPECT_CALL(*player, setBufferingStrategy(WebMediaPlayer::BufferingStrategy: :Aggressive));
133 { 133 {
134 UserGestureIndicator gesture(DefinitelyProcessingUserGesture); 134 UserGestureIndicator gesture(DefinitelyProcessingUserGesture);
135 m_video->pause(); 135 m_video->pause();
136 } 136 }
137 ::testing::Mock::VerifyAndClearExpectations(player); 137 ::testing::Mock::VerifyAndClearExpectations(player);
138 138
139 // On play, the strategy is set to normal. 139 // On play, the strategy is set to normal.
140 EXPECT_CALL(*player, setBufferingStrategy(WebMediaPlayer::BufferingStrategy: :Normal)); 140 EXPECT_CALL(*player, setBufferingStrategy(WebMediaPlayer::BufferingStrategy: :Normal));
141 m_video->play(); 141 m_video->playInternal();
142 ::testing::Mock::VerifyAndClearExpectations(player); 142 ::testing::Mock::VerifyAndClearExpectations(player);
143 } 143 }
144 144
145 } // namespace blink 145 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698