| 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 "base/guid.h" | 7 #include "base/guid.h" |
| 8 #include "content/browser/frame_host/frame_tree.h" | 8 #include "content/browser/frame_host/frame_tree.h" |
| 9 #include "content/browser/frame_host/navigation_handle_impl.h" | 9 #include "content/browser/frame_host/navigation_handle_impl.h" |
| 10 #include "content/browser/frame_host/navigation_request.h" | 10 #include "content/browser/frame_host/navigation_request.h" |
| (...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 413 CHECK(url_loader); | 413 CHECK(url_loader); |
| 414 | 414 |
| 415 // If a non-empty |redirect_url| was provided, simulate a server redirect. | 415 // If a non-empty |redirect_url| was provided, simulate a server redirect. |
| 416 if (!redirect_url.is_empty()) | 416 if (!redirect_url.is_empty()) |
| 417 url_loader->SimulateServerRedirect(redirect_url); | 417 url_loader->SimulateServerRedirect(redirect_url); |
| 418 | 418 |
| 419 // Simulate the network stack commit. | 419 // Simulate the network stack commit. |
| 420 scoped_refptr<ResourceResponse> response(new ResourceResponse); | 420 scoped_refptr<ResourceResponse> response(new ResourceResponse); |
| 421 // TODO(carlosk): ideally with PlzNavigate it should be possible someday to | 421 // TODO(carlosk): ideally with PlzNavigate it should be possible someday to |
| 422 // fully commit the navigation at this call to CallOnResponseStarted. | 422 // fully commit the navigation at this call to CallOnResponseStarted. |
| 423 url_loader->CallOnResponseStarted(response, MakeEmptyStream()); | 423 url_loader->CallOnResponseStarted(response, MakeEmptyStream(), nullptr); |
| 424 } | 424 } |
| 425 | 425 |
| 426 int32_t TestRenderFrameHost::ComputeNextPageID() { | 426 int32_t TestRenderFrameHost::ComputeNextPageID() { |
| 427 const NavigationEntryImpl* entry = static_cast<NavigationEntryImpl*>( | 427 const NavigationEntryImpl* entry = static_cast<NavigationEntryImpl*>( |
| 428 frame_tree_node()->navigator()->GetController()->GetPendingEntry()); | 428 frame_tree_node()->navigator()->GetController()->GetPendingEntry()); |
| 429 DCHECK(!(entry && entry->site_instance()) || | 429 DCHECK(!(entry && entry->site_instance()) || |
| 430 entry->site_instance() == GetSiteInstance()); | 430 entry->site_instance() == GetSiteInstance()); |
| 431 // Entry can be null when committing an error page (the pending entry was | 431 // Entry can be null when committing an error page (the pending entry was |
| 432 // cleared during DidFailProvisionalLoad). | 432 // cleared during DidFailProvisionalLoad). |
| 433 int page_id = entry ? entry->GetPageID() : -1; | 433 int page_id = entry ? entry->GetPageID() : -1; |
| 434 if (page_id == -1) { | 434 if (page_id == -1) { |
| 435 WebContentsImpl* web_contents = static_cast<WebContentsImpl*>(delegate()); | 435 WebContentsImpl* web_contents = static_cast<WebContentsImpl*>(delegate()); |
| 436 page_id = web_contents->GetMaxPageIDForSiteInstance(GetSiteInstance()) + 1; | 436 page_id = web_contents->GetMaxPageIDForSiteInstance(GetSiteInstance()) + 1; |
| 437 } | 437 } |
| 438 return page_id; | 438 return page_id; |
| 439 } | 439 } |
| 440 | 440 |
| 441 } // namespace content | 441 } // namespace content |
| OLD | NEW |