Commit 9b7d4a9a authored by Rakina Zata Amni's avatar Rakina Zata Amni Committed by Commit Bot

Update credential_manager_browsertest to handle same-site BrowsingInstance swap

With crrev.com/c/2121522, some main-frame same-site navigations will
result in a new BrowsingInstance, SiteInstance, RenderFrameHost,
RenderView, etc. This CL updates expectations of
credential_manager_browsertest that didn't expect a change of
RenderFrameHosts etc. on same-site navigations.

This CL does not include fixes for other tests in chrome/ content/,
components/, and layout tests (they're fixed in other CLs)

For more details, see doc: https://docs.google.com/document/d/1lHdkKLUe8H6ZP6ALwj-dsus7oYcuc93HkSCHCcerItg/edit?usp=sharing

Bug: 977562
Change-Id: Ic173f44e71305a76939aa25e1c856e7d4ce3956c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2212106Reviewed-by: default avatarVasilii Sukhanov <vasilii@chromium.org>
Commit-Queue: Rakina Zata Amni <rakina@chromium.org>
Cr-Commit-Position: refs/heads/master@{#771665}
parent c8bd5e0a
......@@ -132,10 +132,8 @@ class CredentialManagerBrowserTest : public PasswordManagerBrowserTestBase {
ASSERT_NO_FATAL_FAILURE(ScheduleNavigatorStoreCredentialAtUnload(
WebContents(), "user", "hunter2"));
// Trigger a same-site navigation carried out in the same RenderFrame.
content::RenderFrameHost* old_rfh = WebContents()->GetMainFrame();
// Trigger a same-site navigation.
ui_test_utils::NavigateToURL(browser(), a_url2);
ASSERT_EQ(old_rfh, WebContents()->GetMainFrame());
// Ensure that the old document no longer has a mojom::CredentialManager
// interface connection to the ContentCredentialManager, nor can it get one
......@@ -848,9 +846,7 @@ IN_PROC_BROWSER_TEST_F(CredentialManagerBrowserTest,
EXPECT_TRUE(client->was_store_ever_called());
// Trigger a same-site navigation.
content::RenderFrameHost* old_rfh = WebContents()->GetMainFrame();
ui_test_utils::NavigateToURL(browser(), a_url2);
ASSERT_EQ(old_rfh, WebContents()->GetMainFrame());
// Expect the Mojo connection closed.
EXPECT_FALSE(client->has_binding_for_credential_manager());
......@@ -864,7 +860,6 @@ IN_PROC_BROWSER_TEST_F(CredentialManagerBrowserTest,
// Same-document navigation. Call to get() succeeds.
ui_test_utils::NavigateToURL(browser(), a_url2_ref);
ASSERT_EQ(old_rfh, WebContents()->GetMainFrame());
EXPECT_TRUE(client->has_binding_for_credential_manager());
ASSERT_NO_FATAL_FAILURE(
TriggerNavigatorGetPasswordCredentialsAndExpectHasResult(WebContents(),
......
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