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/test/test_render_view_host.h" | 5 #include "content/test/test_render_view_host.h" |
6 | 6 |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "content/browser/dom_storage/dom_storage_context_wrapper.h" | 8 #include "content/browser/dom_storage/dom_storage_context_wrapper.h" |
9 #include "content/browser/dom_storage/session_storage_namespace_impl.h" | 9 #include "content/browser/dom_storage/session_storage_namespace_impl.h" |
10 #include "content/browser/site_instance_impl.h" | 10 #include "content/browser/site_instance_impl.h" |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 bool swapped_out) | 201 bool swapped_out) |
202 : RenderViewHostImpl(instance, | 202 : RenderViewHostImpl(instance, |
203 delegate, | 203 delegate, |
204 widget_delegate, | 204 widget_delegate, |
205 routing_id, | 205 routing_id, |
206 main_frame_routing_id, | 206 main_frame_routing_id, |
207 swapped_out, | 207 swapped_out, |
208 false /* hidden */), | 208 false /* hidden */), |
209 render_view_created_(false), | 209 render_view_created_(false), |
210 delete_counter_(NULL), | 210 delete_counter_(NULL), |
211 simulate_fetch_via_proxy_(false), | 211 opener_route_id_(MSG_ROUTING_NONE) { |
212 simulate_history_list_was_cleared_(false), | |
213 contents_mime_type_("text/html"), | |
214 opener_route_id_(MSG_ROUTING_NONE), | |
215 main_render_frame_host_(NULL) { | |
216 // TestRenderWidgetHostView installs itself into this->view_ in its | 212 // TestRenderWidgetHostView installs itself into this->view_ in its |
217 // constructor, and deletes itself when TestRenderWidgetHostView::Destroy() is | 213 // constructor, and deletes itself when TestRenderWidgetHostView::Destroy() is |
218 // called. | 214 // called. |
219 new TestRenderWidgetHostView(this); | 215 new TestRenderWidgetHostView(this); |
220 } | 216 } |
221 | 217 |
222 TestRenderViewHost::~TestRenderViewHost() { | 218 TestRenderViewHost::~TestRenderViewHost() { |
223 if (delete_counter_) | 219 if (delete_counter_) |
224 ++*delete_counter_; | 220 ++*delete_counter_; |
225 } | 221 } |
(...skipping 11 matching lines...) Expand all Loading... |
237 } | 233 } |
238 | 234 |
239 bool TestRenderViewHost::IsRenderViewLive() const { | 235 bool TestRenderViewHost::IsRenderViewLive() const { |
240 return render_view_created_; | 236 return render_view_created_; |
241 } | 237 } |
242 | 238 |
243 bool TestRenderViewHost::IsFullscreen() const { | 239 bool TestRenderViewHost::IsFullscreen() const { |
244 return RenderViewHostImpl::IsFullscreen(); | 240 return RenderViewHostImpl::IsFullscreen(); |
245 } | 241 } |
246 | 242 |
247 void TestRenderViewHost::SendNavigate(int page_id, const GURL& url) { | |
248 main_render_frame_host_->SendNavigate(page_id, url); | |
249 } | |
250 | |
251 void TestRenderViewHost::SendFailedNavigate(int page_id, const GURL& url) { | |
252 main_render_frame_host_->SendFailedNavigate(page_id, url); | |
253 } | |
254 | |
255 void TestRenderViewHost::SendNavigateWithTransition( | |
256 int page_id, | |
257 const GURL& url, | |
258 ui::PageTransition transition) { | |
259 main_render_frame_host_->SendNavigateWithTransition(page_id, url, transition); | |
260 } | |
261 | |
262 void TestRenderViewHost::SendNavigateWithOriginalRequestURL( | |
263 int page_id, | |
264 const GURL& url, | |
265 const GURL& original_request_url) { | |
266 main_render_frame_host_->SendNavigateWithOriginalRequestURL( | |
267 page_id, url, original_request_url); | |
268 } | |
269 | |
270 void TestRenderViewHost::SendNavigateWithFile( | |
271 int page_id, | |
272 const GURL& url, | |
273 const base::FilePath& file_path) { | |
274 main_render_frame_host_->SendNavigateWithFile(page_id, url, file_path); | |
275 } | |
276 | |
277 void TestRenderViewHost::SendNavigateWithParams( | |
278 FrameHostMsg_DidCommitProvisionalLoad_Params* params) { | |
279 main_render_frame_host_->SendNavigateWithParams(params); | |
280 } | |
281 | |
282 void TestRenderViewHost::SendNavigateWithTransitionAndResponseCode( | |
283 int page_id, | |
284 const GURL& url, | |
285 ui::PageTransition transition, | |
286 int response_code) { | |
287 main_render_frame_host_->SendNavigateWithTransitionAndResponseCode( | |
288 page_id, url, transition, response_code); | |
289 } | |
290 | |
291 void TestRenderViewHost::SendNavigateWithParameters( | |
292 int page_id, | |
293 const GURL& url, | |
294 ui::PageTransition transition, | |
295 const GURL& original_request_url, | |
296 int response_code, | |
297 const base::FilePath* file_path_for_history_item) { | |
298 | |
299 main_render_frame_host_->SendNavigateWithParameters( | |
300 page_id, url, transition, original_request_url, response_code, | |
301 file_path_for_history_item, std::vector<GURL>()); | |
302 } | |
303 | |
304 void TestRenderViewHost::SetContentsMimeType(const std::string& mime_type) { | |
305 contents_mime_type_ = mime_type; | |
306 main_render_frame_host_->set_contents_mime_type(mime_type); | |
307 } | |
308 | |
309 void TestRenderViewHost::SimulateWasHidden() { | 243 void TestRenderViewHost::SimulateWasHidden() { |
310 WasHidden(); | 244 WasHidden(); |
311 } | 245 } |
312 | 246 |
313 void TestRenderViewHost::SimulateWasShown() { | 247 void TestRenderViewHost::SimulateWasShown() { |
314 WasShown(ui::LatencyInfo()); | 248 WasShown(ui::LatencyInfo()); |
315 } | 249 } |
316 | 250 |
317 void TestRenderViewHost::TestOnStartDragging( | 251 void TestRenderViewHost::TestOnStartDragging( |
318 const DropData& drop_data) { | 252 const DropData& drop_data) { |
319 blink::WebDragOperationsMask drag_operation = blink::WebDragOperationEvery; | 253 blink::WebDragOperationsMask drag_operation = blink::WebDragOperationEvery; |
320 DragEventSourceInfo event_info; | 254 DragEventSourceInfo event_info; |
321 OnStartDragging(drop_data, drag_operation, SkBitmap(), gfx::Vector2d(), | 255 OnStartDragging(drop_data, drag_operation, SkBitmap(), gfx::Vector2d(), |
322 event_info); | 256 event_info); |
323 } | 257 } |
324 | 258 |
325 void TestRenderViewHost::TestOnUpdateStateWithFile( | 259 void TestRenderViewHost::TestOnUpdateStateWithFile( |
326 int page_id, | 260 int page_id, |
327 const base::FilePath& file_path) { | 261 const base::FilePath& file_path) { |
328 OnUpdateState(page_id, | 262 OnUpdateState(page_id, |
329 PageState::CreateForTesting(GURL("http://www.google.com"), | 263 PageState::CreateForTesting(GURL("http://www.google.com"), |
330 false, | 264 false, |
331 "data", | 265 "data", |
332 &file_path)); | 266 &file_path)); |
333 } | 267 } |
334 | 268 |
335 void TestRenderViewHost::set_simulate_fetch_via_proxy(bool proxy) { | |
336 simulate_fetch_via_proxy_ = proxy; | |
337 } | |
338 | |
339 void TestRenderViewHost::set_simulate_history_list_was_cleared(bool cleared) { | |
340 simulate_history_list_was_cleared_ = cleared; | |
341 main_render_frame_host_->set_simulate_history_list_was_cleared(cleared); | |
342 } | |
343 | |
344 RenderViewHostImplTestHarness::RenderViewHostImplTestHarness() { | 269 RenderViewHostImplTestHarness::RenderViewHostImplTestHarness() { |
345 std::vector<ui::ScaleFactor> scale_factors; | 270 std::vector<ui::ScaleFactor> scale_factors; |
346 scale_factors.push_back(ui::SCALE_FACTOR_100P); | 271 scale_factors.push_back(ui::SCALE_FACTOR_100P); |
347 scoped_set_supported_scale_factors_.reset( | 272 scoped_set_supported_scale_factors_.reset( |
348 new ui::test::ScopedSetSupportedScaleFactors(scale_factors)); | 273 new ui::test::ScopedSetSupportedScaleFactors(scale_factors)); |
349 } | 274 } |
350 | 275 |
351 RenderViewHostImplTestHarness::~RenderViewHostImplTestHarness() { | 276 RenderViewHostImplTestHarness::~RenderViewHostImplTestHarness() { |
352 } | 277 } |
353 | 278 |
(...skipping 13 matching lines...) Expand all Loading... |
367 | 292 |
368 TestRenderFrameHost* RenderViewHostImplTestHarness::main_test_rfh() { | 293 TestRenderFrameHost* RenderViewHostImplTestHarness::main_test_rfh() { |
369 return contents()->GetMainFrame(); | 294 return contents()->GetMainFrame(); |
370 } | 295 } |
371 | 296 |
372 TestWebContents* RenderViewHostImplTestHarness::contents() { | 297 TestWebContents* RenderViewHostImplTestHarness::contents() { |
373 return static_cast<TestWebContents*>(web_contents()); | 298 return static_cast<TestWebContents*>(web_contents()); |
374 } | 299 } |
375 | 300 |
376 } // namespace content | 301 } // namespace content |
OLD | NEW |