Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2012)

Unified Diff: content/test/test_render_frame_host.cc

Issue 953503002: PlzNavigate: test updates post beforeUnload IPC refactor. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/test/test_render_frame_host.cc
diff --git a/content/test/test_render_frame_host.cc b/content/test/test_render_frame_host.cc
index 9249d2609ab7ce9f6e779c4223cb2112a8edbb0e..6d25a4bb135cf7b25476513065dc4ec7128adea4 100644
--- a/content/test/test_render_frame_host.cc
+++ b/content/test/test_render_frame_host.cc
@@ -199,11 +199,20 @@ void TestRenderFrameHost::SendBeginNavigationWithURL(const GURL& url,
scoped_refptr<ResourceRequestBody>());
}
+void TestRenderFrameHost::SendRendererInitiatedNavigationRequest(
+ const GURL& url,
+ bool has_user_gesture) {
+ if (base::CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kEnableBrowserSideNavigation)) {
+ SendBeginNavigationWithURL(url, has_user_gesture);
+ }
+}
+
void TestRenderFrameHost::DidDisownOpener() {
OnDidDisownOpener();
}
-void TestRenderFrameHost::PrepareForCommit(const GURL& url) {
+void TestRenderFrameHost::PrepareForCommit() {
if (!base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kEnableBrowserSideNavigation)) {
SendBeforeUnloadACK(true);
@@ -215,14 +224,7 @@ void TestRenderFrameHost::PrepareForCommit(const GURL& url) {
NavigationRequest* request =
static_cast<NavigatorImpl*>(frame_tree_node_->navigator())
->GetNavigationRequestForNodeForTesting(frame_tree_node_);
-
- // We are simulating a renderer-initiated user-initiated navigation.
- if (!request) {
- SendBeginNavigationWithURL(url, true);
- request = static_cast<NavigatorImpl*>(frame_tree_node_->navigator())
- ->GetNavigationRequestForNodeForTesting(frame_tree_node_);
- }
- ASSERT_TRUE(request);
+ CHECK(request);
// We may not have simulated the renderer response to the navigation request.
clamy 2015/02/24 13:05:34 nit: I think this should be rephrased as something
carlosk 2015/02/24 16:38:56 Updated the comment.
// Do that now.
@@ -234,10 +236,10 @@ void TestRenderFrameHost::PrepareForCommit(const GURL& url) {
if (request->state() == NavigationRequest::RESPONSE_STARTED)
return;
- ASSERT_TRUE(request->state() == NavigationRequest::STARTED);
+ CHECK(request->state() == NavigationRequest::STARTED);
TestNavigationURLLoader* url_loader =
static_cast<TestNavigationURLLoader*>(request->loader_for_testing());
- ASSERT_TRUE(url_loader);
+ CHECK(url_loader);
carlosk 2015/02/23 16:42:03 Changed to CHECKs as ASSERTs will not trigger test
clamy 2015/02/24 13:05:34 Acknowledged.
scoped_refptr<ResourceResponse> response(new ResourceResponse);
url_loader->CallOnResponseStarted(response, MakeEmptyStream());
}

Powered by Google App Engine
This is Rietveld 408576698