| 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 "modules/media_controls/MediaControlsImpl.h" | 5 #include "modules/media_controls/MediaControlsImpl.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/ClientRect.h" | 11 #include "core/dom/ClientRect.h" |
| 12 #include "core/dom/Document.h" | 12 #include "core/dom/Document.h" |
| 13 #include "core/dom/ElementTraversal.h" | 13 #include "core/dom/ElementTraversal.h" |
| 14 #include "core/dom/StyleEngine.h" | 14 #include "core/dom/StyleEngine.h" |
| 15 #include "core/events/Event.h" | 15 #include "core/events/Event.h" |
| 16 #include "core/frame/Settings.h" | 16 #include "core/frame/Settings.h" |
| 17 #include "core/html/HTMLElement.h" | 17 #include "core/html/HTMLElement.h" |
| 18 #include "core/html/HTMLVideoElement.h" | 18 #include "core/html/HTMLVideoElement.h" |
| 19 #include "core/html/shadow/MediaControlElementTypes.h" | 19 #include "core/html/shadow/MediaControlElementTypes.h" |
| 20 #include "core/input/EventHandler.h" | 20 #include "core/input/EventHandler.h" |
| 21 #include "core/layout/LayoutObject.h" | 21 #include "core/layout/LayoutObject.h" |
| 22 #include "core/loader/EmptyClients.h" | 22 #include "core/loader/EmptyClients.h" |
| 23 #include "core/testing/DummyPageHolder.h" | 23 #include "core/testing/DummyPageHolder.h" |
| 24 #include "modules/media_controls/elements/MediaControlCurrentTimeDisplayElement.
h" | 24 #include "modules/media_controls/elements/MediaControlCurrentTimeDisplayElement.
h" |
| 25 #include "modules/media_controls/elements/MediaControlDownloadButtonElement.h" | 25 #include "modules/media_controls/elements/MediaControlDownloadButtonElement.h" |
| 26 #include "modules/media_controls/elements/MediaControlTimelineElement.h" | 26 #include "modules/media_controls/elements/MediaControlTimelineElement.h" |
| 27 #include "modules/remoteplayback/HTMLMediaElementRemotePlayback.h" |
| 28 #include "modules/remoteplayback/RemotePlayback.h" |
| 27 #include "platform/heap/Handle.h" | 29 #include "platform/heap/Handle.h" |
| 28 #include "platform/testing/EmptyWebMediaPlayer.h" | 30 #include "platform/testing/EmptyWebMediaPlayer.h" |
| 29 #include "platform/testing/HistogramTester.h" | 31 #include "platform/testing/HistogramTester.h" |
| 30 #include "platform/testing/TestingPlatformSupport.h" | 32 #include "platform/testing/TestingPlatformSupport.h" |
| 31 #include "platform/testing/UnitTestHelpers.h" | 33 #include "platform/testing/UnitTestHelpers.h" |
| 32 #include "public/platform/WebMouseEvent.h" | 34 #include "public/platform/WebMouseEvent.h" |
| 33 #include "public/platform/WebScreenInfo.h" | 35 #include "public/platform/WebScreenInfo.h" |
| 34 #include "public/platform/WebSize.h" | 36 #include "public/platform/WebSize.h" |
| 35 #include "public/platform/modules/remoteplayback/WebRemotePlaybackAvailability.h
" | 37 #include "public/platform/modules/remoteplayback/WebRemotePlaybackAvailability.h
" |
| 36 #include "public/platform/modules/remoteplayback/WebRemotePlaybackClient.h" | 38 #include "public/platform/modules/remoteplayback/WebRemotePlaybackClient.h" |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 static StubLocalFrameClient* Create() { return new StubLocalFrameClient; } | 94 static StubLocalFrameClient* Create() { return new StubLocalFrameClient; } |
| 93 | 95 |
| 94 std::unique_ptr<WebMediaPlayer> CreateWebMediaPlayer( | 96 std::unique_ptr<WebMediaPlayer> CreateWebMediaPlayer( |
| 95 HTMLMediaElement&, | 97 HTMLMediaElement&, |
| 96 const WebMediaPlayerSource&, | 98 const WebMediaPlayerSource&, |
| 97 WebMediaPlayerClient*) override { | 99 WebMediaPlayerClient*) override { |
| 98 return WTF::WrapUnique(new MockVideoWebMediaPlayer); | 100 return WTF::WrapUnique(new MockVideoWebMediaPlayer); |
| 99 } | 101 } |
| 100 | 102 |
| 101 WebRemotePlaybackClient* CreateWebRemotePlaybackClient( | 103 WebRemotePlaybackClient* CreateWebRemotePlaybackClient( |
| 102 HTMLMediaElement&) override { | 104 HTMLMediaElement& element) override { |
| 103 if (!remote_playback_client_) { | 105 return HTMLMediaElementRemotePlayback::remote(element); |
| 104 remote_playback_client_ = | |
| 105 WTF::WrapUnique(new MockWebRemotePlaybackClient); | |
| 106 } | |
| 107 return remote_playback_client_.get(); | |
| 108 } | 106 } |
| 109 | |
| 110 private: | |
| 111 std::unique_ptr<MockWebRemotePlaybackClient> remote_playback_client_; | |
| 112 }; | 107 }; |
| 113 | 108 |
| 114 Element* GetElementByShadowPseudoId(Node& root_node, | 109 Element* GetElementByShadowPseudoId(Node& root_node, |
| 115 const char* shadow_pseudo_id) { | 110 const char* shadow_pseudo_id) { |
| 116 for (Element& element : ElementTraversal::DescendantsOf(root_node)) { | 111 for (Element& element : ElementTraversal::DescendantsOf(root_node)) { |
| 117 if (element.ShadowPseudoId() == shadow_pseudo_id) | 112 if (element.ShadowPseudoId() == shadow_pseudo_id) |
| 118 return &element; | 113 return &element; |
| 119 } | 114 } |
| 120 return nullptr; | 115 return nullptr; |
| 121 } | 116 } |
| (...skipping 718 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 840 MediaControls().PanelElement()->DispatchEvent(Event::Create("keypress")); | 835 MediaControls().PanelElement()->DispatchEvent(Event::Create("keypress")); |
| 841 platform->RunForPeriodSeconds(2); | 836 platform->RunForPeriodSeconds(2); |
| 842 EXPECT_TRUE(IsElementVisible(*panel)); | 837 EXPECT_TRUE(IsElementVisible(*panel)); |
| 843 | 838 |
| 844 // Once user interaction stops, controls can hide. | 839 // Once user interaction stops, controls can hide. |
| 845 platform->RunForPeriodSeconds(2); | 840 platform->RunForPeriodSeconds(2); |
| 846 EXPECT_FALSE(IsElementVisible(*panel)); | 841 EXPECT_FALSE(IsElementVisible(*panel)); |
| 847 } | 842 } |
| 848 | 843 |
| 849 } // namespace blink | 844 } // namespace blink |
| OLD | NEW |