Commit 24c124f3 authored by Dmitry Titov's avatar Dmitry Titov Committed by Commit Bot

Revert "Add StrikeDatabase browsertests"

This reverts commit dc7a451a.

Reason for revert: Broke tests on Mac (at least): https://ci.chromium.org/p/chromium/builders/luci.chromium.ci/Mac10.12%20Tests/16499

Broken test output: https://logs.chromium.org/logs/chromium/buildbucket/cr-buildbucket.appspot.com/8930653299367123984/+/steps/network_service_browser_tests_on_Intel_GPU_on_Mac_on_Mac-10.12.6/0/logs/SaveCardBubbleViewsFullFormBrowserTest.StrikeDatabase_Upload_AddStrikeIfSaveFails/0


Original change's description:
> Add StrikeDatabase browsertests
> 
> The tests in this CL have been landed and reverted a couple of times;
> they work, but end up being a little flaky on Win7. We've had a hard
> time getting a reproducible setup, and the Chrome testing team have
> verified our feature works as intended, so for the time being we're
> marking the tests as flaky on Windows and will follow up.
> 
> (Sheriffs: If somehow the landing of this CL causes additional
> flakes, feel free to revert. Flake analysis hasn't shown anything
> outside of Win7.)
> 
> Bug: 884817
> Change-Id: Iec545cb861bfc1aa3d50746c3a413257c9a9ec82
> Reviewed-on: https://chromium-review.googlesource.com/c/1316666
> Commit-Queue: Jared Saul <jsaul@google.com>
> Reviewed-by: Evan Stade <estade@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#605507}

TBR=estade@chromium.org,jsaul@google.com

Change-Id: I1e408b6395c80c425d982544bfdd88e01231db7b
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 884817
Reviewed-on: https://chromium-review.googlesource.com/c/1319190Reviewed-by: default avatarDmitry Titov <dimich@chromium.org>
Commit-Queue: Dmitry Titov <dimich@chromium.org>
Cr-Commit-Position: refs/heads/master@{#605579}
parent 01433742
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
#include "base/test/metrics/histogram_tester.h" #include "base/test/metrics/histogram_tester.h"
#include "base/test/metrics/user_action_tester.h" #include "base/test/metrics/user_action_tester.h"
#include "build/build_config.h"
#include "chrome/browser/ui/autofill/popup_constants.h" #include "chrome/browser/ui/autofill/popup_constants.h"
#include "chrome/browser/ui/autofill/save_card_bubble_controller_impl.h" #include "chrome/browser/ui/autofill/save_card_bubble_controller_impl.h"
#include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser.h"
...@@ -1234,414 +1233,4 @@ IN_PROC_BROWSER_TEST_F( ...@@ -1234,414 +1233,4 @@ IN_PROC_BROWSER_TEST_F(
histogram_tester.ExpectTotalCount("Autofill.UploadAcceptedCardOrigin", 0); histogram_tester.ExpectTotalCount("Autofill.UploadAcceptedCardOrigin", 0);
} }
// Tests StrikeDatabase interaction with the local save bubble. Ensures that no
// strikes are added if the feature flag is disabled.
IN_PROC_BROWSER_TEST_F(SaveCardBubbleViewsFullFormBrowserTest,
StrikeDatabase_Local_StrikeNotAddedIfExperimentFlagOff) {
scoped_feature_list_.InitAndDisableFeature(
features::kAutofillSaveCreditCardUsesStrikeSystem);
TestAutofillClock test_clock;
test_clock.SetNow(base::Time::Now());
// Set up the Payments RPC.
SetUploadDetailsRpcPaymentsDeclines();
// Submitting the form and having Payments decline offering to save should
// show the local save bubble.
// (Must wait for response from Payments before accessing the controller.)
ResetEventWaiterForSequence(
{DialogEvent::REQUESTED_UPLOAD_SAVE,
DialogEvent::RECEIVED_GET_UPLOAD_DETAILS_RESPONSE,
DialogEvent::OFFERED_LOCAL_SAVE});
FillAndSubmitForm();
WaitForObservedEvent();
EXPECT_TRUE(
FindViewInBubbleById(DialogViewId::MAIN_CONTENT_VIEW_LOCAL)->visible());
// Clicking the [X] close button should dismiss the bubble.
ClickOnCloseButton();
base::HistogramTester histogram_tester;
// Wait long enough to avoid bubble stickiness, then navigate away from the
// page.
test_clock.Advance(kCardBubbleSurviveNavigationTime);
ReturnToInitialPage();
// Ensure that no strike was added because the feature is disabled.
histogram_tester.ExpectTotalCount(
"Autofill.StrikeDatabase.NthStrikeAdded.CreditCardSave", 0);
}
// Tests StrikeDatabase interaction with the upload save bubble. Ensures that no
// strikes are added if the feature flag is disabled.
IN_PROC_BROWSER_TEST_F(
SaveCardBubbleViewsFullFormBrowserTest,
StrikeDatabase_Upload_StrikeNotAddedIfExperimentFlagOff) {
scoped_feature_list_.InitAndDisableFeature(
features::kAutofillSaveCreditCardUsesStrikeSystem);
TestAutofillClock test_clock;
test_clock.SetNow(base::Time::Now());
// Set up the Payments RPC.
SetUploadDetailsRpcPaymentsAccepts();
// Submitting the form should show the upload save bubble and legal footer.
// (Must wait for response from Payments before accessing the controller.)
ResetEventWaiterForSequence(
{DialogEvent::REQUESTED_UPLOAD_SAVE,
DialogEvent::RECEIVED_GET_UPLOAD_DETAILS_RESPONSE});
FillAndSubmitForm();
WaitForObservedEvent();
EXPECT_TRUE(
FindViewInBubbleById(DialogViewId::MAIN_CONTENT_VIEW_UPLOAD)->visible());
EXPECT_TRUE(FindViewInBubbleById(DialogViewId::FOOTNOTE_VIEW)->visible());
// Clicking the [X] close button should dismiss the bubble.
ClickOnCloseButton();
base::HistogramTester histogram_tester;
// Wait long enough to avoid bubble stickiness, then navigate away from the
// page.
test_clock.Advance(kCardBubbleSurviveNavigationTime);
ReturnToInitialPage();
// Ensure that no strike was added because the feature is disabled.
histogram_tester.ExpectTotalCount(
"Autofill.StrikeDatabase.NthStrikeAdded.CreditCardSave", 0);
}
// These tests pass trybots, but end up flaky on Win 7. http://crbug.com/901527
#if defined(OS_WIN)
#define MAYBE(x) DISABLED_##x
#else
#define MAYBE(x) x
#endif
// TODO(jsaul): With the fate of the [No thanks] button currently non-existent,
// there's no way to test that bubble dismissal will add a strike.
// If the [No thanks] button makes a return (seems possible), add a
// matching test for that scenario.
// Tests StrikeDatabase interaction with the local save bubble. Ensures that a
// strike is added if the bubble is ignored.
IN_PROC_BROWSER_TEST_F(SaveCardBubbleViewsFullFormBrowserTest,
MAYBE(StrikeDatabase_Local_AddStrikeIfBubbleIgnored)) {
scoped_feature_list_.InitAndEnableFeature(
features::kAutofillSaveCreditCardUsesStrikeSystem);
TestAutofillClock test_clock;
test_clock.SetNow(base::Time::Now());
// Set up the Payments RPC.
SetUploadDetailsRpcPaymentsDeclines();
// Submitting the form and having Payments decline offering to save should
// show the local save bubble.
// (Must wait for response from Payments before accessing the controller.)
ResetEventWaiterForSequence(
{DialogEvent::REQUESTED_UPLOAD_SAVE,
DialogEvent::RECEIVED_GET_UPLOAD_DETAILS_RESPONSE,
DialogEvent::OFFERED_LOCAL_SAVE});
FillAndSubmitForm();
WaitForObservedEvent();
EXPECT_TRUE(
FindViewInBubbleById(DialogViewId::MAIN_CONTENT_VIEW_LOCAL)->visible());
// Clicking the [X] close button should dismiss the bubble.
ClickOnCloseButton();
// Add an event observer to the controller to detect strike changes.
AddEventObserverToController();
base::HistogramTester histogram_tester;
// Wait long enough to avoid bubble stickiness, then navigate away from the
// page.
test_clock.Advance(kCardBubbleSurviveNavigationTime);
ResetEventWaiterForSequence({DialogEvent::STRIKE_CHANGE_COMPLETE});
ReturnToInitialPage();
WaitForObservedEvent();
// Ensure that a strike was added due to the bubble being ignored.
histogram_tester.ExpectUniqueSample(
"Autofill.StrikeDatabase.NthStrikeAdded.CreditCardSave",
/*sample=*/1, /*count=*/1);
}
// Tests StrikeDatabase interaction with the upload save bubble. Ensures that a
// strike is added if the bubble is ignored.
IN_PROC_BROWSER_TEST_F(SaveCardBubbleViewsFullFormBrowserTest,
MAYBE(StrikeDatabase_Upload_AddStrikeIfBubbleIgnored)) {
scoped_feature_list_.InitAndEnableFeature(
features::kAutofillSaveCreditCardUsesStrikeSystem);
TestAutofillClock test_clock;
test_clock.SetNow(base::Time::Now());
// Set up the Payments RPC.
SetUploadDetailsRpcPaymentsAccepts();
// Submitting the form should show the upload save bubble and legal footer.
// (Must wait for response from Payments before accessing the controller.)
ResetEventWaiterForSequence(
{DialogEvent::REQUESTED_UPLOAD_SAVE,
DialogEvent::RECEIVED_GET_UPLOAD_DETAILS_RESPONSE});
FillAndSubmitForm();
WaitForObservedEvent();
EXPECT_TRUE(
FindViewInBubbleById(DialogViewId::MAIN_CONTENT_VIEW_UPLOAD)->visible());
EXPECT_TRUE(FindViewInBubbleById(DialogViewId::FOOTNOTE_VIEW)->visible());
// Clicking the [X] close button should dismiss the bubble.
ClickOnCloseButton();
// Add an event observer to the controller to detect strike changes.
AddEventObserverToController();
base::HistogramTester histogram_tester;
// Wait long enough to avoid bubble stickiness, then navigate away from the
// page.
test_clock.Advance(kCardBubbleSurviveNavigationTime);
ResetEventWaiterForSequence({DialogEvent::STRIKE_CHANGE_COMPLETE});
ReturnToInitialPage();
WaitForObservedEvent();
// Ensure that a strike was added due to the bubble being ignored.
histogram_tester.ExpectUniqueSample(
"Autofill.StrikeDatabase.NthStrikeAdded.CreditCardSave",
/*sample=*/1, /*count=*/1);
}
// Tests StrikeDatabase interaction with the upload save bubble. Ensures that a
// strike is added if card upload to Google Payments fails.
IN_PROC_BROWSER_TEST_F(SaveCardBubbleViewsFullFormBrowserTest,
MAYBE(StrikeDatabase_Upload_AddStrikeIfSaveFails)) {
scoped_feature_list_.InitAndEnableFeature(
features::kAutofillSaveCreditCardUsesStrikeSystem);
TestAutofillClock test_clock;
test_clock.SetNow(base::Time::Now());
// Set up the Payments RPCs.
SetUploadDetailsRpcPaymentsAccepts();
SetUploadCardRpcPaymentsFails();
// Submitting the form should show the upload save bubble and legal footer.
// (Must wait for response from Payments before accessing the controller.)
ResetEventWaiterForSequence(
{DialogEvent::REQUESTED_UPLOAD_SAVE,
DialogEvent::RECEIVED_GET_UPLOAD_DETAILS_RESPONSE});
FillAndSubmitForm();
WaitForObservedEvent();
EXPECT_TRUE(
FindViewInBubbleById(DialogViewId::MAIN_CONTENT_VIEW_UPLOAD)->visible());
EXPECT_TRUE(FindViewInBubbleById(DialogViewId::FOOTNOTE_VIEW)->visible());
// Clicking [Save] should accept and close it, then send an UploadCardRequest
// to Google Payments.
ResetEventWaiterForSequence({DialogEvent::SENT_UPLOAD_CARD_REQUEST,
DialogEvent::RECEIVED_UPLOAD_CARD_RESPONSE,
DialogEvent::STRIKE_CHANGE_COMPLETE});
base::HistogramTester histogram_tester;
ClickOnDialogViewWithIdAndWait(DialogViewId::OK_BUTTON);
// Wait long enough to avoid bubble stickiness, then navigate away from the
// page. Ensures that navigation does not create an additional strike.
test_clock.Advance(kCardBubbleSurviveNavigationTime);
ReturnToInitialPage();
// Ensure that a strike was added due to the upload card request failing.
histogram_tester.ExpectUniqueSample(
"Autofill.StrikeDatabase.NthStrikeAdded.CreditCardSave",
/*sample=*/1, /*count=*/1);
}
// TODO(crbug.com/884817): There's a lot of duplicate code in the tests that
// follow. Investigate refactoring; perhaps these could
// all be reduced to single tests with a local vs.
// upload boolean for branching logic.
// Tests overall StrikeDatabase interaction with the local save bubble. Runs an
// example of ignoring the prompt three times and ensuring that the
// offer-to-save bubble does not appear on the fourth try. Then, ensures that no
// strikes are added if the card already has max strikes.
IN_PROC_BROWSER_TEST_F(SaveCardBubbleViewsFullFormBrowserTest,
MAYBE(StrikeDatabase_Local_FullFlowTest)) {
scoped_feature_list_.InitAndEnableFeature(
features::kAutofillSaveCreditCardUsesStrikeSystem);
TestAutofillClock test_clock;
test_clock.SetNow(base::Time::Now());
bool controller_observer_set = false;
// Set up the Payments RPC.
SetUploadDetailsRpcPaymentsDeclines();
// Show and ignore the bubble kMaxStrikesToPreventPoppingUpOfferToSavePrompt
// times in order to accrue maximum strikes.
for (int i = 0; i < kMaxStrikesToPreventPoppingUpOfferToSavePrompt; i++) {
// Submitting the form and having Payments decline offering to save should
// show the local save bubble.
// (Must wait for response from Payments before accessing the controller.)
ResetEventWaiterForSequence(
{DialogEvent::REQUESTED_UPLOAD_SAVE,
DialogEvent::RECEIVED_GET_UPLOAD_DETAILS_RESPONSE,
DialogEvent::OFFERED_LOCAL_SAVE});
FillAndSubmitForm();
WaitForObservedEvent();
EXPECT_TRUE(
FindViewInBubbleById(DialogViewId::MAIN_CONTENT_VIEW_LOCAL)->visible());
if (!controller_observer_set) {
// Add an event observer to the controller.
AddEventObserverToController();
ReduceAnimationTime();
controller_observer_set = true;
}
// Clicking the [X] close button should dismiss the bubble.
ClickOnCloseButton();
base::HistogramTester histogram_tester;
// Wait long enough to avoid bubble stickiness, then navigate away from the
// page.
test_clock.Advance(kCardBubbleSurviveNavigationTime);
ResetEventWaiterForSequence({DialogEvent::STRIKE_CHANGE_COMPLETE});
ReturnToInitialPage();
WaitForObservedEvent();
// Ensure that a strike was added due to the bubble being ignored.
// The sample logged is the Nth strike added, or (i+1).
histogram_tester.ExpectUniqueSample(
"Autofill.StrikeDatabase.NthStrikeAdded.CreditCardSave",
/*sample=*/(i + 1), /*count=*/1);
}
// Submit the form a fourth time. Since the card now has maximum strikes (3),
// the icon should be shown but the bubble should not.
ResetEventWaiterForSequence(
{DialogEvent::REQUESTED_UPLOAD_SAVE,
DialogEvent::RECEIVED_GET_UPLOAD_DETAILS_RESPONSE,
DialogEvent::OFFERED_LOCAL_SAVE});
FillAndSubmitForm();
WaitForObservedEvent();
EXPECT_TRUE(GetSaveCardIconView()->visible());
EXPECT_FALSE(GetSaveCardBubbleViews());
// Click the icon to show the bubble.
ResetEventWaiterForSequence({DialogEvent::BUBBLE_SHOWN});
ClickOnView(GetSaveCardIconView());
WaitForObservedEvent();
EXPECT_TRUE(
FindViewInBubbleById(DialogViewId::MAIN_CONTENT_VIEW_LOCAL)->visible());
// Clicking the [X] close button should dismiss the bubble.
ClickOnCloseButton();
base::HistogramTester histogram_tester;
// Wait long enough to avoid bubble stickiness, then navigate away from the
// page.
test_clock.Advance(kCardBubbleSurviveNavigationTime);
ReturnToInitialPage();
// Ensure that no strike was added because the card already had max strikes.
histogram_tester.ExpectTotalCount(
"Autofill.StrikeDatabase.NthStrikeAdded.CreditCardSave", 0);
}
// Tests overall StrikeDatabase interaction with the upload save bubble. Runs an
// example of ignoring the prompt three times and ensuring that the
// offer-to-save bubble does not appear on the fourth try. Then, ensures that no
// strikes are added if the card already has max strikes.
IN_PROC_BROWSER_TEST_F(SaveCardBubbleViewsFullFormBrowserTest,
MAYBE(StrikeDatabase_Upload_FullFlowTest)) {
scoped_feature_list_.InitAndEnableFeature(
features::kAutofillSaveCreditCardUsesStrikeSystem);
TestAutofillClock test_clock;
test_clock.SetNow(base::Time::Now());
bool controller_observer_set = false;
// Set up the Payments RPC.
SetUploadDetailsRpcPaymentsAccepts();
// Show and ignore the bubble kMaxStrikesToPreventPoppingUpOfferToSavePrompt
// times in order to accrue maximum strikes.
for (int i = 0; i < kMaxStrikesToPreventPoppingUpOfferToSavePrompt; i++) {
// Submitting the form should show the upload save bubble and legal footer.
// (Must wait for response from Payments before accessing the controller.)
ResetEventWaiterForSequence(
{DialogEvent::REQUESTED_UPLOAD_SAVE,
DialogEvent::RECEIVED_GET_UPLOAD_DETAILS_RESPONSE});
FillAndSubmitForm();
WaitForObservedEvent();
EXPECT_TRUE(FindViewInBubbleById(DialogViewId::MAIN_CONTENT_VIEW_UPLOAD)
->visible());
EXPECT_TRUE(FindViewInBubbleById(DialogViewId::FOOTNOTE_VIEW)->visible());
if (!controller_observer_set) {
// Add an event observer to the controller.
AddEventObserverToController();
ReduceAnimationTime();
controller_observer_set = true;
}
// Clicking the [X] close button should dismiss the bubble.
ClickOnCloseButton();
base::HistogramTester histogram_tester;
// Wait long enough to avoid bubble stickiness, then navigate away from the
// page.
test_clock.Advance(kCardBubbleSurviveNavigationTime);
ResetEventWaiterForSequence({DialogEvent::STRIKE_CHANGE_COMPLETE});
ReturnToInitialPage();
WaitForObservedEvent();
// Ensure that a strike was added due to the bubble being ignored.
// The sample logged is the Nth strike added, or (i+1).
histogram_tester.ExpectUniqueSample(
"Autofill.StrikeDatabase.NthStrikeAdded.CreditCardSave",
/*sample=*/(i + 1), /*count=*/1);
}
// Submit the form a fourth time. Since the card now has maximum strikes (3),
// the icon should be shown but the bubble should not.
ResetEventWaiterForSequence(
{DialogEvent::REQUESTED_UPLOAD_SAVE,
DialogEvent::RECEIVED_GET_UPLOAD_DETAILS_RESPONSE});
FillAndSubmitForm();
WaitForObservedEvent();
EXPECT_TRUE(GetSaveCardIconView()->visible());
EXPECT_FALSE(GetSaveCardBubbleViews());
// Click the icon to show the bubble.
ResetEventWaiterForSequence({DialogEvent::BUBBLE_SHOWN});
ClickOnView(GetSaveCardIconView());
WaitForObservedEvent();
EXPECT_TRUE(
FindViewInBubbleById(DialogViewId::MAIN_CONTENT_VIEW_UPLOAD)->visible());
EXPECT_TRUE(FindViewInBubbleById(DialogViewId::FOOTNOTE_VIEW)->visible());
// Clicking the [X] close button should dismiss the bubble.
ClickOnCloseButton();
base::HistogramTester histogram_tester;
// Wait long enough to avoid bubble stickiness, then navigate away from the
// page.
test_clock.Advance(kCardBubbleSurviveNavigationTime);
ReturnToInitialPage();
// Ensure that no strike was added because the card already had max strikes.
histogram_tester.ExpectTotalCount(
"Autofill.StrikeDatabase.NthStrikeAdded.CreditCardSave", 0);
}
} // namespace autofill } // namespace autofill
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