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

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

Issue 2870013003: [autofill] Avoid duplicate instances of the SaveCardBubble. (Closed)
Patch Set: 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 a1121ec0e70d10582419f630e2881d96d927e139..f609b1cbcd382080bd00c332ae54433710a36d69 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
@@ -401,4 +401,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