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/browser/renderer_host/render_widget_host_impl.h" | 9 #include "content/browser/renderer_host/render_widget_host_impl.h" |
10 #include "content/common/gpu/image_transport_surface.h" | 10 #include "content/common/gpu/image_transport_surface.h" |
11 #include "content/public/common/page_state.h" | 11 #include "content/public/common/page_state.h" |
12 #include "content/renderer/history_entry.h" | 12 #include "content/renderer/history_entry.h" |
13 #include "content/renderer/history_serialization.h" | 13 #include "content/renderer/history_serialization.h" |
| 14 #include "content/renderer/render_frame_impl.h" |
14 #include "content/renderer/render_thread_impl.h" | 15 #include "content/renderer/render_thread_impl.h" |
15 #include "content/renderer/render_view_impl.h" | 16 #include "content/renderer/render_view_impl.h" |
16 #include "content/renderer/renderer_webkitplatformsupport_impl.h" | 17 #include "content/renderer/renderer_webkitplatformsupport_impl.h" |
17 #include "content/shell/renderer/test_runner/TestCommon.h" | 18 #include "content/shell/renderer/test_runner/TestCommon.h" |
18 #include "content/shell/renderer/test_runner/WebFrameTestProxy.h" | 19 #include "content/shell/renderer/test_runner/WebFrameTestProxy.h" |
19 #include "content/shell/renderer/test_runner/WebTestProxy.h" | 20 #include "content/shell/renderer/test_runner/WebTestProxy.h" |
20 #include "content/test/test_media_stream_client.h" | 21 #include "content/test/test_media_stream_client.h" |
21 #include "third_party/WebKit/public/platform/WebDeviceMotionData.h" | 22 #include "third_party/WebKit/public/platform/WebDeviceMotionData.h" |
22 #include "third_party/WebKit/public/platform/WebDeviceOrientationData.h" | 23 #include "third_party/WebKit/public/platform/WebDeviceOrientationData.h" |
23 #include "third_party/WebKit/public/platform/WebGamepads.h" | 24 #include "third_party/WebKit/public/platform/WebGamepads.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 } | 59 } |
59 | 60 |
60 RenderFrameImpl* CreateWebFrameTestProxy( | 61 RenderFrameImpl* CreateWebFrameTestProxy( |
61 RenderViewImpl* render_view, | 62 RenderViewImpl* render_view, |
62 int32 routing_id) { | 63 int32 routing_id) { |
63 typedef WebFrameTestProxy<RenderFrameImpl, RenderViewImpl*, int32> FrameProxy; | 64 typedef WebFrameTestProxy<RenderFrameImpl, RenderViewImpl*, int32> FrameProxy; |
64 | 65 |
65 FrameProxy* render_frame_proxy = new FrameProxy(render_view, routing_id); | 66 FrameProxy* render_frame_proxy = new FrameProxy(render_view, routing_id); |
66 render_frame_proxy->setBaseProxy(GetWebTestProxyBase(render_view)); | 67 render_frame_proxy->setBaseProxy(GetWebTestProxyBase(render_view)); |
67 | 68 |
| 69 UseMockMediaStreams(render_frame_proxy); |
| 70 |
68 return render_frame_proxy; | 71 return render_frame_proxy; |
69 } | 72 } |
70 | 73 |
71 } // namespace | 74 } // namespace |
72 | 75 |
73 | 76 |
74 void EnableWebTestProxyCreation( | 77 void EnableWebTestProxyCreation( |
75 const base::Callback<void(RenderView*, WebTestProxyBase*)>& callback) { | 78 const base::Callback<void(RenderView*, WebTestProxyBase*)>& callback) { |
76 g_callback.Get() = callback; | 79 g_callback.Get() = callback; |
77 RenderViewImpl::InstallCreateHook(CreateWebTestProxy); | 80 RenderViewImpl::InstallCreateHook(CreateWebTestProxy); |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 const WebSize& max_size) { | 156 const WebSize& max_size) { |
154 static_cast<RenderViewImpl*>(render_view)-> | 157 static_cast<RenderViewImpl*>(render_view)-> |
155 EnableAutoResizeForTesting(min_size, max_size); | 158 EnableAutoResizeForTesting(min_size, max_size); |
156 } | 159 } |
157 | 160 |
158 void DisableAutoResizeMode(RenderView* render_view, const WebSize& new_size) { | 161 void DisableAutoResizeMode(RenderView* render_view, const WebSize& new_size) { |
159 static_cast<RenderViewImpl*>(render_view)-> | 162 static_cast<RenderViewImpl*>(render_view)-> |
160 DisableAutoResizeForTesting(new_size); | 163 DisableAutoResizeForTesting(new_size); |
161 } | 164 } |
162 | 165 |
163 void UseMockMediaStreams(RenderView* render_view) { | 166 void UseMockMediaStreams(RenderFrame* render_frame) { |
164 RenderViewImpl* render_view_impl = static_cast<RenderViewImpl*>(render_view); | 167 RenderFrameImpl* render_frame_impl = static_cast<RenderFrameImpl*>( |
165 render_view_impl->SetMediaStreamClientForTesting( | 168 render_frame); |
166 new TestMediaStreamClient(render_view_impl)); | 169 render_frame_impl->SetMediaStreamClientForTesting( |
| 170 new TestMediaStreamClient(render_frame_impl)); |
167 } | 171 } |
168 | 172 |
169 struct ToLower { | 173 struct ToLower { |
170 base::char16 operator()(base::char16 c) { return tolower(c); } | 174 base::char16 operator()(base::char16 c) { return tolower(c); } |
171 }; | 175 }; |
172 | 176 |
173 // Returns True if node1 < node2. | 177 // Returns True if node1 < node2. |
174 bool HistoryEntryCompareLess(HistoryEntry::HistoryNode* node1, | 178 bool HistoryEntryCompareLess(HistoryEntry::HistoryNode* node1, |
175 HistoryEntry::HistoryNode* node2) { | 179 HistoryEntry::HistoryNode* node2) { |
176 base::string16 target1 = node1->item().target(); | 180 base::string16 target1 = node1->item().target(); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 result.append( | 227 result.append( |
224 DumpHistoryItem(entry->root_history_node(), | 228 DumpHistoryItem(entry->root_history_node(), |
225 8, | 229 8, |
226 index == current_index)); | 230 index == current_index)); |
227 } | 231 } |
228 result.append("===============================================\n"); | 232 result.append("===============================================\n"); |
229 return result; | 233 return result; |
230 } | 234 } |
231 | 235 |
232 } // namespace content | 236 } // namespace content |
OLD | NEW |