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

Side by Side Diff: chrome/browser/ui/autofill/save_card_bubble_controller_impl_unittest.cc

Issue 2955963002: Update Chrome Upstream flow to reflect new UI mocks (Closed)
Patch Set: Put changes behind AutofillUpstreamShowNewUi flag Created 3 years, 4 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
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 516 matching lines...) Expand 10 before | Expand all | Expand 10 after
527 527
528 base::HistogramTester histogram_tester; 528 base::HistogramTester histogram_tester;
529 controller()->OnLearnMoreClicked(); 529 controller()->OnLearnMoreClicked();
530 530
531 histogram_tester.ExpectUniqueSample( 531 histogram_tester.ExpectUniqueSample(
532 "Autofill.SaveCreditCardPrompt.Local.Reshows", 532 "Autofill.SaveCreditCardPrompt.Local.Reshows",
533 AutofillMetrics::SAVE_CARD_PROMPT_DISMISS_CLICK_LEARN_MORE, 1); 533 AutofillMetrics::SAVE_CARD_PROMPT_DISMISS_CLICK_LEARN_MORE, 1);
534 } 534 }
535 535
536 TEST_F(SaveCardBubbleControllerImplTest, Metrics_Upload_FirstShow_LearnMore) { 536 TEST_F(SaveCardBubbleControllerImplTest, Metrics_Upload_FirstShow_LearnMore) {
537 // Learn More link only appears on upload if new UI is disabled.
538 base::test::ScopedFeatureList scoped_feature_list_;
539 scoped_feature_list_.InitAndDisableFeature(kAutofillUpstreamShowNewUi);
540
537 ShowUploadBubble(); 541 ShowUploadBubble();
538 542
539 base::HistogramTester histogram_tester; 543 base::HistogramTester histogram_tester;
540 controller()->OnLearnMoreClicked(); 544 controller()->OnLearnMoreClicked();
541 545
542 histogram_tester.ExpectUniqueSample( 546 histogram_tester.ExpectUniqueSample(
543 "Autofill.SaveCreditCardPrompt.Upload.FirstShow", 547 "Autofill.SaveCreditCardPrompt.Upload.FirstShow",
544 AutofillMetrics::SAVE_CARD_PROMPT_DISMISS_CLICK_LEARN_MORE, 1); 548 AutofillMetrics::SAVE_CARD_PROMPT_DISMISS_CLICK_LEARN_MORE, 1);
545 } 549 }
546 550
547 TEST_F(SaveCardBubbleControllerImplTest, Metrics_Upload_Reshows_LearnMore) { 551 TEST_F(SaveCardBubbleControllerImplTest, Metrics_Upload_Reshows_LearnMore) {
552 // Learn More link only appears on upload if new UI is disabled.
553 base::test::ScopedFeatureList scoped_feature_list_;
554 scoped_feature_list_.InitAndDisableFeature(kAutofillUpstreamShowNewUi);
555
548 ShowUploadBubble(); 556 ShowUploadBubble();
549 CloseAndReshowBubble(); 557 CloseAndReshowBubble();
550 558
551 base::HistogramTester histogram_tester; 559 base::HistogramTester histogram_tester;
552 controller()->OnLearnMoreClicked(); 560 controller()->OnLearnMoreClicked();
553 561
554 histogram_tester.ExpectUniqueSample( 562 histogram_tester.ExpectUniqueSample(
555 "Autofill.SaveCreditCardPrompt.Upload.Reshows", 563 "Autofill.SaveCreditCardPrompt.Upload.Reshows",
556 AutofillMetrics::SAVE_CARD_PROMPT_DISMISS_CLICK_LEARN_MORE, 1); 564 AutofillMetrics::SAVE_CARD_PROMPT_DISMISS_CLICK_LEARN_MORE, 1);
557 } 565 }
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
680 EXPECT_TRUE(controller()->InputCvcIsValid(base::ASCIIToUTF16("999"))); 688 EXPECT_TRUE(controller()->InputCvcIsValid(base::ASCIIToUTF16("999")));
681 // 4-digit CVC: 689 // 4-digit CVC:
682 CreditCard amex = autofill::test::GetCreditCard2(); // Amex 690 CreditCard amex = autofill::test::GetCreditCard2(); // Amex
683 ShowLocalBubble(&amex); 691 ShowLocalBubble(&amex);
684 EXPECT_FALSE(controller()->InputCvcIsValid(base::ASCIIToUTF16("123"))); 692 EXPECT_FALSE(controller()->InputCvcIsValid(base::ASCIIToUTF16("123")));
685 EXPECT_TRUE(controller()->InputCvcIsValid(base::ASCIIToUTF16("1234"))); 693 EXPECT_TRUE(controller()->InputCvcIsValid(base::ASCIIToUTF16("1234")));
686 EXPECT_FALSE(controller()->InputCvcIsValid(base::ASCIIToUTF16("12345"))); 694 EXPECT_FALSE(controller()->InputCvcIsValid(base::ASCIIToUTF16("12345")));
687 } 695 }
688 696
689 } // namespace autofill 697 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698