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

Side by Side 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/autofill/save_card_bubble_controller_impl.h" 5 #include "chrome/browser/ui/autofill/save_card_bubble_controller_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/json/json_reader.h" 10 #include "base/json/json_reader.h"
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 394
395 EXPECT_THAT( 395 EXPECT_THAT(
396 histogram_tester.GetAllSamples( 396 histogram_tester.GetAllSamples(
397 "Autofill.SaveCreditCardPrompt.Upload.FirstShow"), 397 "Autofill.SaveCreditCardPrompt.Upload.FirstShow"),
398 ElementsAre( 398 ElementsAre(
399 Bucket(AutofillMetrics::SAVE_CARD_PROMPT_SHOW_REQUESTED, 1), 399 Bucket(AutofillMetrics::SAVE_CARD_PROMPT_SHOW_REQUESTED, 1),
400 Bucket(AutofillMetrics::SAVE_CARD_PROMPT_END_INVALID_LEGAL_MESSAGE, 400 Bucket(AutofillMetrics::SAVE_CARD_PROMPT_END_INVALID_LEGAL_MESSAGE,
401 1))); 401 1)));
402 } 402 }
403 403
404 TEST_F(SaveCardBubbleControllerImplTest, OnlyOneActiveBubble_RepeatedLocal) {
405 base::HistogramTester histogram_tester;
406 ShowLocalBubble();
407 ShowLocalBubble();
408 ShowLocalBubble();
409 EXPECT_THAT(
410 histogram_tester.GetAllSamples(
411 "Autofill.SaveCreditCardPrompt.Local.FirstShow"),
412 ElementsAre(Bucket(AutofillMetrics::SAVE_CARD_PROMPT_SHOW_REQUESTED, 1),
413 Bucket(AutofillMetrics::SAVE_CARD_PROMPT_SHOWN, 1)));
414 }
415
416 TEST_F(SaveCardBubbleControllerImplTest, OnlyOneActiveBubble_RepeatedUpload) {
417 base::HistogramTester histogram_tester;
418 ShowUploadBubble();
419 ShowUploadBubble();
420 ShowUploadBubble();
421 EXPECT_THAT(
422 histogram_tester.GetAllSamples(
423 "Autofill.SaveCreditCardPrompt.Upload.FirstShow"),
424 ElementsAre(Bucket(AutofillMetrics::SAVE_CARD_PROMPT_SHOW_REQUESTED, 1),
425 Bucket(AutofillMetrics::SAVE_CARD_PROMPT_SHOWN, 1)));
426 }
427
428 TEST_F(SaveCardBubbleControllerImplTest, OnlyOneActiveBubble_LocalThenUpload) {
429 base::HistogramTester histogram_tester;
430 ShowLocalBubble();
431 ShowUploadBubble();
432 ShowUploadBubble();
433 EXPECT_THAT(
434 histogram_tester.GetAllSamples(
435 "Autofill.SaveCreditCardPrompt.Local.FirstShow"),
436 ElementsAre(Bucket(AutofillMetrics::SAVE_CARD_PROMPT_SHOW_REQUESTED, 1),
437 Bucket(AutofillMetrics::SAVE_CARD_PROMPT_SHOWN, 1)));
438 EXPECT_TRUE(
439 histogram_tester
440 .GetAllSamples("Autofill.SaveCreditCardPrompt.Upload.FirstShow")
441 .empty());
442 }
443
444 TEST_F(SaveCardBubbleControllerImplTest, OnlyOneActiveBubble_UploadThenLocal) {
445 base::HistogramTester histogram_tester;
446 ShowUploadBubble();
447 ShowLocalBubble();
448 ShowLocalBubble();
449 EXPECT_THAT(
450 histogram_tester.GetAllSamples(
451 "Autofill.SaveCreditCardPrompt.Upload.FirstShow"),
452 ElementsAre(Bucket(AutofillMetrics::SAVE_CARD_PROMPT_SHOW_REQUESTED, 1),
453 Bucket(AutofillMetrics::SAVE_CARD_PROMPT_SHOWN, 1)));
454 EXPECT_TRUE(
455 histogram_tester
456 .GetAllSamples("Autofill.SaveCreditCardPrompt.Local.FirstShow")
457 .empty());
458 }
459
404 } // namespace autofill 460 } // namespace autofill
OLDNEW
« 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