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.
5 #ifndef COMPONENTS_TEST_RUNNER_MOCK_SCREEN_ORIENTATION_CLIENT_H_
6 #define COMPONENTS_TEST_RUNNER_MOCK_SCREEN_ORIENTATION_CLIENT_H_
8 #include "base/compiler_specific.h"
9 #include "base/macros.h"
10 #include "components/test_runner/test_runner_export.h"
11 #include "third_party/WebKit/public/platform/modules/screen_orientation/WebLockOrientationCallback.h"
12 #include "third_party/WebKit/public/platform/modules/screen_orientation/WebScreenOrientationClient.h"
13 #include "third_party/WebKit/public/platform/modules/screen_orientation/WebScreenOrientationLockType.h"
14 #include "third_party/WebKit/public/platform/modules/screen_orientation/WebScreenOrientationType.h"
20 namespace test_runner
{
22 class TEST_RUNNER_EXPORT MockScreenOrientationClient
23 : public NON_EXPORTED_BASE(blink::WebScreenOrientationClient
) {
25 explicit MockScreenOrientationClient();
26 virtual ~MockScreenOrientationClient();
29 void UpdateDeviceOrientation(blink::WebLocalFrame
* main_frame
,
30 blink::WebScreenOrientationType orientation
);
32 blink::WebScreenOrientationType
CurrentOrientationType() const;
33 unsigned CurrentOrientationAngle() const;
36 // From blink::WebScreenOrientationClient.
37 virtual void lockOrientation(blink::WebScreenOrientationLockType orientation
,
38 blink::WebLockOrientationCallback
* callback
);
39 virtual void unlockOrientation();
41 void UpdateLockSync(blink::WebScreenOrientationLockType
,
42 blink::WebLockOrientationCallback
*);
45 void UpdateScreenOrientation(blink::WebScreenOrientationType
);
46 bool IsOrientationAllowedByCurrentLock(blink::WebScreenOrientationType
);
47 blink::WebScreenOrientationType
SuitableOrientationForCurrentLock();
48 static unsigned OrientationTypeToAngle(blink::WebScreenOrientationType
);
50 blink::WebLocalFrame
* main_frame_
;
51 blink::WebScreenOrientationLockType current_lock_
;
52 blink::WebScreenOrientationType device_orientation_
;
53 blink::WebScreenOrientationType current_orientation_
;
55 DISALLOW_COPY_AND_ASSIGN(MockScreenOrientationClient
);
58 } // namespace test_runner
60 #endif // COMPONENTS_TEST_RUNNER_MOCK_SCREEN_ORIENTATION_CLIENT_H_