layouttest_support.h revision 9ab5563a3196760eb381d102cbb2bc0f7abc6a50
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. 4 5#ifndef CONTENT_PUBLIC_TEST_LAYOUTTEST_SUPPORT_H_ 6#define CONTENT_PUBLIC_TEST_LAYOUTTEST_SUPPORT_H_ 7 8#include "base/callback_forward.h" 9 10namespace WebKit { 11class WebDeviceMotionData; 12class WebGamepads; 13struct WebSize; 14} 15 16namespace WebTestRunner { 17class WebTestProxyBase; 18} 19 20namespace content { 21 22class RenderView; 23 24// Turn the browser process into layout test mode. 25void EnableBrowserLayoutTestMode(); 26 27/////////////////////////////////////////////////////////////////////////////// 28// The following methods are meant to be used from a renderer. 29 30// Turn a renderer into layout test mode. 31void EnableRendererLayoutTestMode(); 32 33// Enable injecting of a WebTestProxy between WebViews and RenderViews. 34// |callback| is invoked with a pointer to WebTestProxyBase for each created 35// WebTestProxy. 36void EnableWebTestProxyCreation(const base::Callback< 37 void(RenderView*, WebTestRunner::WebTestProxyBase*)>& callback); 38 39// Sets the WebGamepads that should be returned by 40// WebKitPlatformSupport::sampleGamepads(). 41void SetMockGamepads(const WebKit::WebGamepads& pads); 42 43// Sets WebDeviceMotionData that should be used when registering 44// a listener through WebKitPlatformSupport::setDeviceMotionListener(). 45void SetMockDeviceMotionData(const WebKit::WebDeviceMotionData& data); 46 47// Returns the length of the local session history of a render view. 48int GetLocalSessionHistoryLength(RenderView* render_view); 49 50// Sync the current session history to the browser process. 51void SyncNavigationState(RenderView* render_view); 52 53// Sets the focus of the render view depending on |enable|. This only overrides 54// the state of the renderer, and does not sync the focus to the browser 55// process. 56void SetFocusAndActivate(RenderView* render_view, bool enable); 57 58// Changes the window rect of the given render view. 59void ForceResizeRenderView(RenderView* render_view, 60 const WebKit::WebSize& new_size); 61 62// Set the device scale factor and force the compositor to resize. 63void SetDeviceScaleFactor(RenderView* render_view, float factor); 64 65// Control auto resize mode. 66void EnableAutoResizeMode(RenderView* render_view, 67 const WebKit::WebSize& min_size, 68 const WebKit::WebSize& max_size); 69void DisableAutoResizeMode(RenderView* render_view, 70 const WebKit::WebSize& new_size); 71 72// Forces the |render_view| to use mock media streams. 73void UseMockMediaStreams(RenderView* render_view); 74 75} // namespace content 76 77#endif // CONTENT_PUBLIC_TEST_LAYOUTTEST_SUPPORT_H_ 78