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
3 // found in the LICENSE file.
5 #ifndef CONTENT_PUBLIC_TEST_LAYOUTTEST_SUPPORT_H_
6 #define CONTENT_PUBLIC_TEST_LAYOUTTEST_SUPPORT_H_
8 #include "base/callback_forward.h"
11 class WebDeviceMotionData
;
12 class WebDeviceOrientationData
;
17 namespace WebTestRunner
{
18 class WebTestProxyBase
;
25 // Turn the browser process into layout test mode.
26 void EnableBrowserLayoutTestMode();
28 ///////////////////////////////////////////////////////////////////////////////
29 // The following methods are meant to be used from a renderer.
31 // Turn a renderer into layout test mode.
32 void EnableRendererLayoutTestMode();
34 // Enable injecting of a WebTestProxy between WebViews and RenderViews.
35 // |callback| is invoked with a pointer to WebTestProxyBase for each created
37 void EnableWebTestProxyCreation(const base::Callback
<
38 void(RenderView
*, WebTestRunner::WebTestProxyBase
*)>& callback
);
40 // Sets the WebGamepads that should be returned by
41 // WebKitPlatformSupport::sampleGamepads().
42 void SetMockGamepads(const blink::WebGamepads
& pads
);
44 // Sets WebDeviceMotionData that should be used when registering
45 // a listener through WebKitPlatformSupport::setDeviceMotionListener().
46 void SetMockDeviceMotionData(const blink::WebDeviceMotionData
& data
);
48 // Sets WebDeviceOrientationData that should be used when registering
49 // a listener through WebKitPlatformSupport::setDeviceOrientationListener().
50 void SetMockDeviceOrientationData(const blink::WebDeviceOrientationData
& data
);
52 // Returns the length of the local session history of a render view.
53 int GetLocalSessionHistoryLength(RenderView
* render_view
);
55 // Sync the current session history to the browser process.
56 void SyncNavigationState(RenderView
* render_view
);
58 // Sets the focus of the render view depending on |enable|. This only overrides
59 // the state of the renderer, and does not sync the focus to the browser
61 void SetFocusAndActivate(RenderView
* render_view
, bool enable
);
63 // Changes the window rect of the given render view.
64 void ForceResizeRenderView(RenderView
* render_view
,
65 const blink::WebSize
& new_size
);
67 // Set the device scale factor and force the compositor to resize.
68 void SetDeviceScaleFactor(RenderView
* render_view
, float factor
);
70 // Enables or disables synchronous resize mode. When enabled, all window-sizing
71 // machinery is short-circuited inside the renderer. This mode is necessary for
72 // some tests that were written before browsers had multi-process architecture
73 // and rely on window resizes to happen synchronously.
74 // See http://crbug.com/309760 for details.
75 void UseSynchronousResizeMode(RenderView
* render_view
, bool enable
);
77 // Control auto resize mode.
78 void EnableAutoResizeMode(RenderView
* render_view
,
79 const blink::WebSize
& min_size
,
80 const blink::WebSize
& max_size
);
81 void DisableAutoResizeMode(RenderView
* render_view
,
82 const blink::WebSize
& new_size
);
84 // Forces the |render_view| to use mock media streams.
85 void UseMockMediaStreams(RenderView
* render_view
);
87 } // namespace content
89 #endif // CONTENT_PUBLIC_TEST_LAYOUTTEST_SUPPORT_H_