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/browser/renderer_host/test_render_view_host.h" | 5 #include "content/browser/renderer_host/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/renderer_host/test_backing_store.h" | 10 #include "content/browser/renderer_host/test_backing_store.h" |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 page_id, url, PAGE_TRANSITION_LINK, 500); | 286 page_id, url, PAGE_TRANSITION_LINK, 500); |
287 } | 287 } |
288 | 288 |
289 void TestRenderViewHost::SendNavigateWithTransition( | 289 void TestRenderViewHost::SendNavigateWithTransition( |
290 int page_id, const GURL& url, PageTransition transition) { | 290 int page_id, const GURL& url, PageTransition transition) { |
291 SendNavigateWithTransitionAndResponseCode(page_id, url, transition, 200); | 291 SendNavigateWithTransitionAndResponseCode(page_id, url, transition, 200); |
292 } | 292 } |
293 | 293 |
294 void TestRenderViewHost::SendNavigateWithOriginalRequestURL( | 294 void TestRenderViewHost::SendNavigateWithOriginalRequestURL( |
295 int page_id, const GURL& url, const GURL& original_request_url) { | 295 int page_id, const GURL& url, const GURL& original_request_url) { |
296 OnDidStartProvisionalLoadForFrame(kFrameId, -1, true, url); | 296 main_render_frame_host()->OnDidStartProvisionalLoadForFrame( |
| 297 kFrameId, -1, true, url); |
297 SendNavigateWithParameters(page_id, url, PAGE_TRANSITION_LINK, | 298 SendNavigateWithParameters(page_id, url, PAGE_TRANSITION_LINK, |
298 original_request_url, 200, 0); | 299 original_request_url, 200, 0); |
299 } | 300 } |
300 | 301 |
301 void TestRenderViewHost::SendNavigateWithFile( | 302 void TestRenderViewHost::SendNavigateWithFile( |
302 int page_id, const GURL& url, const base::FilePath& file_path) { | 303 int page_id, const GURL& url, const base::FilePath& file_path) { |
303 SendNavigateWithParameters(page_id, url, PAGE_TRANSITION_LINK, | 304 SendNavigateWithParameters(page_id, url, PAGE_TRANSITION_LINK, |
304 url, 200, &file_path); | 305 url, 200, &file_path); |
305 } | 306 } |
306 | 307 |
307 void TestRenderViewHost::SendNavigateWithTransitionAndResponseCode( | 308 void TestRenderViewHost::SendNavigateWithTransitionAndResponseCode( |
308 int page_id, const GURL& url, PageTransition transition, | 309 int page_id, const GURL& url, PageTransition transition, |
309 int response_code) { | 310 int response_code) { |
310 // DidStartProvisionalLoad may delete the pending entry that holds |url|, | 311 // DidStartProvisionalLoad may delete the pending entry that holds |url|, |
311 // so we keep a copy of it to use in SendNavigateWithParameters. | 312 // so we keep a copy of it to use in SendNavigateWithParameters. |
312 GURL url_copy(url); | 313 GURL url_copy(url); |
313 OnDidStartProvisionalLoadForFrame(kFrameId, -1, true, url_copy); | 314 main_render_frame_host()->OnDidStartProvisionalLoadForFrame( |
| 315 kFrameId, -1, true, url_copy); |
314 SendNavigateWithParameters(page_id, url_copy, transition, url_copy, | 316 SendNavigateWithParameters(page_id, url_copy, transition, url_copy, |
315 response_code, 0); | 317 response_code, 0); |
316 } | 318 } |
317 | 319 |
318 void TestRenderViewHost::SendNavigateWithParameters( | 320 void TestRenderViewHost::SendNavigateWithParameters( |
319 int page_id, const GURL& url, PageTransition transition, | 321 int page_id, const GURL& url, PageTransition transition, |
320 const GURL& original_request_url, int response_code, | 322 const GURL& original_request_url, int response_code, |
321 const base::FilePath* file_path_for_history_item) { | 323 const base::FilePath* file_path_for_history_item) { |
322 ViewHostMsg_FrameNavigate_Params params; | 324 ViewHostMsg_FrameNavigate_Params params; |
323 params.page_id = page_id; | 325 params.page_id = page_id; |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
413 } | 415 } |
414 | 416 |
415 TestRenderViewHost* RenderViewHostImplTestHarness::pending_test_rvh() { | 417 TestRenderViewHost* RenderViewHostImplTestHarness::pending_test_rvh() { |
416 return static_cast<TestRenderViewHost*>(pending_rvh()); | 418 return static_cast<TestRenderViewHost*>(pending_rvh()); |
417 } | 419 } |
418 | 420 |
419 TestRenderViewHost* RenderViewHostImplTestHarness::active_test_rvh() { | 421 TestRenderViewHost* RenderViewHostImplTestHarness::active_test_rvh() { |
420 return static_cast<TestRenderViewHost*>(active_rvh()); | 422 return static_cast<TestRenderViewHost*>(active_rvh()); |
421 } | 423 } |
422 | 424 |
| 425 TestRenderFrameHost* RenderViewHostImplTestHarness::main_test_rfh() { |
| 426 return static_cast<TestRenderFrameHost*>(main_rfh()); |
| 427 } |
| 428 |
423 TestWebContents* RenderViewHostImplTestHarness::contents() { | 429 TestWebContents* RenderViewHostImplTestHarness::contents() { |
424 return static_cast<TestWebContents*>(web_contents()); | 430 return static_cast<TestWebContents*>(web_contents()); |
425 } | 431 } |
426 | 432 |
427 } // namespace content | 433 } // namespace content |
OLD | NEW |