Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(220)

Side by Side Diff: content/test/layouttest_support.cc

Issue 16026006: Introduce the notion of a "layout test mode" instead of turning individual flags on and off (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/shell/renderer/shell_render_process_observer.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "content/public/test/layouttest_support.h" 5 #include "content/public/test/layouttest_support.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/lazy_instance.h" 8 #include "base/lazy_instance.h"
9 #include "content/common/gpu/image_transport_surface.h" 9 #include "content/common/gpu/image_transport_surface.h"
10 #include "content/renderer/devtools/devtools_client.h"
11 #include "content/renderer/render_thread_impl.h" 10 #include "content/renderer/render_thread_impl.h"
12 #include "content/renderer/render_view_impl.h" 11 #include "content/renderer/render_view_impl.h"
13 #include "content/renderer/renderer_webapplicationcachehost_impl.h"
14 #include "content/renderer/renderer_webkitplatformsupport_impl.h" 12 #include "content/renderer/renderer_webkitplatformsupport_impl.h"
15 #include "third_party/WebKit/Source/Platform/chromium/public/WebGamepads.h" 13 #include "third_party/WebKit/Source/Platform/chromium/public/WebGamepads.h"
16 #include "third_party/WebKit/Tools/DumpRenderTree/chromium/TestRunner/public/Web TestProxy.h" 14 #include "third_party/WebKit/Tools/DumpRenderTree/chromium/TestRunner/public/Web TestProxy.h"
17 15
18 #if defined(OS_WIN) && !defined(USE_AURA) 16 #if defined(OS_WIN) && !defined(USE_AURA)
19 #include "content/browser/web_contents/web_contents_drag_win.h" 17 #include "content/browser/web_contents/web_contents_drag_win.h"
20 #endif 18 #endif
21 19
22 #if defined(OS_MACOSX) 20 #if defined(OS_MACOSX)
23 #include "content/browser/renderer_host/popup_menu_helper_mac.h" 21 #include "content/browser/renderer_host/popup_menu_helper_mac.h"
(...skipping 29 matching lines...) Expand all
53 void EnableWebTestProxyCreation( 51 void EnableWebTestProxyCreation(
54 const base::Callback<void(RenderView*, WebTestProxyBase*)>& callback) { 52 const base::Callback<void(RenderView*, WebTestProxyBase*)>& callback) {
55 g_callback.Get() = callback; 53 g_callback.Get() = callback;
56 RenderViewImpl::InstallCreateHook(CreateWebTestProxy); 54 RenderViewImpl::InstallCreateHook(CreateWebTestProxy);
57 } 55 }
58 56
59 void SetMockGamepads(const WebGamepads& pads) { 57 void SetMockGamepads(const WebGamepads& pads) {
60 RendererWebKitPlatformSupportImpl::SetMockGamepadsForTesting(pads); 58 RendererWebKitPlatformSupportImpl::SetMockGamepadsForTesting(pads);
61 } 59 }
62 60
63 void DisableAppCacheLogging() { 61 void EnableRendererLayoutTestMode() {
64 RendererWebApplicationCacheHostImpl::DisableLoggingForTesting(); 62 RenderThreadImpl::current()->set_layout_test_mode(true);
65 } 63 }
66 64
67 void EnableDevToolsFrontendTesting() { 65 void EnableBrowserLayoutTestMode() {
68 DevToolsClient::EnableDevToolsFrontendTesting(); 66 #if defined(OS_MACOSX)
67 ImageTransportSurface::SetAllowOSMesaForTesting(true);
68 PopupMenuHelper::DontShowPopupMenuForTesting();
69 #elif defined(OS_WIN) && !defined(USE_AURA)
70 WebContentsDragWin::DisableDragDropForTesting();
71 #endif
69 } 72 }
70 73
71 int GetLocalSessionHistoryLength(RenderView* render_view) { 74 int GetLocalSessionHistoryLength(RenderView* render_view) {
72 return static_cast<RenderViewImpl*>(render_view) 75 return static_cast<RenderViewImpl*>(render_view)
73 ->GetLocalSessionHistoryLengthForTesting(); 76 ->GetLocalSessionHistoryLengthForTesting();
74 } 77 }
75 78
76 void SetAllowOSMesaImageTransportForTesting() {
77 #if defined(OS_MACOSX)
78 ImageTransportSurface::SetAllowOSMesaForTesting(true);
79 #endif
80 }
81
82 void DoNotSendFocusEvents() {
83 RenderThreadImpl::current()->set_should_send_focus_ipcs(false);
84 }
85
86 void SyncNavigationState(RenderView* render_view) { 79 void SyncNavigationState(RenderView* render_view) {
87 static_cast<RenderViewImpl*>(render_view)->SyncNavigationState(); 80 static_cast<RenderViewImpl*>(render_view)->SyncNavigationState();
88 } 81 }
89 82
90 void SetFocusAndActivate(RenderView* render_view, bool enable) { 83 void SetFocusAndActivate(RenderView* render_view, bool enable) {
91 static_cast<RenderViewImpl*>(render_view) 84 static_cast<RenderViewImpl*>(render_view)
92 ->SetFocusAndActivateForTesting(enable); 85 ->SetFocusAndActivateForTesting(enable);
93 } 86 }
94 87
95 void EnableShortCircuitSizeUpdates() {
96 RenderThreadImpl::current()->set_short_circuit_size_updates(true);
97 }
98
99 void ForceResizeRenderView(RenderView* render_view, 88 void ForceResizeRenderView(RenderView* render_view,
100 const WebSize& new_size) { 89 const WebSize& new_size) {
101 RenderViewImpl* render_view_impl = static_cast<RenderViewImpl*>(render_view); 90 RenderViewImpl* render_view_impl = static_cast<RenderViewImpl*>(render_view);
102 render_view_impl->setWindowRect(WebRect(render_view_impl->rootWindowRect().x, 91 render_view_impl->setWindowRect(WebRect(render_view_impl->rootWindowRect().x,
103 render_view_impl->rootWindowRect().y, 92 render_view_impl->rootWindowRect().y,
104 new_size.width, 93 new_size.width,
105 new_size.height)); 94 new_size.height));
106 } 95 }
107 96
108 void DisableNavigationErrorPages() {
109 RenderThreadImpl::current()->set_skip_error_pages(true);
110 }
111
112 void SetDeviceScaleFactor(RenderView* render_view, float factor) { 97 void SetDeviceScaleFactor(RenderView* render_view, float factor) {
113 static_cast<RenderViewImpl*>(render_view) 98 static_cast<RenderViewImpl*>(render_view)
114 ->SetDeviceScaleFactorForTesting(factor); 99 ->SetDeviceScaleFactorForTesting(factor);
115 } 100 }
116 101
117 void DisableSystemDragDrop() {
118 #if defined(OS_WIN) && !defined(USE_AURA)
119 WebContentsDragWin::DisableDragDropForTesting();
120 #endif
121 }
122
123 void DisableModalPopupMenus() {
124 #if defined(OS_MACOSX)
125 PopupMenuHelper::DontShowPopupMenuForTesting();
126 #endif
127 }
128
129 void EnableAutoResizeMode(RenderView* render_view, 102 void EnableAutoResizeMode(RenderView* render_view,
130 const WebSize& min_size, 103 const WebSize& min_size,
131 const WebSize& max_size) { 104 const WebSize& max_size) {
132 static_cast<RenderViewImpl*>(render_view) 105 static_cast<RenderViewImpl*>(render_view)
133 ->EnableAutoResizeForTesting(min_size, max_size); 106 ->EnableAutoResizeForTesting(min_size, max_size);
134 } 107 }
135 108
136 void DisableAutoResizeMode(RenderView* render_view, const WebSize& new_size) { 109 void DisableAutoResizeMode(RenderView* render_view, const WebSize& new_size) {
137 static_cast<RenderViewImpl*>(render_view) 110 static_cast<RenderViewImpl*>(render_view)
138 ->DisableAutoResizeForTesting(new_size); 111 ->DisableAutoResizeForTesting(new_size);
139 } 112 }
140 113
141 } // namespace content 114 } // namespace content
OLDNEW
« no previous file with comments | « content/shell/renderer/shell_render_process_observer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698