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

Side by Side Diff: content/browser/frame_host/navigation_controller_impl_browsertest.cc

Issue 1978793002: RenderViewImpl::page_id_ isn't initialized for cross-process replacement navigations. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix nits and remove testing condition. Created 4 years, 7 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 unified diff | Download patch
« no previous file with comments | « no previous file | content/renderer/render_frame_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/frame_host/navigation_controller_impl.h" 5 #include "content/browser/frame_host/navigation_controller_impl.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after
446 EXPECT_TRUE(WaitForLoadStop(shell2->web_contents())); 446 EXPECT_TRUE(WaitForLoadStop(shell2->web_contents()));
447 447
448 EXPECT_EQ(1, shell2->web_contents()->GetController().GetEntryCount()); 448 EXPECT_EQ(1, shell2->web_contents()->GetController().GetEntryCount());
449 EXPECT_EQ(1, RendererHistoryLength(shell2)); 449 EXPECT_EQ(1, RendererHistoryLength(shell2));
450 450
451 // Again, as above, there's no way to access the renderer's notion of the 451 // Again, as above, there's no way to access the renderer's notion of the
452 // history offset via JavaScript. Checking just the history length, again, 452 // history offset via JavaScript. Checking just the history length, again,
453 // will have to suffice. 453 // will have to suffice.
454 } 454 }
455 455
456 // Check that we will not trigger a DCHECK in renderer for cross-process
457 // replacement navigations.
458 // See https://crbug.com/611679.
459 IN_PROC_BROWSER_TEST_F(NavigationControllerBrowserTest,
460 PageIDUpdatedOnPageReplacement) {
461 NavigationController& controller = shell()->web_contents()->GetController();
462 const GURL page_url = embedded_test_server()->GetURL(
463 "/navigation_controller/simple_page_1.html");
464
465 // Use data scheme first so that the next page will be loaded
466 // in a separate site instance.
467 EXPECT_TRUE(NavigateToURL(shell(), GURL("data:text/html,page1")));
468 EXPECT_EQ(1, controller.GetEntryCount());
469 EXPECT_NE(-1, shell()->web_contents()->GetMaxPageID());
470
471 // Now navigate and replace the current entry.
472 NavigateToURLAndReplace(shell(), page_url);
473 EXPECT_EQ(1, controller.GetEntryCount());
474
475 // Page ID should be updated.
476 EXPECT_NE(-1, shell()->web_contents()->GetMaxPageID());
477
478 // Reload the page and verify that we don't hit
479 // a DCHECK in |RenderFrameImpl::NavigateInternal|.
480 controller.Reload(false);
481 EXPECT_TRUE(WaitForLoadStop(shell()->web_contents()));
482
483 // DCHECK shouldn't be triggered and we should have a valid page ID.
484 EXPECT_NE(-1, shell()->web_contents()->GetMaxPageID());
485 EXPECT_TRUE(shell()->web_contents()->GetMainFrame()->IsRenderFrameLive());
486 }
487
456 namespace { 488 namespace {
457 489
458 class NoNavigationsObserver : public WebContentsObserver { 490 class NoNavigationsObserver : public WebContentsObserver {
459 public: 491 public:
460 // Observes navigation for the specified |web_contents|. 492 // Observes navigation for the specified |web_contents|.
461 explicit NoNavigationsObserver(WebContents* web_contents) 493 explicit NoNavigationsObserver(WebContents* web_contents)
462 : WebContentsObserver(web_contents) {} 494 : WebContentsObserver(web_contents) {}
463 495
464 private: 496 private:
465 void DidNavigateAnyFrame(RenderFrameHost* render_frame_host, 497 void DidNavigateAnyFrame(RenderFrameHost* render_frame_host,
(...skipping 3622 matching lines...) Expand 10 before | Expand all | Expand 10 after
4088 // TODO(clamy): Check the post id as well when PlzNavigate handles it 4120 // TODO(clamy): Check the post id as well when PlzNavigate handles it
4089 // properly. 4121 // properly.
4090 if (!IsBrowserSideNavigationEnabled()) 4122 if (!IsBrowserSideNavigationEnabled())
4091 EXPECT_NE(-1, frame_entry->post_id()); 4123 EXPECT_NE(-1, frame_entry->post_id());
4092 EXPECT_FALSE(entry->GetHasPostData()); 4124 EXPECT_FALSE(entry->GetHasPostData());
4093 EXPECT_EQ(-1, entry->GetPostID()); 4125 EXPECT_EQ(-1, entry->GetPostID());
4094 } 4126 }
4095 } 4127 }
4096 4128
4097 } // namespace content 4129 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/renderer/render_frame_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698