OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #ifndef CONTENT_PUBLIC_TEST_LAYOUTTEST_SUPPORT_H_ | 5 #ifndef CONTENT_PUBLIC_TEST_LAYOUTTEST_SUPPORT_H_ |
6 #define CONTENT_PUBLIC_TEST_LAYOUTTEST_SUPPORT_H_ | 6 #define CONTENT_PUBLIC_TEST_LAYOUTTEST_SUPPORT_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/callback_forward.h" | 11 #include "base/callback_forward.h" |
12 #include "cc/layers/texture_layer.h" | 12 #include "cc/layers/texture_layer.h" |
13 #include "third_party/WebKit/public/platform/WebScreenOrientationType.h" | 13 #include "third_party/WebKit/public/platform/WebScreenOrientationType.h" |
14 | 14 |
15 namespace blink { | 15 namespace blink { |
16 class WebBatteryStatus; | 16 class WebBatteryStatus; |
17 class WebDeviceMotionData; | 17 class WebDeviceMotionData; |
18 class WebDeviceOrientationData; | 18 class WebDeviceOrientationData; |
19 class WebGamepad; | 19 class WebGamepad; |
20 class WebGamepads; | 20 class WebGamepads; |
21 class WebLayer; | 21 class WebLayer; |
22 struct WebSize; | 22 struct WebSize; |
23 } | 23 } |
24 | 24 |
25 namespace content { | 25 namespace content { |
26 | 26 |
27 class PageState; | 27 class PageState; |
28 class RenderFrame; | 28 class RenderFrame; |
| 29 class RendererGamepadProvider; |
29 class RenderView; | 30 class RenderView; |
30 class WebTestProxyBase; | 31 class WebTestProxyBase; |
31 | 32 |
32 // Turn the browser process into layout test mode. | 33 // Turn the browser process into layout test mode. |
33 void EnableBrowserLayoutTestMode(); | 34 void EnableBrowserLayoutTestMode(); |
34 | 35 |
35 /////////////////////////////////////////////////////////////////////////////// | 36 /////////////////////////////////////////////////////////////////////////////// |
36 // The following methods are meant to be used from a renderer. | 37 // The following methods are meant to be used from a renderer. |
37 | 38 |
38 // Turn a renderer into layout test mode. | 39 // Turn a renderer into layout test mode. |
39 void EnableRendererLayoutTestMode(); | 40 void EnableRendererLayoutTestMode(); |
40 | 41 |
41 // Enable injecting of a WebTestProxy between WebViews and RenderViews. | 42 // Enable injecting of a WebTestProxy between WebViews and RenderViews. |
42 // |callback| is invoked with a pointer to WebTestProxyBase for each created | 43 // |callback| is invoked with a pointer to WebTestProxyBase for each created |
43 // WebTestProxy. | 44 // WebTestProxy. |
44 void EnableWebTestProxyCreation( | 45 void EnableWebTestProxyCreation( |
45 const base::Callback<void(RenderView*, WebTestProxyBase*)>& callback); | 46 const base::Callback<void(RenderView*, WebTestProxyBase*)>& callback); |
46 | 47 |
47 // Sets the WebGamepads that should be returned by | 48 // Sets gamepad provider to be used for layout tests. |
48 // WebKitPlatformSupport::sampleGamepads(). | 49 void SetMockGamepadProvider(RendererGamepadProvider* provider); |
49 void SetMockGamepads(const blink::WebGamepads& pads); | |
50 | |
51 // Notifies blink about a new gamepad. | |
52 void MockGamepadConnected(int index, const blink::WebGamepad& pad); | |
53 | |
54 // Notifies blink that a gamepad has been disconnected. | |
55 void MockGamepadDisconnected(int index, const blink::WebGamepad& pad); | |
56 | 50 |
57 // Sets WebDeviceMotionData that should be used when registering | 51 // Sets WebDeviceMotionData that should be used when registering |
58 // a listener through WebKitPlatformSupport::setDeviceMotionListener(). | 52 // a listener through WebKitPlatformSupport::setDeviceMotionListener(). |
59 void SetMockDeviceMotionData(const blink::WebDeviceMotionData& data); | 53 void SetMockDeviceMotionData(const blink::WebDeviceMotionData& data); |
60 | 54 |
61 // Sets WebDeviceOrientationData that should be used when registering | 55 // Sets WebDeviceOrientationData that should be used when registering |
62 // a listener through WebKitPlatformSupport::setDeviceOrientationListener(). | 56 // a listener through WebKitPlatformSupport::setDeviceOrientationListener(). |
63 void SetMockDeviceOrientationData(const blink::WebDeviceOrientationData& data); | 57 void SetMockDeviceOrientationData(const blink::WebDeviceOrientationData& data); |
64 | 58 |
65 // Sets WebScreenOrientationType that should be used as a mock orientation. | 59 // Sets WebScreenOrientationType that should be used as a mock orientation. |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 // Provides a text dump of the contents of the given page state. | 105 // Provides a text dump of the contents of the given page state. |
112 std::string DumpBackForwardList(std::vector<PageState>& page_state, | 106 std::string DumpBackForwardList(std::vector<PageState>& page_state, |
113 size_t current_index); | 107 size_t current_index); |
114 | 108 |
115 // Instantiates WebLayerImpl for TestPlugin. | 109 // Instantiates WebLayerImpl for TestPlugin. |
116 blink::WebLayer* InstantiateWebLayer(scoped_refptr<cc::TextureLayer> layer); | 110 blink::WebLayer* InstantiateWebLayer(scoped_refptr<cc::TextureLayer> layer); |
117 | 111 |
118 } // namespace content | 112 } // namespace content |
119 | 113 |
120 #endif // CONTENT_PUBLIC_TEST_LAYOUTTEST_SUPPORT_H_ | 114 #endif // CONTENT_PUBLIC_TEST_LAYOUTTEST_SUPPORT_H_ |
OLD | NEW |