| OLD | NEW |
| 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/dom/DocumentUserGestureToken.h" |
| 8 #include "core/loader/EmptyClients.h" | 9 #include "core/loader/EmptyClients.h" |
| 9 #include "core/page/NetworkStateNotifier.h" | 10 #include "core/page/NetworkStateNotifier.h" |
| 10 #include "core/testing/DummyPageHolder.h" | 11 #include "core/testing/DummyPageHolder.h" |
| 11 #include "platform/UserGestureIndicator.h" | 12 #include "platform/UserGestureIndicator.h" |
| 12 #include "platform/testing/UnitTestHelpers.h" | 13 #include "platform/testing/UnitTestHelpers.h" |
| 13 #include "public/platform/WebMediaPlayer.h" | 14 #include "public/platform/WebMediaPlayer.h" |
| 14 #include "public/platform/WebSize.h" | 15 #include "public/platform/WebSize.h" |
| 15 #include "testing/gmock/include/gmock/gmock.h" | 16 #include "testing/gmock/include/gmock/gmock.h" |
| 16 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
| 17 #include "wtf/PtrUtil.h" | 18 #include "wtf/PtrUtil.h" |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 // On play, the strategy is set to normal. | 133 // On play, the strategy is set to normal. |
| 133 EXPECT_CALL(*player, | 134 EXPECT_CALL(*player, |
| 134 setBufferingStrategy(WebMediaPlayer::BufferingStrategy::Normal)); | 135 setBufferingStrategy(WebMediaPlayer::BufferingStrategy::Normal)); |
| 135 m_video->play(); | 136 m_video->play(); |
| 136 ::testing::Mock::VerifyAndClearExpectations(player); | 137 ::testing::Mock::VerifyAndClearExpectations(player); |
| 137 | 138 |
| 138 // On a user pause, the strategy is set to aggressive. | 139 // On a user pause, the strategy is set to aggressive. |
| 139 EXPECT_CALL(*player, setBufferingStrategy( | 140 EXPECT_CALL(*player, setBufferingStrategy( |
| 140 WebMediaPlayer::BufferingStrategy::Aggressive)); | 141 WebMediaPlayer::BufferingStrategy::Aggressive)); |
| 141 { | 142 { |
| 142 UserGestureIndicator gesture(UserGestureToken::create()); | 143 UserGestureIndicator gesture( |
| 144 DocumentUserGestureToken::create(&m_video->document())); |
| 143 m_video->pause(); | 145 m_video->pause(); |
| 144 } | 146 } |
| 145 ::testing::Mock::VerifyAndClearExpectations(player); | 147 ::testing::Mock::VerifyAndClearExpectations(player); |
| 146 | 148 |
| 147 // On play, the strategy is set to normal. | 149 // On play, the strategy is set to normal. |
| 148 EXPECT_CALL(*player, | 150 EXPECT_CALL(*player, |
| 149 setBufferingStrategy(WebMediaPlayer::BufferingStrategy::Normal)); | 151 setBufferingStrategy(WebMediaPlayer::BufferingStrategy::Normal)); |
| 150 m_video->play(); | 152 m_video->play(); |
| 151 ::testing::Mock::VerifyAndClearExpectations(player); | 153 ::testing::Mock::VerifyAndClearExpectations(player); |
| 152 } | 154 } |
| 153 | 155 |
| 154 } // namespace blink | 156 } // namespace blink |
| OLD | NEW |