| OLD | NEW |
| (Empty) |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef COMPONENTS_TEST_RUNNER_MOCK_SCREEN_ORIENTATION_CLIENT_H_ | |
| 6 #define COMPONENTS_TEST_RUNNER_MOCK_SCREEN_ORIENTATION_CLIENT_H_ | |
| 7 | |
| 8 #include <memory> | |
| 9 | |
| 10 #include "base/compiler_specific.h" | |
| 11 #include "base/macros.h" | |
| 12 #include "components/test_runner/test_runner_export.h" | |
| 13 #include "third_party/WebKit/public/platform/modules/screen_orientation/WebLockO
rientationCallback.h" | |
| 14 #include "third_party/WebKit/public/platform/modules/screen_orientation/WebScree
nOrientationClient.h" | |
| 15 #include "third_party/WebKit/public/platform/modules/screen_orientation/WebScree
nOrientationLockType.h" | |
| 16 #include "third_party/WebKit/public/platform/modules/screen_orientation/WebScree
nOrientationType.h" | |
| 17 | |
| 18 namespace blink { | |
| 19 class WebLocalFrame; | |
| 20 } | |
| 21 | |
| 22 namespace test_runner { | |
| 23 | |
| 24 class TEST_RUNNER_EXPORT MockScreenOrientationClient | |
| 25 : public NON_EXPORTED_BASE(blink::WebScreenOrientationClient) { | |
| 26 public: | |
| 27 explicit MockScreenOrientationClient(); | |
| 28 ~MockScreenOrientationClient() override; | |
| 29 | |
| 30 void ResetData(); | |
| 31 void UpdateDeviceOrientation(blink::WebLocalFrame* main_frame, | |
| 32 blink::WebScreenOrientationType orientation); | |
| 33 | |
| 34 blink::WebScreenOrientationType CurrentOrientationType() const; | |
| 35 unsigned CurrentOrientationAngle() const; | |
| 36 bool IsDisabled() const { return is_disabled_; } | |
| 37 void SetDisabled(bool disabled); | |
| 38 | |
| 39 private: | |
| 40 // From blink::WebScreenOrientationClient. | |
| 41 void lockOrientation( | |
| 42 blink::WebScreenOrientationLockType orientation, | |
| 43 std::unique_ptr<blink::WebLockOrientationCallback> callback) override; | |
| 44 void unlockOrientation() override; | |
| 45 | |
| 46 void UpdateLockSync(blink::WebScreenOrientationLockType, | |
| 47 std::unique_ptr<blink::WebLockOrientationCallback>); | |
| 48 void ResetLockSync(); | |
| 49 | |
| 50 void UpdateScreenOrientation(blink::WebScreenOrientationType); | |
| 51 bool IsOrientationAllowedByCurrentLock(blink::WebScreenOrientationType); | |
| 52 blink::WebScreenOrientationType SuitableOrientationForCurrentLock(); | |
| 53 static unsigned OrientationTypeToAngle(blink::WebScreenOrientationType); | |
| 54 | |
| 55 blink::WebLocalFrame* main_frame_; | |
| 56 blink::WebScreenOrientationLockType current_lock_; | |
| 57 blink::WebScreenOrientationType device_orientation_; | |
| 58 blink::WebScreenOrientationType current_orientation_; | |
| 59 bool is_disabled_; | |
| 60 | |
| 61 DISALLOW_COPY_AND_ASSIGN(MockScreenOrientationClient); | |
| 62 }; | |
| 63 | |
| 64 } // namespace test_runner | |
| 65 | |
| 66 #endif // COMPONENTS_TEST_RUNNER_MOCK_SCREEN_ORIENTATION_CLIENT_H_ | |
| OLD | NEW |