Commit 46d888c9 authored by Victor Hugo Vianna Silva's avatar Victor Hugo Vianna Silva Committed by Commit Bot

[b4p/sign-out] Reduce expectations of sign-out bubble integration test

This is a preparation to allow the user to choose which passwords to
save in the 'save unsynced credentials' bubble. To do so, we will
modify ManagePasswordsUIController::SaveUnsyncedCredentials() to take
the vector of credentials as a parameter.

BubbleObserver::AcceptSaveUnsyncedCredentialsPrompt() fakes the user
accepting the bubble in this integration test. If it is kept in the new
design, it would need to take the credentials as a parameter as well,
which renders some expectations in this test completely artificial.

So, after this CL, the test no longer verifies that accepting the bubble
stores the credentials in the profile store. Instead it only verifies
that the bubble is opened. The saving logic is still covered by unit
tests in ManagePasswordsUIController.

Bug: 1098672
Change-Id: I7a1d752b67934e31d968ac23475026fc0cdc4af8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2287315
Commit-Queue: Victor Vianna <victorvianna@google.com>
Reviewed-by: default avatarMarc Treib <treib@chromium.org>
Cr-Commit-Position: refs/heads/master@{#786276}
parent e0f5a1c0
......@@ -355,14 +355,6 @@ void BubbleObserver::AcceptSavePrompt() const {
EXPECT_FALSE(IsSavePromptAvailable());
}
void BubbleObserver::AcceptSaveUnsyncedCredentialsPrompt() const {
ASSERT_EQ(password_manager::ui::WILL_DELETE_UNSYNCED_ACCOUNT_PASSWORDS_STATE,
passwords_ui_controller_->GetState());
passwords_ui_controller_->SaveUnsyncedCredentialsInProfileStore();
EXPECT_NE(password_manager::ui::WILL_DELETE_UNSYNCED_ACCOUNT_PASSWORDS_STATE,
passwords_ui_controller_->GetState());
}
void BubbleObserver::AcceptUpdatePrompt() const {
ASSERT_TRUE(IsUpdatePromptAvailable());
passwords_ui_controller_->SavePassword(
......
......@@ -96,10 +96,6 @@ class BubbleObserver {
// checks that the prompt is no longer visible afterwards.
void AcceptUpdatePrompt() const;
// Expecting that the prompt is available, saves the unsynced credentials.
// At the end, checks that the prompt is no longer visible afterwards.
void AcceptSaveUnsyncedCredentialsPrompt() const;
// Returns once the account chooser pops up or it's already shown.
// |web_contents| must be the custom one returned by
// PasswordManagerBrowserTestBase.
......
......@@ -592,9 +592,8 @@ IN_PROC_BROWSER_TEST_F(PasswordManagerSyncTest,
MatchesLoginAndRealm("user", "pass", GetPSLOrigin())));
}
IN_PROC_BROWSER_TEST_F(
PasswordManagerSyncTest,
SaveInProfileStoreIfSaveButtonClickedInUnsyncedPasswordsBubble) {
IN_PROC_BROWSER_TEST_F(PasswordManagerSyncTest,
SignOutWithUnsyncedPasswordsOpensBubble) {
ASSERT_TRUE(SetupClients()) << "SetupClients() failed.";
content::WebContents* web_contents = nullptr;
GetNewTab(GetBrowser(0), &web_contents);
......@@ -616,15 +615,7 @@ IN_PROC_BROWSER_TEST_F(
ElementsAre(MatchesLogin("accountuser", "accountpass")));
SignOut();
// Fake user clicking the Save button in the UI.
bubble_observer.WaitForSaveUnsyncedCredentialsPrompt();
bubble_observer.AcceptSaveUnsyncedCredentialsPrompt();
std::vector<std::unique_ptr<autofill::PasswordForm>> profile_credentials =
GetAllLoginsFromProfilePasswordStore();
EXPECT_THAT(profile_credentials,
ElementsAre(MatchesLogin("accountuser", "accountpass")));
}
IN_PROC_BROWSER_TEST_F(PasswordManagerSyncTest,
......
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