| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_frame_host.h" | 5 #include "content/test/test_render_frame_host.h" |
| 6 | 6 |
| 7 #include "content/browser/frame_host/frame_tree.h" | 7 #include "content/browser/frame_host/frame_tree.h" |
| 8 #include "content/browser/frame_host/navigation_handle_impl.h" | 8 #include "content/browser/frame_host/navigation_handle_impl.h" |
| 9 #include "content/browser/frame_host/navigation_request.h" | 9 #include "content/browser/frame_host/navigation_request.h" |
| 10 #include "content/browser/frame_host/navigator.h" | 10 #include "content/browser/frame_host/navigator.h" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 RenderFrameHost* render_frame_host) { | 38 RenderFrameHost* render_frame_host) { |
| 39 last_created_frame_ = render_frame_host; | 39 last_created_frame_ = render_frame_host; |
| 40 } | 40 } |
| 41 | 41 |
| 42 TestRenderFrameHost::TestRenderFrameHost(SiteInstance* site_instance, | 42 TestRenderFrameHost::TestRenderFrameHost(SiteInstance* site_instance, |
| 43 RenderViewHostImpl* render_view_host, | 43 RenderViewHostImpl* render_view_host, |
| 44 RenderFrameHostDelegate* delegate, | 44 RenderFrameHostDelegate* delegate, |
| 45 RenderWidgetHostDelegate* rwh_delegate, | 45 RenderWidgetHostDelegate* rwh_delegate, |
| 46 FrameTree* frame_tree, | 46 FrameTree* frame_tree, |
| 47 FrameTreeNode* frame_tree_node, | 47 FrameTreeNode* frame_tree_node, |
| 48 int32 routing_id, | 48 int32_t routing_id, |
| 49 int32 widget_routing_id, | 49 int32_t widget_routing_id, |
| 50 int flags) | 50 int flags) |
| 51 : RenderFrameHostImpl(site_instance, | 51 : RenderFrameHostImpl(site_instance, |
| 52 render_view_host, | 52 render_view_host, |
| 53 delegate, | 53 delegate, |
| 54 rwh_delegate, | 54 rwh_delegate, |
| 55 frame_tree, | 55 frame_tree, |
| 56 frame_tree_node, | 56 frame_tree_node, |
| 57 routing_id, | 57 routing_id, |
| 58 widget_routing_id, | 58 widget_routing_id, |
| 59 flags), | 59 flags), |
| (...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 388 if (!redirect_url.is_empty()) | 388 if (!redirect_url.is_empty()) |
| 389 url_loader->SimulateServerRedirect(redirect_url); | 389 url_loader->SimulateServerRedirect(redirect_url); |
| 390 | 390 |
| 391 // Simulate the network stack commit. | 391 // Simulate the network stack commit. |
| 392 scoped_refptr<ResourceResponse> response(new ResourceResponse); | 392 scoped_refptr<ResourceResponse> response(new ResourceResponse); |
| 393 // TODO(carlosk): ideally with PlzNavigate it should be possible someday to | 393 // TODO(carlosk): ideally with PlzNavigate it should be possible someday to |
| 394 // fully commit the navigation at this call to CallOnResponseStarted. | 394 // fully commit the navigation at this call to CallOnResponseStarted. |
| 395 url_loader->CallOnResponseStarted(response, MakeEmptyStream()); | 395 url_loader->CallOnResponseStarted(response, MakeEmptyStream()); |
| 396 } | 396 } |
| 397 | 397 |
| 398 int32 TestRenderFrameHost::ComputeNextPageID() { | 398 int32_t TestRenderFrameHost::ComputeNextPageID() { |
| 399 const NavigationEntryImpl* entry = static_cast<NavigationEntryImpl*>( | 399 const NavigationEntryImpl* entry = static_cast<NavigationEntryImpl*>( |
| 400 frame_tree_node()->navigator()->GetController()->GetPendingEntry()); | 400 frame_tree_node()->navigator()->GetController()->GetPendingEntry()); |
| 401 DCHECK(!(entry && entry->site_instance()) || | 401 DCHECK(!(entry && entry->site_instance()) || |
| 402 entry->site_instance() == GetSiteInstance()); | 402 entry->site_instance() == GetSiteInstance()); |
| 403 // Entry can be null when committing an error page (the pending entry was | 403 // Entry can be null when committing an error page (the pending entry was |
| 404 // cleared during DidFailProvisionalLoad). | 404 // cleared during DidFailProvisionalLoad). |
| 405 int page_id = entry ? entry->GetPageID() : -1; | 405 int page_id = entry ? entry->GetPageID() : -1; |
| 406 if (page_id == -1) { | 406 if (page_id == -1) { |
| 407 WebContentsImpl* web_contents = static_cast<WebContentsImpl*>(delegate()); | 407 WebContentsImpl* web_contents = static_cast<WebContentsImpl*>(delegate()); |
| 408 page_id = web_contents->GetMaxPageIDForSiteInstance(GetSiteInstance()) + 1; | 408 page_id = web_contents->GetMaxPageIDForSiteInstance(GetSiteInstance()) + 1; |
| 409 } | 409 } |
| 410 return page_id; | 410 return page_id; |
| 411 } | 411 } |
| 412 | 412 |
| 413 } // namespace content | 413 } // namespace content |
| OLD | NEW |