| 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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 |
| 95 : public GarbageCollectedFinalized<MockScreenOrientationController>, | 95 : public ScreenOrientationController { |
| 96 public ScreenOrientationController { | |
| 97 USING_GARBAGE_COLLECTED_MIXIN(MockScreenOrientationController); | |
| 98 WTF_MAKE_NONCOPYABLE(MockScreenOrientationController); | 96 WTF_MAKE_NONCOPYABLE(MockScreenOrientationController); |
| 99 | 97 |
| 100 public: | 98 public: |
| 101 static MockScreenOrientationController* provideTo(LocalFrame& frame) { | 99 static MockScreenOrientationController* provideTo(LocalFrame& frame) { |
| 102 MockScreenOrientationController* controller = | 100 MockScreenOrientationController* controller = |
| 103 new MockScreenOrientationController(); | 101 new MockScreenOrientationController(frame); |
| 104 ScreenOrientationController::provideTo(frame, controller); | 102 ScreenOrientationController::provideTo(frame, controller); |
| 105 return controller; | 103 return controller; |
| 106 } | 104 } |
| 107 | 105 |
| 108 MOCK_METHOD1(lock, void(WebScreenOrientationLockType)); | 106 MOCK_METHOD1(lock, void(WebScreenOrientationLockType)); |
| 109 MOCK_METHOD0(mockUnlock, void()); | 107 MOCK_METHOD0(mockUnlock, void()); |
| 110 | 108 |
| 111 DEFINE_INLINE_VIRTUAL_TRACE() { Supplement<LocalFrame>::trace(visitor); } | 109 DEFINE_INLINE_VIRTUAL_TRACE() { ScreenOrientationController::trace(visitor); } |
| 112 | 110 |
| 113 private: | 111 private: |
| 114 MockScreenOrientationController() = default; | 112 explicit MockScreenOrientationController(LocalFrame& frame) |
| 113 : ScreenOrientationController(frame) {} |
| 115 | 114 |
| 116 void lock(WebScreenOrientationLockType type, | 115 void lock(WebScreenOrientationLockType type, |
| 117 std::unique_ptr<WebLockOrientationCallback>) override { | 116 std::unique_ptr<WebLockOrientationCallback>) override { |
| 118 m_locked = true; | 117 m_locked = true; |
| 119 lock(type); | 118 lock(type); |
| 120 } | 119 } |
| 121 | 120 |
| 122 void unlock() override { | 121 void unlock() override { |
| 123 m_locked = false; | 122 m_locked = false; |
| 124 mockUnlock(); | 123 mockUnlock(); |
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 420 EXPECT_EQ(WebScreenOrientationLockLandscape, computeOrientationLock()); | 419 EXPECT_EQ(WebScreenOrientationLockLandscape, computeOrientationLock()); |
| 421 | 420 |
| 422 screenInfo.orientationType = WebScreenOrientationLandscapeSecondary; | 421 screenInfo.orientationType = WebScreenOrientationLandscapeSecondary; |
| 423 EXPECT_CALL(chromeClient(), screenInfo()) | 422 EXPECT_CALL(chromeClient(), screenInfo()) |
| 424 .Times(1) | 423 .Times(1) |
| 425 .WillOnce(Return(screenInfo)); | 424 .WillOnce(Return(screenInfo)); |
| 426 EXPECT_EQ(WebScreenOrientationLockLandscape, computeOrientationLock()); | 425 EXPECT_EQ(WebScreenOrientationLockLandscape, computeOrientationLock()); |
| 427 } | 426 } |
| 428 | 427 |
| 429 } // namespace blink | 428 } // namespace blink |
| OLD | NEW |