Commit 9437ed47 authored by Ryan Sturm's avatar Ryan Sturm Committed by Commit Bot

Matching PLM behavior in the infobar expiration logic

PLM tracks pages as new page main frame navigations, the page load
capping infobar should match this behavior exactly to keep consistency
between the two approaches. This may allow better understanding of what
a page load actually is when the infobar is showing.

Bug: 850988
Change-Id: I339f9000088731d807b4db973220c805cf4d3e3b
Reviewed-on: https://chromium-review.googlesource.com/1093191
Commit-Queue: Ryan Sturm <ryansturm@chromium.org>
Reviewed-by: default avatarTarun Bansal <tbansal@chromium.org>
Cr-Commit-Position: refs/heads/master@{#565725}
parent ebc921ca
......@@ -356,3 +356,31 @@ IN_PROC_BROWSER_TEST_F(PageLoadCappingBrowserTest,
https_test_server_.reset();
}
IN_PROC_BROWSER_TEST_F(PageLoadCappingBrowserTest,
PageLoadCappingInfobarShownAfterSamePageNavigation) {
https_test_server_->RegisterRequestHandler(base::BindRepeating(
&PageLoadCappingBrowserTest::HandleRequest, base::Unretained(this)));
https_test_server_->ServeFilesFromSourceDirectory(base::FilePath(kDocRoot));
ASSERT_TRUE(https_test_server_->Start());
content::WebContents* contents =
browser()->tab_strip_model()->GetActiveWebContents();
// Load a page.
ui_test_utils::NavigateToURL(
browser(), https_test_server_->GetURL("/page_capping.html"));
ASSERT_EQ(1u, InfoBarService::FromWebContents(contents)->infobar_count());
infobars::InfoBar* infobar =
InfoBarService::FromWebContents(contents)->infobar_at(0);
// Navigate on the page to an anchor.
ui_test_utils::NavigateToURL(
browser(), https_test_server_->GetURL("/page_capping.html#anchor"));
EXPECT_EQ(1u, InfoBarService::FromWebContents(contents)->infobar_count());
EXPECT_EQ(infobar, InfoBarService::FromWebContents(contents)->infobar_at(0));
https_test_server_.reset();
}
......@@ -137,7 +137,7 @@ int PageLoadCappingInfoBarDelegate::GetIconId() const {
bool PageLoadCappingInfoBarDelegate::ShouldExpire(
const NavigationDetails& details) const {
return true;
return details.is_navigation_to_different_page;
}
int PageLoadCappingInfoBarDelegate::GetButtons() const {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment