OLD | NEW |
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 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
460 | 460 |
461 EXPECT_THAT( | 461 EXPECT_THAT( |
462 histogram_tester.GetAllSamples( | 462 histogram_tester.GetAllSamples( |
463 "Autofill.SaveCreditCardPrompt.Upload.FirstShow"), | 463 "Autofill.SaveCreditCardPrompt.Upload.FirstShow"), |
464 ElementsAre( | 464 ElementsAre( |
465 Bucket(AutofillMetrics::SAVE_CARD_PROMPT_SHOW_REQUESTED, 1), | 465 Bucket(AutofillMetrics::SAVE_CARD_PROMPT_SHOW_REQUESTED, 1), |
466 Bucket(AutofillMetrics::SAVE_CARD_PROMPT_END_INVALID_LEGAL_MESSAGE, | 466 Bucket(AutofillMetrics::SAVE_CARD_PROMPT_END_INVALID_LEGAL_MESSAGE, |
467 1))); | 467 1))); |
468 } | 468 } |
469 | 469 |
| 470 TEST_F(SaveCardBubbleControllerImplTest, OnlyOneActiveBubble_RepeatedLocal) { |
| 471 base::HistogramTester histogram_tester; |
| 472 ShowLocalBubble(); |
| 473 ShowLocalBubble(); |
| 474 ShowLocalBubble(); |
| 475 EXPECT_THAT( |
| 476 histogram_tester.GetAllSamples( |
| 477 "Autofill.SaveCreditCardPrompt.Local.FirstShow"), |
| 478 ElementsAre(Bucket(AutofillMetrics::SAVE_CARD_PROMPT_SHOW_REQUESTED, 1), |
| 479 Bucket(AutofillMetrics::SAVE_CARD_PROMPT_SHOWN, 1))); |
| 480 } |
| 481 |
| 482 TEST_F(SaveCardBubbleControllerImplTest, OnlyOneActiveBubble_RepeatedUpload) { |
| 483 base::HistogramTester histogram_tester; |
| 484 ShowUploadBubble(); |
| 485 ShowUploadBubble(); |
| 486 ShowUploadBubble(); |
| 487 EXPECT_THAT( |
| 488 histogram_tester.GetAllSamples( |
| 489 "Autofill.SaveCreditCardPrompt.Upload.FirstShow"), |
| 490 ElementsAre(Bucket(AutofillMetrics::SAVE_CARD_PROMPT_SHOW_REQUESTED, 1), |
| 491 Bucket(AutofillMetrics::SAVE_CARD_PROMPT_SHOWN, 1))); |
| 492 } |
| 493 |
| 494 TEST_F(SaveCardBubbleControllerImplTest, OnlyOneActiveBubble_LocalThenUpload) { |
| 495 base::HistogramTester histogram_tester; |
| 496 ShowLocalBubble(); |
| 497 ShowUploadBubble(); |
| 498 ShowUploadBubble(); |
| 499 EXPECT_THAT( |
| 500 histogram_tester.GetAllSamples( |
| 501 "Autofill.SaveCreditCardPrompt.Local.FirstShow"), |
| 502 ElementsAre(Bucket(AutofillMetrics::SAVE_CARD_PROMPT_SHOW_REQUESTED, 1), |
| 503 Bucket(AutofillMetrics::SAVE_CARD_PROMPT_SHOWN, 1))); |
| 504 EXPECT_TRUE( |
| 505 histogram_tester |
| 506 .GetAllSamples("Autofill.SaveCreditCardPrompt.Upload.FirstShow") |
| 507 .empty()); |
| 508 } |
| 509 |
| 510 TEST_F(SaveCardBubbleControllerImplTest, OnlyOneActiveBubble_UploadThenLocal) { |
| 511 base::HistogramTester histogram_tester; |
| 512 ShowUploadBubble(); |
| 513 ShowLocalBubble(); |
| 514 ShowLocalBubble(); |
| 515 EXPECT_THAT( |
| 516 histogram_tester.GetAllSamples( |
| 517 "Autofill.SaveCreditCardPrompt.Upload.FirstShow"), |
| 518 ElementsAre(Bucket(AutofillMetrics::SAVE_CARD_PROMPT_SHOW_REQUESTED, 1), |
| 519 Bucket(AutofillMetrics::SAVE_CARD_PROMPT_SHOWN, 1))); |
| 520 EXPECT_TRUE( |
| 521 histogram_tester |
| 522 .GetAllSamples("Autofill.SaveCreditCardPrompt.Local.FirstShow") |
| 523 .empty()); |
| 524 } |
| 525 |
470 } // namespace autofill | 526 } // namespace autofill |
OLD | NEW |