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

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: Address review remarks 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
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
Charlie Reis 2016/05/18 17:33:59 nit: Only one blank line between tests.
Andrey Kraynov 2016/05/18 18:06:49 Done.
457 // Check that we will not trigger a DCHECK in renderer for cross-process
458 // replacement navigations.
459 // See https://crbug.com/611679.
460 IN_PROC_BROWSER_TEST_F(NavigationControllerBrowserTest,
461 PageIDUpdatedOnPageReplacement) {
462 NavigationController& controller = shell()->web_contents()->GetController();
463 const GURL page_url = embedded_test_server()->GetURL(
464 "/navigation_controller/simple_page_1.html");
465
466 // Use data scheme first so that the next page will be loaded
467 // in a separate site instance.
468 EXPECT_TRUE(NavigateToURL(shell(), GURL("data:text/html,page1")));
469 EXPECT_EQ(1, controller.GetEntryCount());
470 EXPECT_NE(-1, shell()->web_contents()->GetMaxPageID());
471
472 // Now navigate and replace the current entry.
473 NavigateToURLAndReplace(shell(), page_url);
474 EXPECT_EQ(1, controller.GetEntryCount());
475
476 // Page ID should be updated.
477 EXPECT_NE(-1, shell()->web_contents()->GetMaxPageID());
478
479 // Reload the page and verify that we don't hit
480 // a DCHECK in |RenderFrameImpl::NavigateInternal|.
481 controller.Reload(false);
482 EXPECT_TRUE(WaitForLoadStop(shell()->web_contents()));
483
484 // DCHECK shouldn't be triggered and we should have a valid page ID.
485 EXPECT_NE(-1, shell()->web_contents()->GetMaxPageID());
486 EXPECT_TRUE(shell()->web_contents()->GetMainFrame()->IsRenderFrameLive());
487 }
488
456 namespace { 489 namespace {
457 490
458 class NoNavigationsObserver : public WebContentsObserver { 491 class NoNavigationsObserver : public WebContentsObserver {
459 public: 492 public:
460 // Observes navigation for the specified |web_contents|. 493 // Observes navigation for the specified |web_contents|.
461 explicit NoNavigationsObserver(WebContents* web_contents) 494 explicit NoNavigationsObserver(WebContents* web_contents)
462 : WebContentsObserver(web_contents) {} 495 : WebContentsObserver(web_contents) {}
463 496
464 private: 497 private:
465 void DidNavigateAnyFrame(RenderFrameHost* render_frame_host, 498 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 4121 // TODO(clamy): Check the post id as well when PlzNavigate handles it
4089 // properly. 4122 // properly.
4090 if (!IsBrowserSideNavigationEnabled()) 4123 if (!IsBrowserSideNavigationEnabled())
4091 EXPECT_NE(-1, frame_entry->post_id()); 4124 EXPECT_NE(-1, frame_entry->post_id());
4092 EXPECT_FALSE(entry->GetHasPostData()); 4125 EXPECT_FALSE(entry->GetHasPostData());
4093 EXPECT_EQ(-1, entry->GetPostID()); 4126 EXPECT_EQ(-1, entry->GetPostID());
4094 } 4127 }
4095 } 4128 }
4096 4129
4097 } // namespace content 4130 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/renderer/render_frame_impl.cc » ('j') | content/renderer/render_frame_impl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698