| 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" |
| 11 #include "core/dom/Document.h" | 11 #include "core/dom/Document.h" |
| 12 #include "core/dom/ElementTraversal.h" | 12 #include "core/dom/ElementTraversal.h" |
| 13 #include "core/dom/StyleEngine.h" | 13 #include "core/dom/StyleEngine.h" |
| 14 #include "core/frame/Settings.h" | 14 #include "core/frame/Settings.h" |
| 15 #include "core/html/HTMLVideoElement.h" | 15 #include "core/html/HTMLVideoElement.h" |
| 16 #include "core/html/shadow/MediaControlElementTypes.h" | 16 #include "core/html/shadow/MediaControlElementTypes.h" |
| 17 #include "core/loader/EmptyClients.h" | 17 #include "core/loader/EmptyClients.h" |
| 18 #include "core/testing/DummyPageHolder.h" | 18 #include "core/testing/DummyPageHolder.h" |
| 19 #include "platform/heap/Handle.h" | 19 #include "platform/heap/Handle.h" |
| 20 #include "platform/testing/EmptyWebMediaPlayer.h" |
| 20 #include "platform/testing/HistogramTester.h" | 21 #include "platform/testing/HistogramTester.h" |
| 21 #include "platform/testing/UnitTestHelpers.h" | 22 #include "platform/testing/UnitTestHelpers.h" |
| 22 #include "public/platform/WebMediaPlayer.h" | |
| 23 #include "public/platform/WebSize.h" | 23 #include "public/platform/WebSize.h" |
| 24 #include "public/platform/modules/remoteplayback/WebRemotePlaybackAvailability.h
" | 24 #include "public/platform/modules/remoteplayback/WebRemotePlaybackAvailability.h
" |
| 25 #include "public/platform/modules/remoteplayback/WebRemotePlaybackClient.h" | 25 #include "public/platform/modules/remoteplayback/WebRemotePlaybackClient.h" |
| 26 #include "testing/gtest/include/gtest/gtest.h" | 26 #include "testing/gtest/include/gtest/gtest.h" |
| 27 | 27 |
| 28 namespace blink { | 28 namespace blink { |
| 29 | 29 |
| 30 namespace { | 30 namespace { |
| 31 | 31 |
| 32 class MockVideoWebMediaPlayer : public WebMediaPlayer { | 32 class MockVideoWebMediaPlayer : public EmptyWebMediaPlayer { |
| 33 public: | 33 public: |
| 34 // WebMediaPlayer overrides: | 34 // WebMediaPlayer overrides: |
| 35 void load(LoadType, const WebMediaPlayerSource&, CORSMode) override{}; | 35 WebTimeRanges seekable() const override { return m_seekable; } |
| 36 void play() override{}; | 36 bool hasVideo() const override { return true; } |
| 37 void pause() override{}; | |
| 38 bool supportsSave() const override { return false; }; | |
| 39 void seek(double seconds) override{}; | |
| 40 void setRate(double) override{}; | |
| 41 void setVolume(double) override{}; | |
| 42 WebTimeRanges buffered() const override { return WebTimeRanges(); }; | |
| 43 WebTimeRanges seekable() const override { return m_seekable; }; | |
| 44 void setSinkId(const WebString& sinkId, | |
| 45 const WebSecurityOrigin&, | |
| 46 WebSetSinkIdCallbacks*) override{}; | |
| 47 bool hasVideo() const override { return true; }; | |
| 48 bool hasAudio() const override { return false; }; | |
| 49 WebSize naturalSize() const override { return WebSize(0, 0); }; | |
| 50 bool paused() const override { return false; }; | |
| 51 bool seeking() const override { return false; }; | |
| 52 double duration() const override { return 0.0; }; | |
| 53 double currentTime() const override { return 0.0; }; | |
| 54 NetworkState getNetworkState() const override { return NetworkStateEmpty; }; | |
| 55 ReadyState getReadyState() const override { return ReadyStateHaveNothing; }; | |
| 56 WebString getErrorMessage() override { return WebString(); }; | |
| 57 bool didLoadingProgress() override { return false; }; | |
| 58 bool hasSingleSecurityOrigin() const override { return true; }; | |
| 59 bool didPassCORSAccessCheck() const override { return true; }; | |
| 60 double mediaTimeForTimeValue(double timeValue) const override { | |
| 61 return timeValue; | |
| 62 }; | |
| 63 unsigned decodedFrameCount() const override { return 0; }; | |
| 64 unsigned droppedFrameCount() const override { return 0; }; | |
| 65 size_t audioDecodedByteCount() const override { return 0; }; | |
| 66 size_t videoDecodedByteCount() const override { return 0; }; | |
| 67 void paint(WebCanvas*, const WebRect&, PaintFlags&) override{}; | |
| 68 | 37 |
| 69 WebTimeRanges m_seekable; | 38 WebTimeRanges m_seekable; |
| 70 }; | 39 }; |
| 71 | 40 |
| 72 class MockWebRemotePlaybackClient : public WebRemotePlaybackClient { | 41 class MockWebRemotePlaybackClient : public WebRemotePlaybackClient { |
| 73 public: | 42 public: |
| 74 void stateChanged(WebRemotePlaybackState) override {} | 43 void stateChanged(WebRemotePlaybackState) override {} |
| 75 void availabilityChanged( | 44 void availabilityChanged( |
| 76 WebRemotePlaybackAvailability availability) override { | 45 WebRemotePlaybackAvailability availability) override { |
| 77 m_availability = availability; | 46 m_availability = availability; |
| (...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 526 loadMediaWithDuration(duration); | 495 loadMediaWithDuration(duration); |
| 527 | 496 |
| 528 // Simulate seeking the underlying range to 50%. Current time display should | 497 // Simulate seeking the underlying range to 50%. Current time display should |
| 529 // update synchronously (rather than waiting for media to finish seeking). | 498 // update synchronously (rather than waiting for media to finish seeking). |
| 530 timeline->setValueAsNumber(duration / 2, ASSERT_NO_EXCEPTION); | 499 timeline->setValueAsNumber(duration / 2, ASSERT_NO_EXCEPTION); |
| 531 timeline->dispatchInputEvent(); | 500 timeline->dispatchInputEvent(); |
| 532 EXPECT_EQ(duration / 2, currentTimeDisplay->currentValue()); | 501 EXPECT_EQ(duration / 2, currentTimeDisplay->currentValue()); |
| 533 } | 502 } |
| 534 | 503 |
| 535 } // namespace blink | 504 } // namespace blink |
| OLD | NEW |