Commit f5932b96 authored by Siyu An's avatar Siyu An Committed by Commit Bot

[Autofill BugFix] Fix flakiness in save card bubble browsertests

In browsertests we don't wait for the bubble to be actually shown
before verifying the view. Fix it by having the tests wait for extra
events.

Bug: 1133332
Change-Id: I898ae939a7b604dff6d170d54d136566ad34799f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2464025
Commit-Queue: Siyu An <siyua@chromium.org>
Reviewed-by: default avatarChristoph Schwering <schwering@google.com>
Reviewed-by: default avatarVasilii Sukhanov <vasilii@chromium.org>
Reviewed-by: default avatarJared Saul <jsaul@google.com>
Cr-Commit-Position: refs/heads/master@{#816629}
parent 1378e492
......@@ -575,9 +575,6 @@ void SaveCardBubbleControllerImpl::OnBubbleClosed(
}
UpdateSaveCardIcon();
if (observer_for_testing_)
observer_for_testing_->OnBubbleClosed();
}
const LegalMessageLines& SaveCardBubbleControllerImpl::GetLegalMessageLines()
......@@ -866,6 +863,9 @@ void SaveCardBubbleControllerImpl::ShowIconOnly() {
case BubbleType::INACTIVE:
NOTREACHED();
}
if (observer_for_testing_)
observer_for_testing_->OnIconShown();
}
void SaveCardBubbleControllerImpl::UpdateSaveCardIcon() {
......
......@@ -39,7 +39,7 @@ class SaveCardBubbleControllerImpl
class ObserverForTest {
public:
virtual void OnBubbleShown() = 0;
virtual void OnBubbleClosed() = 0;
virtual void OnIconShown() = 0;
};
~SaveCardBubbleControllerImpl() override;
......
......@@ -486,6 +486,8 @@ void CreditCardSaveManager::OfferCardUploadSave() {
// should not display the offer-to-save infobar at all.
if (!is_mobile_build || show_save_prompt_.value_or(true)) {
user_did_accept_upload_prompt_ = false;
if (observer_for_testing_)
observer_for_testing_->OnOfferUploadSave();
client_->ConfirmSaveCreditCardToCloud(
upload_request_.card, legal_message_lines_,
AutofillClient::SaveCreditCardOptions()
......
......@@ -84,6 +84,7 @@ class CreditCardSaveManager {
public:
virtual ~ObserverForTest() {}
virtual void OnOfferLocalSave() {}
virtual void OnOfferUploadSave() {}
virtual void OnDecideToRequestUploadSave() {}
virtual void OnReceivedGetUploadDetailsResponse() {}
virtual void OnSentUploadCardRequest() {}
......
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