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