| 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/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" |
| 11 #include "platform/UserGestureIndicator.h" | 11 #include "platform/UserGestureIndicator.h" |
| 12 #include "platform/testing/UnitTestHelpers.h" | 12 #include "platform/testing/UnitTestHelpers.h" |
| 13 #include "public/platform/WebMediaPlayer.h" | 13 #include "public/platform/WebMediaPlayer.h" |
| 14 #include "public/platform/WebSize.h" | 14 #include "public/platform/WebSize.h" |
| 15 #include "testing/gmock/include/gmock/gmock.h" | 15 #include "testing/gmock/include/gmock/gmock.h" |
| 16 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
| 17 | 17 |
| 18 namespace blink { | 18 namespace blink { |
| 19 | 19 |
| 20 namespace { | 20 namespace { |
| 21 | 21 |
| 22 class EmptyWebMediaPlayer : public WebMediaPlayer { | 22 class EmptyWebMediaPlayer : public WebMediaPlayer { |
| 23 public: | 23 public: |
| 24 void load(LoadType, const WebURL&, CORSMode) override { }; | 24 void load(LoadType, const WebMediaElementSource&, CORSMode) override { }; |
| 25 void play() override { }; | 25 void play() override { }; |
| 26 void pause() override { }; | 26 void pause() override { }; |
| 27 bool supportsSave() const override { return false; }; | 27 bool supportsSave() const override { return false; }; |
| 28 void seek(double seconds) override { }; | 28 void seek(double seconds) override { }; |
| 29 void setRate(double) override { }; | 29 void setRate(double) override { }; |
| 30 void setVolume(double) override { }; | 30 void setVolume(double) override { }; |
| 31 WebTimeRanges buffered() const override { return WebTimeRanges(); }; | 31 WebTimeRanges buffered() const override { return WebTimeRanges(); }; |
| 32 WebTimeRanges seekable() const override { return WebTimeRanges(); }; | 32 WebTimeRanges seekable() const override { return WebTimeRanges(); }; |
| 33 void setSinkId(const WebString& sinkId, const WebSecurityOrigin&, WebSetSink
IdCallbacks*) override { }; | 33 void setSinkId(const WebString& sinkId, const WebSecurityOrigin&, WebSetSink
IdCallbacks*) override { }; |
| 34 bool hasVideo() const override { return false; }; | 34 bool hasVideo() const override { return false; }; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 56 MOCK_METHOD1(setBufferingStrategy, void(BufferingStrategy)); | 56 MOCK_METHOD1(setBufferingStrategy, void(BufferingStrategy)); |
| 57 }; | 57 }; |
| 58 | 58 |
| 59 class StubFrameLoaderClient : public EmptyFrameLoaderClient { | 59 class StubFrameLoaderClient : public EmptyFrameLoaderClient { |
| 60 public: | 60 public: |
| 61 static PassOwnPtrWillBeRawPtr<StubFrameLoaderClient> create() | 61 static PassOwnPtrWillBeRawPtr<StubFrameLoaderClient> create() |
| 62 { | 62 { |
| 63 return adoptPtrWillBeNoop(new StubFrameLoaderClient); | 63 return adoptPtrWillBeNoop(new StubFrameLoaderClient); |
| 64 } | 64 } |
| 65 | 65 |
| 66 PassOwnPtr<WebMediaPlayer> createWebMediaPlayer(HTMLMediaElement&, WebMediaP
layer::LoadType, const WebURL&, WebMediaPlayerClient*) override | 66 PassOwnPtr<WebMediaPlayer> createWebMediaPlayer(HTMLMediaElement&, WebMediaP
layer::LoadType, const WebMediaElementSource&, WebMediaPlayerClient*) override |
| 67 { | 67 { |
| 68 return adoptPtr(new MockWebMediaPlayer); | 68 return adoptPtr(new MockWebMediaPlayer); |
| 69 } | 69 } |
| 70 }; | 70 }; |
| 71 | 71 |
| 72 } // namespace | 72 } // namespace |
| 73 | 73 |
| 74 class HTMLVideoElementTest : public ::testing::Test { | 74 class HTMLVideoElementTest : public ::testing::Test { |
| 75 protected: | 75 protected: |
| 76 HTMLVideoElementTest() | 76 HTMLVideoElementTest() |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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->play(); |
| 142 ::testing::Mock::VerifyAndClearExpectations(player); | 142 ::testing::Mock::VerifyAndClearExpectations(player); |
| 143 } | 143 } |
| 144 | 144 |
| 145 } // namespace blink | 145 } // namespace blink |
| OLD | NEW |