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 #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" | 10 #include "content/renderer/devtools/devtools_client.h" |
11 #include "content/renderer/render_thread_impl.h" | 11 #include "content/renderer/render_thread_impl.h" |
12 #include "content/renderer/render_view_impl.h" | 12 #include "content/renderer/render_view_impl.h" |
13 #include "content/renderer/renderer_webapplicationcachehost_impl.h" | 13 #include "content/renderer/renderer_webapplicationcachehost_impl.h" |
14 #include "content/renderer/renderer_webkitplatformsupport_impl.h" | 14 #include "content/renderer/renderer_webkitplatformsupport_impl.h" |
15 #include "third_party/WebKit/Source/Platform/chromium/public/WebGamepads.h" | 15 #include "third_party/WebKit/Source/Platform/chromium/public/WebGamepads.h" |
16 #include "third_party/WebKit/Tools/DumpRenderTree/chromium/TestRunner/public/Web
TestProxy.h" | 16 #include "third_party/WebKit/Tools/DumpRenderTree/chromium/TestRunner/public/Web
TestProxy.h" |
17 | 17 |
18 #if defined(OS_WIN) && !defined(USE_AURA) | 18 #if defined(OS_WIN) && !defined(USE_AURA) |
19 #include "content/browser/web_contents/web_contents_drag_win.h" | 19 #include "content/browser/web_contents/web_contents_drag_win.h" |
20 #endif | 20 #endif |
21 | 21 |
22 #if defined(OS_MACOSX) | 22 #if defined(OS_MACOSX) |
23 #include "content/browser/renderer_host/popup_menu_helper_mac.h" | 23 #include "content/browser/renderer_host/popup_menu_helper_mac.h" |
24 #endif | 24 #endif |
25 | 25 |
26 using WebKit::WebGamepads; | 26 using WebKit::WebGamepads; |
| 27 using WebKit::WebRect; |
| 28 using WebKit::WebSize; |
27 using WebTestRunner::WebTestProxy; | 29 using WebTestRunner::WebTestProxy; |
28 using WebTestRunner::WebTestProxyBase; | 30 using WebTestRunner::WebTestProxyBase; |
29 | 31 |
30 namespace content { | 32 namespace content { |
31 | 33 |
32 namespace { | 34 namespace { |
33 | 35 |
34 base::LazyInstance<base::Callback<void(RenderView*, WebTestProxyBase*)> >::Leaky | 36 base::LazyInstance<base::Callback<void(RenderView*, WebTestProxyBase*)> >::Leaky |
35 g_callback = LAZY_INSTANCE_INITIALIZER; | 37 g_callback = LAZY_INSTANCE_INITIALIZER; |
36 | 38 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 void SetFocusAndActivate(RenderView* render_view, bool enable) { | 90 void SetFocusAndActivate(RenderView* render_view, bool enable) { |
89 static_cast<RenderViewImpl*>(render_view) | 91 static_cast<RenderViewImpl*>(render_view) |
90 ->SetFocusAndActivateForTesting(enable); | 92 ->SetFocusAndActivateForTesting(enable); |
91 } | 93 } |
92 | 94 |
93 void EnableShortCircuitSizeUpdates() { | 95 void EnableShortCircuitSizeUpdates() { |
94 RenderThreadImpl::current()->set_short_circuit_size_updates(true); | 96 RenderThreadImpl::current()->set_short_circuit_size_updates(true); |
95 } | 97 } |
96 | 98 |
97 void ForceResizeRenderView(RenderView* render_view, | 99 void ForceResizeRenderView(RenderView* render_view, |
98 const WebKit::WebSize& new_size) { | 100 const WebSize& new_size) { |
99 static_cast<RenderViewImpl*>(render_view)->didAutoResize(new_size); | 101 RenderViewImpl* render_view_impl = static_cast<RenderViewImpl*>(render_view); |
| 102 render_view_impl->setWindowRect(WebRect(render_view_impl->rootWindowRect().x, |
| 103 render_view_impl->rootWindowRect().y, |
| 104 new_size.width, |
| 105 new_size.height)); |
100 } | 106 } |
101 | 107 |
102 void DisableNavigationErrorPages() { | 108 void DisableNavigationErrorPages() { |
103 RenderThreadImpl::current()->set_skip_error_pages(true); | 109 RenderThreadImpl::current()->set_skip_error_pages(true); |
104 } | 110 } |
105 | 111 |
106 void SetDeviceScaleFactor(RenderView* render_view, float factor) { | 112 void SetDeviceScaleFactor(RenderView* render_view, float factor) { |
107 static_cast<RenderViewImpl*>(render_view) | 113 static_cast<RenderViewImpl*>(render_view) |
108 ->SetDeviceScaleFactorForTesting(factor); | 114 ->SetDeviceScaleFactorForTesting(factor); |
109 } | 115 } |
110 | 116 |
111 void DisableSystemDragDrop() { | 117 void DisableSystemDragDrop() { |
112 #if defined(OS_WIN) && !defined(USE_AURA) | 118 #if defined(OS_WIN) && !defined(USE_AURA) |
113 WebContentsDragWin::DisableDragDropForTesting(); | 119 WebContentsDragWin::DisableDragDropForTesting(); |
114 #endif | 120 #endif |
115 } | 121 } |
116 | 122 |
117 void DisableModalPopupMenus() { | 123 void DisableModalPopupMenus() { |
118 #if defined(OS_MACOSX) | 124 #if defined(OS_MACOSX) |
119 PopupMenuHelper::DontShowPopupMenuForTesting(); | 125 PopupMenuHelper::DontShowPopupMenuForTesting(); |
120 #endif | 126 #endif |
121 } | 127 } |
122 | 128 |
| 129 void EnableAutoResizeMode(RenderView* render_view, |
| 130 const WebSize& min_size, |
| 131 const WebSize& max_size) { |
| 132 static_cast<RenderViewImpl*>(render_view) |
| 133 ->EnableAutoResizeForTesting(min_size, max_size); |
| 134 } |
| 135 |
| 136 void DisableAutoResizeMode(RenderView* render_view, const WebSize& new_size) { |
| 137 static_cast<RenderViewImpl*>(render_view) |
| 138 ->DisableAutoResizeForTesting(new_size); |
| 139 } |
| 140 |
123 } // namespace content | 141 } // namespace content |
OLD | NEW |