| 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/shadow/MediaControls.h" | 5 #include "core/html/shadow/MediaControls.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include "core/HTMLNames.h" | 9 #include "core/HTMLNames.h" |
| 10 #include "core/css/StylePropertySet.h" | 10 #include "core/css/StylePropertySet.h" |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 void promptCancelled() override {} | 75 void promptCancelled() override {} |
| 76 bool remotePlaybackAvailable() const override { | 76 bool remotePlaybackAvailable() const override { |
| 77 return m_availability == WebRemotePlaybackAvailability::DeviceAvailable; | 77 return m_availability == WebRemotePlaybackAvailability::DeviceAvailable; |
| 78 } | 78 } |
| 79 | 79 |
| 80 private: | 80 private: |
| 81 WebRemotePlaybackAvailability m_availability = | 81 WebRemotePlaybackAvailability m_availability = |
| 82 WebRemotePlaybackAvailability::Unknown; | 82 WebRemotePlaybackAvailability::Unknown; |
| 83 }; | 83 }; |
| 84 | 84 |
| 85 class StubFrameLoaderClient : public EmptyLocalFrameClient { | 85 class StubLocalFrameClient : public EmptyLocalFrameClient { |
| 86 public: | 86 public: |
| 87 static StubFrameLoaderClient* create() { return new StubFrameLoaderClient; } | 87 static StubLocalFrameClient* create() { return new StubLocalFrameClient; } |
| 88 | 88 |
| 89 std::unique_ptr<WebMediaPlayer> createWebMediaPlayer( | 89 std::unique_ptr<WebMediaPlayer> createWebMediaPlayer( |
| 90 HTMLMediaElement&, | 90 HTMLMediaElement&, |
| 91 const WebMediaPlayerSource&, | 91 const WebMediaPlayerSource&, |
| 92 WebMediaPlayerClient*) override { | 92 WebMediaPlayerClient*) override { |
| 93 return WTF::wrapUnique(new MockVideoWebMediaPlayer); | 93 return WTF::wrapUnique(new MockVideoWebMediaPlayer); |
| 94 } | 94 } |
| 95 | 95 |
| 96 WebRemotePlaybackClient* createWebRemotePlaybackClient( | 96 WebRemotePlaybackClient* createWebRemotePlaybackClient( |
| 97 HTMLMediaElement&) override { | 97 HTMLMediaElement&) override { |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 | 136 |
| 137 return true; | 137 return true; |
| 138 } | 138 } |
| 139 | 139 |
| 140 } // namespace | 140 } // namespace |
| 141 | 141 |
| 142 class MediaControlsTest : public ::testing::Test { | 142 class MediaControlsTest : public ::testing::Test { |
| 143 protected: | 143 protected: |
| 144 virtual void SetUp() { | 144 virtual void SetUp() { |
| 145 m_pageHolder = DummyPageHolder::create(IntSize(800, 600), nullptr, | 145 m_pageHolder = DummyPageHolder::create(IntSize(800, 600), nullptr, |
| 146 StubFrameLoaderClient::create()); | 146 StubLocalFrameClient::create()); |
| 147 Document& document = this->document(); | 147 Document& document = this->document(); |
| 148 | 148 |
| 149 document.write("<video>"); | 149 document.write("<video>"); |
| 150 HTMLVideoElement& video = | 150 HTMLVideoElement& video = |
| 151 toHTMLVideoElement(*document.querySelector("video")); | 151 toHTMLVideoElement(*document.querySelector("video")); |
| 152 m_mediaControls = video.mediaControls(); | 152 m_mediaControls = video.mediaControls(); |
| 153 | 153 |
| 154 // If scripts are not enabled, controls will always be shown. | 154 // If scripts are not enabled, controls will always be shown. |
| 155 m_pageHolder->frame().settings()->setScriptEnabled(true); | 155 m_pageHolder->frame().settings()->setScriptEnabled(true); |
| 156 } | 156 } |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 389 ASSERT_NE(nullptr, downloadButton); | 389 ASSERT_NE(nullptr, downloadButton); |
| 390 | 390 |
| 391 // Download button should not be displayed for HLS streams. | 391 // Download button should not be displayed for HLS streams. |
| 392 mediaControls().mediaElement().setSrc("https://example.com/foo.m3u8"); | 392 mediaControls().mediaElement().setSrc("https://example.com/foo.m3u8"); |
| 393 testing::runPendingTasks(); | 393 testing::runPendingTasks(); |
| 394 simulateLoadedMetadata(); | 394 simulateLoadedMetadata(); |
| 395 EXPECT_FALSE(isElementVisible(*downloadButton)); | 395 EXPECT_FALSE(isElementVisible(*downloadButton)); |
| 396 } | 396 } |
| 397 | 397 |
| 398 } // namespace blink | 398 } // namespace blink |
| OLD | NEW |