Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7440)

Unified Diff: chrome/browser/ui/autofill/save_card_bubble_controller_impl_unittest.cc

Issue 2862933002: [autofill] Avoid duplicate instances of the SaveCardBubble. (Closed)
Patch Set: fix typo Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/autofill/save_card_bubble_controller_impl.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/autofill/save_card_bubble_controller_impl_unittest.cc
diff --git a/chrome/browser/ui/autofill/save_card_bubble_controller_impl_unittest.cc b/chrome/browser/ui/autofill/save_card_bubble_controller_impl_unittest.cc
index c149d8c56566ad33e083884a56639272645a41e3..34c55bf1efb38d2236f9b7e06e9b58713bb5d1b6 100644
--- a/chrome/browser/ui/autofill/save_card_bubble_controller_impl_unittest.cc
+++ b/chrome/browser/ui/autofill/save_card_bubble_controller_impl_unittest.cc
@@ -467,4 +467,60 @@ TEST_F(SaveCardBubbleControllerImplTest,
1)));
}
+TEST_F(SaveCardBubbleControllerImplTest, OnlyOneActiveBubble_RepeatedLocal) {
+ base::HistogramTester histogram_tester;
+ ShowLocalBubble();
+ ShowLocalBubble();
+ ShowLocalBubble();
+ EXPECT_THAT(
+ histogram_tester.GetAllSamples(
+ "Autofill.SaveCreditCardPrompt.Local.FirstShow"),
+ ElementsAre(Bucket(AutofillMetrics::SAVE_CARD_PROMPT_SHOW_REQUESTED, 1),
+ Bucket(AutofillMetrics::SAVE_CARD_PROMPT_SHOWN, 1)));
+}
+
+TEST_F(SaveCardBubbleControllerImplTest, OnlyOneActiveBubble_RepeatedUpload) {
+ base::HistogramTester histogram_tester;
+ ShowUploadBubble();
+ ShowUploadBubble();
+ ShowUploadBubble();
+ EXPECT_THAT(
+ histogram_tester.GetAllSamples(
+ "Autofill.SaveCreditCardPrompt.Upload.FirstShow"),
+ ElementsAre(Bucket(AutofillMetrics::SAVE_CARD_PROMPT_SHOW_REQUESTED, 1),
+ Bucket(AutofillMetrics::SAVE_CARD_PROMPT_SHOWN, 1)));
+}
+
+TEST_F(SaveCardBubbleControllerImplTest, OnlyOneActiveBubble_LocalThenUpload) {
+ base::HistogramTester histogram_tester;
+ ShowLocalBubble();
+ ShowUploadBubble();
+ ShowUploadBubble();
+ EXPECT_THAT(
+ histogram_tester.GetAllSamples(
+ "Autofill.SaveCreditCardPrompt.Local.FirstShow"),
+ ElementsAre(Bucket(AutofillMetrics::SAVE_CARD_PROMPT_SHOW_REQUESTED, 1),
+ Bucket(AutofillMetrics::SAVE_CARD_PROMPT_SHOWN, 1)));
+ EXPECT_TRUE(
+ histogram_tester
+ .GetAllSamples("Autofill.SaveCreditCardPrompt.Upload.FirstShow")
+ .empty());
+}
+
+TEST_F(SaveCardBubbleControllerImplTest, OnlyOneActiveBubble_UploadThenLocal) {
+ base::HistogramTester histogram_tester;
+ ShowUploadBubble();
+ ShowLocalBubble();
+ ShowLocalBubble();
+ EXPECT_THAT(
+ histogram_tester.GetAllSamples(
+ "Autofill.SaveCreditCardPrompt.Upload.FirstShow"),
+ ElementsAre(Bucket(AutofillMetrics::SAVE_CARD_PROMPT_SHOW_REQUESTED, 1),
+ Bucket(AutofillMetrics::SAVE_CARD_PROMPT_SHOWN, 1)));
+ EXPECT_TRUE(
+ histogram_tester
+ .GetAllSamples("Autofill.SaveCreditCardPrompt.Local.FirstShow")
+ .empty());
+}
+
} // namespace autofill
« no previous file with comments | « chrome/browser/ui/autofill/save_card_bubble_controller_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698