Chromium Code Reviews| 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 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 386 controller()->OnBubbleClosed(); | 386 controller()->OnBubbleClosed(); |
| 387 // Fake-navigate after bubble has been visible for a long time. | 387 // Fake-navigate after bubble has been visible for a long time. |
| 388 controller()->set_elapsed(base::TimeDelta::FromMinutes(1)); | 388 controller()->set_elapsed(base::TimeDelta::FromMinutes(1)); |
| 389 controller()->SimulateNavigation(); | 389 controller()->SimulateNavigation(); |
| 390 | 390 |
| 391 histogram_tester.ExpectUniqueSample( | 391 histogram_tester.ExpectUniqueSample( |
| 392 "Autofill.SaveCreditCardPrompt.Local.Reshows", | 392 "Autofill.SaveCreditCardPrompt.Local.Reshows", |
| 393 AutofillMetrics::SAVE_CARD_PROMPT_END_NAVIGATION_HIDDEN, 1); | 393 AutofillMetrics::SAVE_CARD_PROMPT_END_NAVIGATION_HIDDEN, 1); |
| 394 } | 394 } |
| 395 | 395 |
| 396 TEST_F(SaveCardBubbleControllerImplTest, Metrics_Upload_FirstShow_LearnMore) { | 396 TEST_F(SaveCardBubbleControllerImplTest, Metrics_Local_FirstShow_LearnMore) { |
| 397 ShowUploadBubble(); | 397 ShowLocalBubble(); |
| 398 | 398 |
| 399 base::HistogramTester histogram_tester; | 399 base::HistogramTester histogram_tester; |
| 400 controller()->OnLearnMoreClicked(); | 400 controller()->OnLearnMoreClicked(); |
| 401 | 401 |
| 402 histogram_tester.ExpectUniqueSample( | 402 histogram_tester.ExpectUniqueSample( |
| 403 "Autofill.SaveCreditCardPrompt.Upload.FirstShow", | 403 "Autofill.SaveCreditCardPrompt.Local.FirstShow", |
| 404 AutofillMetrics::SAVE_CARD_PROMPT_DISMISS_CLICK_LEARN_MORE, 1); | 404 AutofillMetrics::SAVE_CARD_PROMPT_DISMISS_CLICK_LEARN_MORE, 1); |
| 405 } | 405 } |
| 406 | 406 |
| 407 TEST_F(SaveCardBubbleControllerImplTest, Metrics_Upload_Reshows_LearnMore) { | 407 TEST_F(SaveCardBubbleControllerImplTest, Metrics_Local_Reshows_LearnMore) { |
|
jiahuiguo
2017/06/27 01:21:10
Do we have tests for the Upload part?
Jared Saul
2017/06/27 01:31:46
We had them; I'm getting rid of them because the "
| |
| 408 ShowUploadBubble(); | 408 ShowLocalBubble(); |
| 409 CloseAndReshowBubble(); | 409 CloseAndReshowBubble(); |
| 410 | 410 |
| 411 base::HistogramTester histogram_tester; | 411 base::HistogramTester histogram_tester; |
| 412 controller()->OnLearnMoreClicked(); | 412 controller()->OnLearnMoreClicked(); |
| 413 | 413 |
| 414 histogram_tester.ExpectUniqueSample( | 414 histogram_tester.ExpectUniqueSample( |
| 415 "Autofill.SaveCreditCardPrompt.Upload.Reshows", | 415 "Autofill.SaveCreditCardPrompt.Local.Reshows", |
| 416 AutofillMetrics::SAVE_CARD_PROMPT_DISMISS_CLICK_LEARN_MORE, 1); | 416 AutofillMetrics::SAVE_CARD_PROMPT_DISMISS_CLICK_LEARN_MORE, 1); |
| 417 } | 417 } |
| 418 | 418 |
| 419 TEST_F(SaveCardBubbleControllerImplTest, | 419 TEST_F(SaveCardBubbleControllerImplTest, |
| 420 Metrics_Upload_FirstShow_LegalMessageLink) { | 420 Metrics_Upload_FirstShow_LegalMessageLink) { |
| 421 ShowUploadBubble(); | 421 ShowUploadBubble(); |
| 422 | 422 |
| 423 base::HistogramTester histogram_tester; | 423 base::HistogramTester histogram_tester; |
| 424 controller()->OnLegalMessageLinkClicked(GURL("http://www.example.com")); | 424 controller()->OnLegalMessageLinkClicked(GURL("http://www.example.com")); |
| 425 | 425 |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 517 "Autofill.SaveCreditCardPrompt.Upload.FirstShow"), | 517 "Autofill.SaveCreditCardPrompt.Upload.FirstShow"), |
| 518 ElementsAre(Bucket(AutofillMetrics::SAVE_CARD_PROMPT_SHOW_REQUESTED, 1), | 518 ElementsAre(Bucket(AutofillMetrics::SAVE_CARD_PROMPT_SHOW_REQUESTED, 1), |
| 519 Bucket(AutofillMetrics::SAVE_CARD_PROMPT_SHOWN, 1))); | 519 Bucket(AutofillMetrics::SAVE_CARD_PROMPT_SHOWN, 1))); |
| 520 EXPECT_TRUE( | 520 EXPECT_TRUE( |
| 521 histogram_tester | 521 histogram_tester |
| 522 .GetAllSamples("Autofill.SaveCreditCardPrompt.Local.FirstShow") | 522 .GetAllSamples("Autofill.SaveCreditCardPrompt.Local.FirstShow") |
| 523 .empty()); | 523 .empty()); |
| 524 } | 524 } |
| 525 | 525 |
| 526 } // namespace autofill | 526 } // namespace autofill |
| OLD | NEW |