Commit 5dc8b4e0 authored by Lukasz Anforowicz's avatar Lukasz Anforowicz Committed by Commit Bot

Speculatively reenable AllowTargetedNavigationsAfterSwap test.

This CL adds extra logging to NavigateToURLInSameBrowsingInstance that
was blamed for the first failed test assertion in the log stored in
https://crbug.com/859487#c3.

This CL doesn't contain any actual fix for the flakiness, but reenables
the test anyway, because
1) the test passed 50 times when run locally
2) hopefully the extra logging will help diagnose the flakiness if the
   test starts flaking again on the bots

Fixed: 859487
Change-Id: I90caf66b0ffbbd341a5c8cd00a5605d509aa31d9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2390998
Commit-Queue: Łukasz Anforowicz <lukasza@chromium.org>
Reviewed-by: default avatarAlex Moshchuk <alexmos@chromium.org>
Cr-Commit-Position: refs/heads/master@{#804327}
parent 375559a6
......@@ -750,11 +750,15 @@ IN_PROC_BROWSER_TEST_P(RenderFrameHostManagerTest,
// Test for crbug.com/116192. Targeted links should still work after the
// named target window has swapped processes.
// Disabled Flaky test - crbug.com/859487
IN_PROC_BROWSER_TEST_P(RenderFrameHostManagerTest,
DISABLED_AllowTargetedNavigationsAfterSwap) {
AllowTargetedNavigationsAfterSwap) {
StartEmbeddedServer();
// Ensure that the first and second page are isolated from each other (even on
// Android, where site-per-process is not the default).
IsolateOriginsForTesting(embedded_test_server(), shell()->web_contents(),
{"foo.com"});
// Load a page with links that open in a new window.
NavigateToPageWithLinks(shell());
......@@ -765,12 +769,7 @@ IN_PROC_BROWSER_TEST_P(RenderFrameHostManagerTest,
// Test clicking a target=foo link.
ShellAddedObserver new_shell_observer;
bool success = false;
EXPECT_TRUE(ExecuteScriptAndExtractBool(
shell(),
"window.domAutomationController.send(clickSameSiteTargetedLink());",
&success));
EXPECT_TRUE(success);
EXPECT_EQ(true, EvalJs(shell(), "clickSameSiteTargetedLink()"));
Shell* new_shell = new_shell_observer.GetShell();
// Wait for the navigation in the new tab to finish, if it hasn't.
......@@ -792,13 +791,11 @@ IN_PROC_BROWSER_TEST_P(RenderFrameHostManagerTest,
EXPECT_NE(orig_site_instance, new_site_instance);
// Clicking the original link in the first tab should cause us to swap back.
TestNavigationObserver navigation_observer(new_shell->web_contents());
EXPECT_TRUE(ExecuteScriptAndExtractBool(
shell(),
"window.domAutomationController.send(clickSameSiteTargetedLink());",
&success));
EXPECT_TRUE(success);
navigation_observer.Wait();
{
TestNavigationObserver navigation_observer(new_shell->web_contents());
EXPECT_EQ(true, EvalJs(shell(), "clickSameSiteTargetedLink()"));
navigation_observer.Wait();
}
// Should have swapped back and shown the new window again.
scoped_refptr<SiteInstance> revisit_site_instance(
......@@ -811,10 +808,7 @@ IN_PROC_BROWSER_TEST_P(RenderFrameHostManagerTest,
EXPECT_EQ(new_site_instance.get(),
new_shell->web_contents()->GetSiteInstance());
WebContentsDestroyedWatcher close_watcher(new_shell->web_contents());
EXPECT_TRUE(ExecuteScriptAndExtractBool(
shell(), "window.domAutomationController.send(testCloseWindow());",
&success));
EXPECT_TRUE(success);
EXPECT_EQ(true, EvalJs(shell(), "testCloseWindow()"));
close_watcher.Wait();
}
......
......@@ -85,9 +85,23 @@ bool NavigateToURLInSameBrowsingInstance(Shell* window, const GURL& url) {
ui::PageTransitionFromInt(ui::PAGE_TRANSITION_LINK));
observer.Wait();
if (!IsLastCommittedEntryOfPageType(window->web_contents(), PAGE_TYPE_NORMAL))
if (!IsLastCommittedEntryOfPageType(window->web_contents(),
PAGE_TYPE_NORMAL)) {
NavigationEntry* last_entry =
window->web_contents()->GetController().GetLastCommittedEntry();
DLOG(WARNING) << "last_entry->GetPageType() = "
<< (last_entry ? last_entry->GetPageType() : -1);
return false;
return window->web_contents()->GetLastCommittedURL() == url;
}
if (window->web_contents()->GetLastCommittedURL() != url) {
DLOG(WARNING) << "window->web_contents()->GetLastCommittedURL() = "
<< window->web_contents()->GetLastCommittedURL()
<< "; url = " << url;
return false;
}
return true;
}
FrameTreeVisualizer::FrameTreeVisualizer() {
......
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