| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/MediaControlsOrientationLockDelegate.h" | 5 #include "core/html/shadow/MediaControlsOrientationLockDelegate.h" |
| 6 | 6 |
| 7 #include "core/dom/Document.h" | 7 #include "core/dom/Document.h" |
| 8 #include "core/dom/DocumentUserGestureToken.h" | 8 #include "core/dom/DocumentUserGestureToken.h" |
| 9 #include "core/dom/Fullscreen.h" | 9 #include "core/dom/Fullscreen.h" |
| 10 #include "core/frame/ScreenOrientationController.h" | 10 #include "core/frame/ScreenOrientationController.h" |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 void paint(WebCanvas*, const WebRect&, SkPaint&) override{}; | 72 void paint(WebCanvas*, const WebRect&, SkPaint&) override{}; |
| 73 | 73 |
| 74 MOCK_CONST_METHOD0(naturalSize, WebSize()); | 74 MOCK_CONST_METHOD0(naturalSize, WebSize()); |
| 75 }; | 75 }; |
| 76 | 76 |
| 77 class MockChromeClient : public EmptyChromeClient { | 77 class MockChromeClient : public EmptyChromeClient { |
| 78 public: | 78 public: |
| 79 MOCK_CONST_METHOD0(screenInfo, WebScreenInfo()); | 79 MOCK_CONST_METHOD0(screenInfo, WebScreenInfo()); |
| 80 }; | 80 }; |
| 81 | 81 |
| 82 class StubFrameLoaderClient : public EmptyLocalFrameClient { | 82 class StubLocalFrameClient : public EmptyLocalFrameClient { |
| 83 public: | 83 public: |
| 84 static StubFrameLoaderClient* create() { return new StubFrameLoaderClient; } | 84 static StubLocalFrameClient* create() { return new StubLocalFrameClient; } |
| 85 | 85 |
| 86 std::unique_ptr<WebMediaPlayer> createWebMediaPlayer( | 86 std::unique_ptr<WebMediaPlayer> createWebMediaPlayer( |
| 87 HTMLMediaElement&, | 87 HTMLMediaElement&, |
| 88 const WebMediaPlayerSource&, | 88 const WebMediaPlayerSource&, |
| 89 WebMediaPlayerClient*) override { | 89 WebMediaPlayerClient*) override { |
| 90 return WTF::wrapUnique(new MockVideoWebMediaPlayer()); | 90 return WTF::wrapUnique(new MockVideoWebMediaPlayer()); |
| 91 } | 91 } |
| 92 }; | 92 }; |
| 93 | 93 |
| 94 class MockScreenOrientationController final | 94 class MockScreenOrientationController final |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 RuntimeEnabledFeatures::videoFullscreenOrientationLockEnabled(); | 137 RuntimeEnabledFeatures::videoFullscreenOrientationLockEnabled(); |
| 138 RuntimeEnabledFeatures::setVideoFullscreenOrientationLockEnabled(true); | 138 RuntimeEnabledFeatures::setVideoFullscreenOrientationLockEnabled(true); |
| 139 | 139 |
| 140 m_chromeClient = new MockChromeClient(); | 140 m_chromeClient = new MockChromeClient(); |
| 141 | 141 |
| 142 Page::PageClients clients; | 142 Page::PageClients clients; |
| 143 fillWithEmptyClients(clients); | 143 fillWithEmptyClients(clients); |
| 144 clients.chromeClient = m_chromeClient.get(); | 144 clients.chromeClient = m_chromeClient.get(); |
| 145 | 145 |
| 146 m_pageHolder = DummyPageHolder::create(IntSize(800, 600), &clients, | 146 m_pageHolder = DummyPageHolder::create(IntSize(800, 600), &clients, |
| 147 StubFrameLoaderClient::create()); | 147 StubLocalFrameClient::create()); |
| 148 | 148 |
| 149 document().write("<body><video></body>"); | 149 document().write("<body><video></body>"); |
| 150 m_video = toHTMLVideoElement(*document().querySelector("video")); | 150 m_video = toHTMLVideoElement(*document().querySelector("video")); |
| 151 | 151 |
| 152 m_screenOrientationController = | 152 m_screenOrientationController = |
| 153 MockScreenOrientationController::provideTo(m_pageHolder->frame()); | 153 MockScreenOrientationController::provideTo(m_pageHolder->frame()); |
| 154 } | 154 } |
| 155 | 155 |
| 156 void TearDown() override { | 156 void TearDown() override { |
| 157 ::testing::Mock::VerifyAndClear(&screenOrientationController()); | 157 ::testing::Mock::VerifyAndClear(&screenOrientationController()); |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 419 EXPECT_EQ(WebScreenOrientationLockLandscape, computeOrientationLock()); | 419 EXPECT_EQ(WebScreenOrientationLockLandscape, computeOrientationLock()); |
| 420 | 420 |
| 421 screenInfo.orientationType = WebScreenOrientationLandscapeSecondary; | 421 screenInfo.orientationType = WebScreenOrientationLandscapeSecondary; |
| 422 EXPECT_CALL(chromeClient(), screenInfo()) | 422 EXPECT_CALL(chromeClient(), screenInfo()) |
| 423 .Times(1) | 423 .Times(1) |
| 424 .WillOnce(Return(screenInfo)); | 424 .WillOnce(Return(screenInfo)); |
| 425 EXPECT_EQ(WebScreenOrientationLockLandscape, computeOrientationLock()); | 425 EXPECT_EQ(WebScreenOrientationLockLandscape, computeOrientationLock()); |
| 426 } | 426 } |
| 427 | 427 |
| 428 } // namespace blink | 428 } // namespace blink |
| OLD | NEW |