| 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 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 page_id, url, PAGE_TRANSITION_LINK, 500); | 293 page_id, url, PAGE_TRANSITION_LINK, 500); |
| 294 } | 294 } |
| 295 | 295 |
| 296 void TestRenderViewHost::SendNavigateWithTransition( | 296 void TestRenderViewHost::SendNavigateWithTransition( |
| 297 int page_id, const GURL& url, PageTransition transition) { | 297 int page_id, const GURL& url, PageTransition transition) { |
| 298 SendNavigateWithTransitionAndResponseCode(page_id, url, transition, 200); | 298 SendNavigateWithTransitionAndResponseCode(page_id, url, transition, 200); |
| 299 } | 299 } |
| 300 | 300 |
| 301 void TestRenderViewHost::SendNavigateWithOriginalRequestURL( | 301 void TestRenderViewHost::SendNavigateWithOriginalRequestURL( |
| 302 int page_id, const GURL& url, const GURL& original_request_url) { | 302 int page_id, const GURL& url, const GURL& original_request_url) { |
| 303 OnDidStartProvisionalLoadForFrame(kFrameId, -1, true, url); | 303 main_render_frame_host()->OnDidStartProvisionalLoadForFrame( |
| 304 kFrameId, -1, true, url); |
| 304 SendNavigateWithParameters(page_id, url, PAGE_TRANSITION_LINK, | 305 SendNavigateWithParameters(page_id, url, PAGE_TRANSITION_LINK, |
| 305 original_request_url, 200, 0); | 306 original_request_url, 200, 0); |
| 306 } | 307 } |
| 307 | 308 |
| 308 void TestRenderViewHost::SendNavigateWithFile( | 309 void TestRenderViewHost::SendNavigateWithFile( |
| 309 int page_id, const GURL& url, const base::FilePath& file_path) { | 310 int page_id, const GURL& url, const base::FilePath& file_path) { |
| 310 SendNavigateWithParameters(page_id, url, PAGE_TRANSITION_LINK, | 311 SendNavigateWithParameters(page_id, url, PAGE_TRANSITION_LINK, |
| 311 url, 200, &file_path); | 312 url, 200, &file_path); |
| 312 } | 313 } |
| 313 | 314 |
| 314 void TestRenderViewHost::SendNavigateWithTransitionAndResponseCode( | 315 void TestRenderViewHost::SendNavigateWithTransitionAndResponseCode( |
| 315 int page_id, const GURL& url, PageTransition transition, | 316 int page_id, const GURL& url, PageTransition transition, |
| 316 int response_code) { | 317 int response_code) { |
| 317 // DidStartProvisionalLoad may delete the pending entry that holds |url|, | 318 // DidStartProvisionalLoad may delete the pending entry that holds |url|, |
| 318 // so we keep a copy of it to use in SendNavigateWithParameters. | 319 // so we keep a copy of it to use in SendNavigateWithParameters. |
| 319 GURL url_copy(url); | 320 GURL url_copy(url); |
| 320 OnDidStartProvisionalLoadForFrame(kFrameId, -1, true, url_copy); | 321 main_render_frame_host()->OnDidStartProvisionalLoadForFrame( |
| 322 kFrameId, -1, true, url_copy); |
| 321 SendNavigateWithParameters(page_id, url_copy, transition, url_copy, | 323 SendNavigateWithParameters(page_id, url_copy, transition, url_copy, |
| 322 response_code, 0); | 324 response_code, 0); |
| 323 } | 325 } |
| 324 | 326 |
| 325 void TestRenderViewHost::SendNavigateWithParameters( | 327 void TestRenderViewHost::SendNavigateWithParameters( |
| 326 int page_id, const GURL& url, PageTransition transition, | 328 int page_id, const GURL& url, PageTransition transition, |
| 327 const GURL& original_request_url, int response_code, | 329 const GURL& original_request_url, int response_code, |
| 328 const base::FilePath* file_path_for_history_item) { | 330 const base::FilePath* file_path_for_history_item) { |
| 329 ViewHostMsg_FrameNavigate_Params params; | 331 ViewHostMsg_FrameNavigate_Params params; |
| 330 params.page_id = page_id; | 332 params.page_id = page_id; |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 420 } | 422 } |
| 421 | 423 |
| 422 TestRenderViewHost* RenderViewHostImplTestHarness::pending_test_rvh() { | 424 TestRenderViewHost* RenderViewHostImplTestHarness::pending_test_rvh() { |
| 423 return static_cast<TestRenderViewHost*>(pending_rvh()); | 425 return static_cast<TestRenderViewHost*>(pending_rvh()); |
| 424 } | 426 } |
| 425 | 427 |
| 426 TestRenderViewHost* RenderViewHostImplTestHarness::active_test_rvh() { | 428 TestRenderViewHost* RenderViewHostImplTestHarness::active_test_rvh() { |
| 427 return static_cast<TestRenderViewHost*>(active_rvh()); | 429 return static_cast<TestRenderViewHost*>(active_rvh()); |
| 428 } | 430 } |
| 429 | 431 |
| 432 TestRenderFrameHost* RenderViewHostImplTestHarness::main_test_rfh() { |
| 433 return static_cast<TestRenderFrameHost*>(main_rfh()); |
| 434 } |
| 435 |
| 430 TestWebContents* RenderViewHostImplTestHarness::contents() { | 436 TestWebContents* RenderViewHostImplTestHarness::contents() { |
| 431 return static_cast<TestWebContents*>(web_contents()); | 437 return static_cast<TestWebContents*>(web_contents()); |
| 432 } | 438 } |
| 433 | 439 |
| 434 } // namespace content | 440 } // namespace content |
| OLD | NEW |