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 CONTENT_SHELL_RENDERER_TEST_RUNNER_MOCK_SCREEN_ORIENTATION_CLIENT_H_
6 #define CONTENT_SHELL_RENDERER_TEST_RUNNER_MOCK_SCREEN_ORIENTATION_CLIENT_H_
8 #include "base/macros.h"
9 #include "third_party/WebKit/public/platform/WebLockOrientationCallback.h"
10 #include "third_party/WebKit/public/platform/WebScreenOrientationClient.h"
11 #include "third_party/WebKit/public/platform/WebScreenOrientationLockType.h"
12 #include "third_party/WebKit/public/platform/WebScreenOrientationType.h"
20 class MockScreenOrientationClient
: public blink::WebScreenOrientationClient
{
22 explicit MockScreenOrientationClient();
23 virtual ~MockScreenOrientationClient();
26 void UpdateDeviceOrientation(blink::WebLocalFrame
* main_frame
,
27 blink::WebScreenOrientationType orientation
);
29 blink::WebScreenOrientationType
CurrentOrientationType() const;
30 unsigned CurrentOrientationAngle() const;
33 // From blink::WebScreenOrientationClient.
34 virtual void lockOrientation(blink::WebScreenOrientationLockType orientation
,
35 blink::WebLockOrientationCallback
* callback
);
36 virtual void unlockOrientation();
38 void UpdateLockSync(blink::WebScreenOrientationLockType
,
39 blink::WebLockOrientationCallback
*);
42 void UpdateScreenOrientation(blink::WebScreenOrientationType
);
43 bool IsOrientationAllowedByCurrentLock(blink::WebScreenOrientationType
);
44 blink::WebScreenOrientationType
SuitableOrientationForCurrentLock();
45 static unsigned OrientationTypeToAngle(blink::WebScreenOrientationType
);
47 blink::WebLocalFrame
* main_frame_
;
48 blink::WebScreenOrientationLockType current_lock_
;
49 blink::WebScreenOrientationType device_orientation_
;
50 blink::WebScreenOrientationType current_orientation_
;
52 DISALLOW_COPY_AND_ASSIGN(MockScreenOrientationClient
);
55 } // namespace content
57 #endif // CONTENT_SHELL_RENDERER_TEST_RUNNER_MOCK_SCREEN_ORIENTATION_CONTROLLER_H_