Commit 08cc9254 authored by siyua's avatar siyua Committed by Commit Bot

Return .PreviouslyAccepted and .PreviouslyDenied data to parent histograms

The Autofill.CreditCardInfoBar.Server histogram was split into {
	Autofill.CreditCardInfoBar.Server,
	Autofill.CreditCardInfoBar.Server.PreviouslyDenied,
	Autofill.CreditCardInfoBar.Server.PreviouslyAccepted}.

This caused confusion as it went against precedent where sub-histograms
shouldn't affect their parent's data, and as a result hid a lot of data
behind the .PreviouslyAccepted and .PreviouslyDenied subhistograms.

Here's what we want to happen instead, using
Autofill.CreditCardInfoBar.Server as an example:
1) Autofill.CreditCardInfoBar.Server goes back to containing ALL data,
not just a portion of it.
2) What used to go to Autofill.CreditCardInfoBar.Server should now go to
Autofill.CreditCardInfoBar.Server.NoPreviousDecision so that the
subhistograms are still useful.




Bug: 827414
Change-Id: I432e98f4729318e3e060e280551286b2bcfb80b0
Reviewed-on: https://chromium-review.googlesource.com/997026
Commit-Queue: Siyu An <siyua@chromium.org>
Reviewed-by: default avatarEvan Stade <estade@chromium.org>
Reviewed-by: default avatarSebastien Seguin-Gagnon <sebsg@chromium.org>
Reviewed-by: default avatarAlexei Svitkine <asvitkine@chromium.org>
Reviewed-by: default avatarJared Saul <jsaul@google.com>
Cr-Commit-Position: refs/heads/master@{#550100}
parent ed66cd5c
...@@ -39,7 +39,8 @@ class AutofillSaveCardInfoBarDelegateMobileTest ...@@ -39,7 +39,8 @@ class AutofillSaveCardInfoBarDelegateMobileTest
std::unique_ptr<ConfirmInfoBarDelegate> CreateDelegate( std::unique_ptr<ConfirmInfoBarDelegate> CreateDelegate(
bool is_uploading, bool is_uploading,
prefs::PreviousSaveCreditCardPromptUserDecision prefs::PreviousSaveCreditCardPromptUserDecision
previous_save_credit_card_prompt_user_decision); previous_save_credit_card_prompt_user_decision =
prefs::PREVIOUS_SAVE_CREDIT_CARD_PROMPT_USER_DECISION_NONE);
std::unique_ptr<ConfirmInfoBarDelegate> CreateDelegateWithLegalMessage( std::unique_ptr<ConfirmInfoBarDelegate> CreateDelegateWithLegalMessage(
bool is_uploading, bool is_uploading,
std::string legal_message_string, std::string legal_message_string,
...@@ -106,6 +107,9 @@ AutofillSaveCardInfoBarDelegateMobileTest::CreateDelegateWithLegalMessage( ...@@ -106,6 +107,9 @@ AutofillSaveCardInfoBarDelegateMobileTest::CreateDelegateWithLegalMessage(
EXPECT_TRUE(value->GetAsDictionary(&dictionary)); EXPECT_TRUE(value->GetAsDictionary(&dictionary));
legal_message = dictionary->CreateDeepCopy(); legal_message = dictionary->CreateDeepCopy();
} }
profile()->GetPrefs()->SetInteger(
prefs::kAutofillAcceptSaveCreditCardPromptState,
previous_save_credit_card_prompt_user_decision);
std::unique_ptr<ConfirmInfoBarDelegate> delegate( std::unique_ptr<ConfirmInfoBarDelegate> delegate(
new AutofillSaveCardInfoBarDelegateMobile( new AutofillSaveCardInfoBarDelegateMobile(
is_uploading, credit_card, std::move(legal_message), is_uploading, credit_card, std::move(legal_message),
...@@ -113,33 +117,18 @@ AutofillSaveCardInfoBarDelegateMobileTest::CreateDelegateWithLegalMessage( ...@@ -113,33 +117,18 @@ AutofillSaveCardInfoBarDelegateMobileTest::CreateDelegateWithLegalMessage(
&TestPersonalDataManager::SaveImportedCreditCard), &TestPersonalDataManager::SaveImportedCreditCard),
base::Unretained(personal_data_.get()), credit_card), base::Unretained(personal_data_.get()), credit_card),
profile()->GetPrefs())); profile()->GetPrefs()));
std::string destination = is_uploading ? ".Server" : ".Local";
std::string previous_response;
switch (previous_save_credit_card_prompt_user_decision) {
case prefs::PREVIOUS_SAVE_CREDIT_CARD_PROMPT_USER_DECISION_ACCEPTED:
previous_response = ".PreviouslyAccepted";
break;
case prefs::PREVIOUS_SAVE_CREDIT_CARD_PROMPT_USER_DECISION_DENIED:
previous_response = ".PreviouslyDenied";
break;
default:
EXPECT_EQ(previous_save_credit_card_prompt_user_decision,
prefs::PREVIOUS_SAVE_CREDIT_CARD_PROMPT_USER_DECISION_NONE);
break;
}
return delegate; return delegate;
} }
// Test that local credit card save infobar metrics are logged correctly. // Test that local credit card save infobar metrics are logged correctly.
TEST_F(AutofillSaveCardInfoBarDelegateMobileTest, Metrics_Local) { TEST_F(AutofillSaveCardInfoBarDelegateMobileTest, Metrics_Local_Main) {
::testing::InSequence dummy; ::testing::InSequence dummy;
// Infobar is shown. // Infobar is shown.
{ {
base::HistogramTester histogram_tester; base::HistogramTester histogram_tester;
std::unique_ptr<ConfirmInfoBarDelegate> infobar(CreateDelegate( std::unique_ptr<ConfirmInfoBarDelegate> infobar(CreateDelegate(
/* is_uploading= */ false, /* is_uploading= */ false));
prefs::PREVIOUS_SAVE_CREDIT_CARD_PROMPT_USER_DECISION_NONE));
histogram_tester.ExpectUniqueSample("Autofill.CreditCardInfoBar.Local", histogram_tester.ExpectUniqueSample("Autofill.CreditCardInfoBar.Local",
AutofillMetrics::INFOBAR_SHOWN, 1); AutofillMetrics::INFOBAR_SHOWN, 1);
...@@ -149,67 +138,58 @@ TEST_F(AutofillSaveCardInfoBarDelegateMobileTest, Metrics_Local) { ...@@ -149,67 +138,58 @@ TEST_F(AutofillSaveCardInfoBarDelegateMobileTest, Metrics_Local) {
{ {
personal_data_->ClearCreditCards(); personal_data_->ClearCreditCards();
std::unique_ptr<ConfirmInfoBarDelegate> infobar(CreateDelegate( std::unique_ptr<ConfirmInfoBarDelegate> infobar(CreateDelegate(
/* is_uploading= */ false, /* is_uploading= */ false));
prefs::PREVIOUS_SAVE_CREDIT_CARD_PROMPT_USER_DECISION_DENIED));
base::HistogramTester histogram_tester; base::HistogramTester histogram_tester;
EXPECT_TRUE(infobar->Accept()); EXPECT_TRUE(infobar->Accept());
ASSERT_EQ(1U, personal_data_->GetCreditCards().size()); ASSERT_EQ(1U, personal_data_->GetCreditCards().size());
histogram_tester.ExpectUniqueSample( histogram_tester.ExpectUniqueSample("Autofill.CreditCardInfoBar.Local",
"Autofill.CreditCardInfoBar.Local.PreviouslyDenied", AutofillMetrics::INFOBAR_ACCEPTED, 1);
AutofillMetrics::INFOBAR_ACCEPTED, 1);
} }
// Cancel the infobar. // Cancel the infobar.
{ {
std::unique_ptr<ConfirmInfoBarDelegate> infobar(CreateDelegate( std::unique_ptr<ConfirmInfoBarDelegate> infobar(CreateDelegate(
/* is_uploading= */ false, /* is_uploading= */ false));
prefs::PREVIOUS_SAVE_CREDIT_CARD_PROMPT_USER_DECISION_ACCEPTED));
base::HistogramTester histogram_tester; base::HistogramTester histogram_tester;
EXPECT_TRUE(infobar->Cancel()); EXPECT_TRUE(infobar->Cancel());
histogram_tester.ExpectUniqueSample( histogram_tester.ExpectUniqueSample("Autofill.CreditCardInfoBar.Local",
"Autofill.CreditCardInfoBar.Local.PreviouslyAccepted", AutofillMetrics::INFOBAR_DENIED, 1);
AutofillMetrics::INFOBAR_DENIED, 1);
} }
// Dismiss the infobar. // Dismiss the infobar.
{ {
std::unique_ptr<ConfirmInfoBarDelegate> infobar(CreateDelegate( std::unique_ptr<ConfirmInfoBarDelegate> infobar(CreateDelegate(
/* is_uploading= */ false, /* is_uploading= */ false));
prefs::PREVIOUS_SAVE_CREDIT_CARD_PROMPT_USER_DECISION_DENIED));
base::HistogramTester histogram_tester; base::HistogramTester histogram_tester;
infobar->InfoBarDismissed(); infobar->InfoBarDismissed();
histogram_tester.ExpectUniqueSample( histogram_tester.ExpectUniqueSample("Autofill.CreditCardInfoBar.Local",
"Autofill.CreditCardInfoBar.Local.PreviouslyDenied", AutofillMetrics::INFOBAR_DENIED, 1);
AutofillMetrics::INFOBAR_DENIED, 1);
} }
// Ignore the infobar. // Ignore the infobar.
{ {
std::unique_ptr<ConfirmInfoBarDelegate> infobar(CreateDelegate( std::unique_ptr<ConfirmInfoBarDelegate> infobar(CreateDelegate(
/* is_uploading= */ false, /* is_uploading= */ false));
prefs::PREVIOUS_SAVE_CREDIT_CARD_PROMPT_USER_DECISION_DENIED));
base::HistogramTester histogram_tester; base::HistogramTester histogram_tester;
infobar.reset(); infobar.reset();
histogram_tester.ExpectUniqueSample( histogram_tester.ExpectUniqueSample("Autofill.CreditCardInfoBar.Local",
"Autofill.CreditCardInfoBar.Local.PreviouslyDenied", AutofillMetrics::INFOBAR_IGNORED, 1);
AutofillMetrics::INFOBAR_IGNORED, 1);
} }
} }
// Test that server credit card save infobar metrics are logged correctly. // Test that server credit card save infobar metrics are logged correctly.
TEST_F(AutofillSaveCardInfoBarDelegateMobileTest, Metrics_Server) { TEST_F(AutofillSaveCardInfoBarDelegateMobileTest, Metrics_Server_Main) {
::testing::InSequence dummy; ::testing::InSequence dummy;
// Infobar is shown. // Infobar is shown.
{ {
base::HistogramTester histogram_tester; base::HistogramTester histogram_tester;
std::unique_ptr<ConfirmInfoBarDelegate> infobar(CreateDelegate( std::unique_ptr<ConfirmInfoBarDelegate> infobar(CreateDelegate(
/* is_uploading= */ true, /* is_uploading= */ true));
prefs::PREVIOUS_SAVE_CREDIT_CARD_PROMPT_USER_DECISION_NONE));
histogram_tester.ExpectUniqueSample("Autofill.CreditCardInfoBar.Server", histogram_tester.ExpectUniqueSample("Autofill.CreditCardInfoBar.Server",
AutofillMetrics::INFOBAR_SHOWN, 1); AutofillMetrics::INFOBAR_SHOWN, 1);
...@@ -227,11 +207,10 @@ TEST_F(AutofillSaveCardInfoBarDelegateMobileTest, Metrics_Server) { ...@@ -227,11 +207,10 @@ TEST_F(AutofillSaveCardInfoBarDelegateMobileTest, Metrics_Server) {
std::unique_ptr<ConfirmInfoBarDelegate> infobar( std::unique_ptr<ConfirmInfoBarDelegate> infobar(
CreateDelegateWithLegalMessage( CreateDelegateWithLegalMessage(
/* is_uploading= */ true, std::move(good_legal_message), /* is_uploading= */ true, std::move(good_legal_message),
prefs::PREVIOUS_SAVE_CREDIT_CARD_PROMPT_USER_DECISION_DENIED)); prefs::PREVIOUS_SAVE_CREDIT_CARD_PROMPT_USER_DECISION_NONE));
histogram_tester.ExpectUniqueSample( histogram_tester.ExpectUniqueSample("Autofill.CreditCardInfoBar.Server",
"Autofill.CreditCardInfoBar.Server.PreviouslyDenied", AutofillMetrics::INFOBAR_SHOWN, 1);
AutofillMetrics::INFOBAR_SHOWN, 1);
} }
// Infobar is not shown because the provided legal message is invalid. // Infobar is not shown because the provided legal message is invalid.
...@@ -250,10 +229,10 @@ TEST_F(AutofillSaveCardInfoBarDelegateMobileTest, Metrics_Server) { ...@@ -250,10 +229,10 @@ TEST_F(AutofillSaveCardInfoBarDelegateMobileTest, Metrics_Server) {
std::unique_ptr<ConfirmInfoBarDelegate> infobar( std::unique_ptr<ConfirmInfoBarDelegate> infobar(
CreateDelegateWithLegalMessage( CreateDelegateWithLegalMessage(
/* is_uploading= */ true, std::move(bad_legal_message), /* is_uploading= */ true, std::move(bad_legal_message),
prefs::PREVIOUS_SAVE_CREDIT_CARD_PROMPT_USER_DECISION_DENIED)); prefs::PREVIOUS_SAVE_CREDIT_CARD_PROMPT_USER_DECISION_NONE));
histogram_tester.ExpectUniqueSample( histogram_tester.ExpectUniqueSample(
"Autofill.CreditCardInfoBar.Server.PreviouslyDenied", "Autofill.CreditCardInfoBar.Server",
AutofillMetrics::INFOBAR_NOT_SHOWN_INVALID_LEGAL_MESSAGE, 1); AutofillMetrics::INFOBAR_NOT_SHOWN_INVALID_LEGAL_MESSAGE, 1);
} }
...@@ -261,54 +240,167 @@ TEST_F(AutofillSaveCardInfoBarDelegateMobileTest, Metrics_Server) { ...@@ -261,54 +240,167 @@ TEST_F(AutofillSaveCardInfoBarDelegateMobileTest, Metrics_Server) {
{ {
personal_data_->ClearCreditCards(); personal_data_->ClearCreditCards();
std::unique_ptr<ConfirmInfoBarDelegate> infobar(CreateDelegate( std::unique_ptr<ConfirmInfoBarDelegate> infobar(CreateDelegate(
/* is_uploading= */ true, /* is_uploading= */ true));
prefs::PREVIOUS_SAVE_CREDIT_CARD_PROMPT_USER_DECISION_NONE));
base::HistogramTester histogram_tester; base::HistogramTester histogram_tester;
EXPECT_TRUE(infobar->Accept()); EXPECT_TRUE(infobar->Accept());
ASSERT_EQ(1U, personal_data_->GetCreditCards().size()); ASSERT_EQ(1U, personal_data_->GetCreditCards().size());
histogram_tester.ExpectUniqueSample( histogram_tester.ExpectUniqueSample("Autofill.CreditCardInfoBar.Server",
"Autofill.CreditCardInfoBar.Server.PreviouslyDenied", AutofillMetrics::INFOBAR_ACCEPTED, 1);
AutofillMetrics::INFOBAR_ACCEPTED, 1);
} }
// Cancel the infobar. // Cancel the infobar.
{ {
std::unique_ptr<ConfirmInfoBarDelegate> infobar(CreateDelegate( std::unique_ptr<ConfirmInfoBarDelegate> infobar(CreateDelegate(
/* is_uploading= */ true, /* is_uploading= */ true));
prefs::PREVIOUS_SAVE_CREDIT_CARD_PROMPT_USER_DECISION_ACCEPTED));
base::HistogramTester histogram_tester; base::HistogramTester histogram_tester;
EXPECT_TRUE(infobar->Cancel()); EXPECT_TRUE(infobar->Cancel());
histogram_tester.ExpectUniqueSample( histogram_tester.ExpectUniqueSample("Autofill.CreditCardInfoBar.Server",
"Autofill.CreditCardInfoBar.Server.PreviouslyAccepted", AutofillMetrics::INFOBAR_DENIED, 1);
AutofillMetrics::INFOBAR_DENIED, 1);
} }
// Dismiss the infobar. // Dismiss the infobar.
{ {
std::unique_ptr<ConfirmInfoBarDelegate> infobar(CreateDelegate( std::unique_ptr<ConfirmInfoBarDelegate> infobar(CreateDelegate(
/* is_uploading= */ true, /* is_uploading= */ true));
prefs::PREVIOUS_SAVE_CREDIT_CARD_PROMPT_USER_DECISION_DENIED));
base::HistogramTester histogram_tester; base::HistogramTester histogram_tester;
infobar->InfoBarDismissed(); infobar->InfoBarDismissed();
histogram_tester.ExpectUniqueSample( histogram_tester.ExpectUniqueSample("Autofill.CreditCardInfoBar.Server",
"Autofill.CreditCardInfoBar.Server.PreviouslyDenied", AutofillMetrics::INFOBAR_DENIED, 1);
AutofillMetrics::INFOBAR_DENIED, 1);
} }
// Ignore the infobar. // Ignore the infobar.
{ {
std::unique_ptr<ConfirmInfoBarDelegate> infobar(CreateDelegate( std::unique_ptr<ConfirmInfoBarDelegate> infobar(CreateDelegate(
/* is_uploading= */ true, /* is_uploading= */ true));
prefs::PREVIOUS_SAVE_CREDIT_CARD_PROMPT_USER_DECISION_DENIED));
base::HistogramTester histogram_tester; base::HistogramTester histogram_tester;
infobar.reset(); infobar.reset();
histogram_tester.ExpectUniqueSample( histogram_tester.ExpectUniqueSample("Autofill.CreditCardInfoBar.Server",
AutofillMetrics::INFOBAR_IGNORED, 1);
}
}
// Test that local credit card save infobar previous-decision metrics are logged
// correctly.
TEST_F(AutofillSaveCardInfoBarDelegateMobileTest,
Metrics_Local_PreviousDecision) {
::testing::InSequence dummy;
// NoPreviousDecision
{
personal_data_->ClearCreditCards();
base::HistogramTester histogram_tester;
std::unique_ptr<ConfirmInfoBarDelegate> infobar(CreateDelegate(
/* is_uploading= */ false,
prefs::PREVIOUS_SAVE_CREDIT_CARD_PROMPT_USER_DECISION_NONE));
EXPECT_TRUE(infobar->Accept());
ASSERT_EQ(1U, personal_data_->GetCreditCards().size());
histogram_tester.ExpectBucketCount(
"Autofill.CreditCardInfoBar.Local.NoPreviousDecision",
AutofillMetrics::INFOBAR_SHOWN, 1);
histogram_tester.ExpectBucketCount(
"Autofill.CreditCardInfoBar.Local.NoPreviousDecision",
AutofillMetrics::INFOBAR_ACCEPTED, 1);
}
// PreviouslyAccepted
{
personal_data_->ClearCreditCards();
base::HistogramTester histogram_tester;
std::unique_ptr<ConfirmInfoBarDelegate> infobar(CreateDelegate(
/* is_uploading= */ false,
prefs::PREVIOUS_SAVE_CREDIT_CARD_PROMPT_USER_DECISION_ACCEPTED));
EXPECT_TRUE(infobar->Accept());
ASSERT_EQ(1U, personal_data_->GetCreditCards().size());
histogram_tester.ExpectBucketCount(
"Autofill.CreditCardInfoBar.Local.PreviouslyAccepted",
AutofillMetrics::INFOBAR_SHOWN, 1);
histogram_tester.ExpectBucketCount(
"Autofill.CreditCardInfoBar.Local.PreviouslyAccepted",
AutofillMetrics::INFOBAR_ACCEPTED, 1);
}
// PreviouslyDenied
{
personal_data_->ClearCreditCards();
base::HistogramTester histogram_tester;
std::unique_ptr<ConfirmInfoBarDelegate> infobar(CreateDelegate(
/* is_uploading= */ false,
prefs::PREVIOUS_SAVE_CREDIT_CARD_PROMPT_USER_DECISION_DENIED));
EXPECT_TRUE(infobar->Accept());
ASSERT_EQ(1U, personal_data_->GetCreditCards().size());
histogram_tester.ExpectBucketCount(
"Autofill.CreditCardInfoBar.Local.PreviouslyDenied",
AutofillMetrics::INFOBAR_SHOWN, 1);
histogram_tester.ExpectBucketCount(
"Autofill.CreditCardInfoBar.Local.PreviouslyDenied",
AutofillMetrics::INFOBAR_ACCEPTED, 1);
}
}
// Test that server credit card save infobar metrics are logged correctly.
TEST_F(AutofillSaveCardInfoBarDelegateMobileTest,
Metrics_Server_PreviousDecision) {
::testing::InSequence dummy;
// NoPreviousDecision
{
personal_data_->ClearCreditCards();
base::HistogramTester histogram_tester;
std::unique_ptr<ConfirmInfoBarDelegate> infobar(CreateDelegate(
/* is_uploading= */ true,
prefs::PREVIOUS_SAVE_CREDIT_CARD_PROMPT_USER_DECISION_NONE));
EXPECT_TRUE(infobar->Accept());
ASSERT_EQ(1U, personal_data_->GetCreditCards().size());
histogram_tester.ExpectBucketCount(
"Autofill.CreditCardInfoBar.Server.NoPreviousDecision",
AutofillMetrics::INFOBAR_SHOWN, 1);
histogram_tester.ExpectBucketCount(
"Autofill.CreditCardInfoBar.Server.NoPreviousDecision",
AutofillMetrics::INFOBAR_ACCEPTED, 1);
}
// PreviouslyAccepted
{
personal_data_->ClearCreditCards();
base::HistogramTester histogram_tester;
std::unique_ptr<ConfirmInfoBarDelegate> infobar(CreateDelegate(
/* is_uploading= */ true,
prefs::PREVIOUS_SAVE_CREDIT_CARD_PROMPT_USER_DECISION_ACCEPTED));
EXPECT_TRUE(infobar->Accept());
ASSERT_EQ(1U, personal_data_->GetCreditCards().size());
histogram_tester.ExpectBucketCount(
"Autofill.CreditCardInfoBar.Server.PreviouslyAccepted",
AutofillMetrics::INFOBAR_SHOWN, 1);
histogram_tester.ExpectBucketCount(
"Autofill.CreditCardInfoBar.Server.PreviouslyAccepted",
AutofillMetrics::INFOBAR_ACCEPTED, 1);
}
// PreviouslyDenied
{
personal_data_->ClearCreditCards();
base::HistogramTester histogram_tester;
std::unique_ptr<ConfirmInfoBarDelegate> infobar(CreateDelegate(
/* is_uploading= */ true,
prefs::PREVIOUS_SAVE_CREDIT_CARD_PROMPT_USER_DECISION_DENIED));
EXPECT_TRUE(infobar->Accept());
ASSERT_EQ(1U, personal_data_->GetCreditCards().size());
histogram_tester.ExpectBucketCount(
"Autofill.CreditCardInfoBar.Server.PreviouslyDenied",
AutofillMetrics::INFOBAR_SHOWN, 1);
histogram_tester.ExpectBucketCount(
"Autofill.CreditCardInfoBar.Server.PreviouslyDenied", "Autofill.CreditCardInfoBar.Server.PreviouslyDenied",
AutofillMetrics::INFOBAR_IGNORED, 1); AutofillMetrics::INFOBAR_ACCEPTED, 1);
} }
} }
......
...@@ -306,12 +306,18 @@ TEST_F(SaveCardBubbleControllerImplTest, ...@@ -306,12 +306,18 @@ TEST_F(SaveCardBubbleControllerImplTest,
EXPECT_THAT( EXPECT_THAT(
histogram_tester.GetAllSamples( histogram_tester.GetAllSamples(
"Autofill.SaveCreditCardPrompt.Local.FirstShow"), "Autofill.SaveCreditCardPrompt.Local.FirstShow"),
ElementsAre(Bucket(AutofillMetrics::SAVE_CARD_PROMPT_SHOW_REQUESTED, 2),
Bucket(AutofillMetrics::SAVE_CARD_PROMPT_SHOWN, 2),
Bucket(AutofillMetrics::SAVE_CARD_PROMPT_END_DENIED, 2)));
EXPECT_THAT(
histogram_tester.GetAllSamples(
"Autofill.SaveCreditCardPrompt.Local.FirstShow.PreviouslyDenied"),
ElementsAre(Bucket(AutofillMetrics::SAVE_CARD_PROMPT_SHOW_REQUESTED, 1), ElementsAre(Bucket(AutofillMetrics::SAVE_CARD_PROMPT_SHOW_REQUESTED, 1),
Bucket(AutofillMetrics::SAVE_CARD_PROMPT_SHOWN, 1), Bucket(AutofillMetrics::SAVE_CARD_PROMPT_SHOWN, 1),
Bucket(AutofillMetrics::SAVE_CARD_PROMPT_END_DENIED, 1))); Bucket(AutofillMetrics::SAVE_CARD_PROMPT_END_DENIED, 1)));
EXPECT_THAT( EXPECT_THAT(
histogram_tester.GetAllSamples( histogram_tester.GetAllSamples("Autofill.SaveCreditCardPrompt.Local."
"Autofill.SaveCreditCardPrompt.Local.FirstShow.PreviouslyDenied"), "FirstShow.NoPreviousDecision"),
ElementsAre(Bucket(AutofillMetrics::SAVE_CARD_PROMPT_SHOW_REQUESTED, 1), ElementsAre(Bucket(AutofillMetrics::SAVE_CARD_PROMPT_SHOW_REQUESTED, 1),
Bucket(AutofillMetrics::SAVE_CARD_PROMPT_SHOWN, 1), Bucket(AutofillMetrics::SAVE_CARD_PROMPT_SHOWN, 1),
Bucket(AutofillMetrics::SAVE_CARD_PROMPT_END_DENIED, 1))); Bucket(AutofillMetrics::SAVE_CARD_PROMPT_END_DENIED, 1)));
...@@ -333,20 +339,98 @@ TEST_F(SaveCardBubbleControllerImplTest, ...@@ -333,20 +339,98 @@ TEST_F(SaveCardBubbleControllerImplTest,
EXPECT_THAT( EXPECT_THAT(
histogram_tester.GetAllSamples( histogram_tester.GetAllSamples(
"Autofill.SaveCreditCardPrompt.Local.FirstShow"), "Autofill.SaveCreditCardPrompt.Local.FirstShow"),
ElementsAre(Bucket(AutofillMetrics::SAVE_CARD_PROMPT_SHOW_REQUESTED, 3),
Bucket(AutofillMetrics::SAVE_CARD_PROMPT_SHOWN, 3),
Bucket(AutofillMetrics::SAVE_CARD_PROMPT_END_ACCEPTED, 1),
Bucket(AutofillMetrics::SAVE_CARD_PROMPT_END_DENIED, 1)));
EXPECT_THAT(
histogram_tester.GetAllSamples("Autofill.SaveCreditCardPrompt.Local."
"FirstShow.NoPreviousDecision"),
ElementsAre(Bucket(AutofillMetrics::SAVE_CARD_PROMPT_SHOW_REQUESTED, 1), ElementsAre(Bucket(AutofillMetrics::SAVE_CARD_PROMPT_SHOW_REQUESTED, 1),
Bucket(AutofillMetrics::SAVE_CARD_PROMPT_SHOWN, 1), Bucket(AutofillMetrics::SAVE_CARD_PROMPT_SHOWN, 1),
Bucket(AutofillMetrics::SAVE_CARD_PROMPT_END_DENIED, 1))); Bucket(AutofillMetrics::SAVE_CARD_PROMPT_END_DENIED, 1)));
EXPECT_THAT(
histogram_tester.GetAllSamples(
"Autofill.SaveCreditCardPrompt.Local.FirstShow.PreviouslyDenied"),
ElementsAre(Bucket(AutofillMetrics::SAVE_CARD_PROMPT_SHOW_REQUESTED, 1),
Bucket(AutofillMetrics::SAVE_CARD_PROMPT_SHOWN, 1),
Bucket(AutofillMetrics::SAVE_CARD_PROMPT_END_ACCEPTED, 1)));
EXPECT_THAT( EXPECT_THAT(
histogram_tester.GetAllSamples( histogram_tester.GetAllSamples(
"Autofill.SaveCreditCardPrompt.Local.FirstShow.PreviouslyAccepted"), "Autofill.SaveCreditCardPrompt.Local.FirstShow.PreviouslyAccepted"),
ElementsAre(Bucket(AutofillMetrics::SAVE_CARD_PROMPT_SHOW_REQUESTED, 1), ElementsAre(Bucket(AutofillMetrics::SAVE_CARD_PROMPT_SHOW_REQUESTED, 1),
Bucket(AutofillMetrics::SAVE_CARD_PROMPT_SHOWN, 1))); Bucket(AutofillMetrics::SAVE_CARD_PROMPT_SHOWN, 1)));
}
TEST_F(SaveCardBubbleControllerImplTest,
Metrics_Upload_FirstShow_CancelButton_FirstShow_SaveButton_FirstShow) {
base::HistogramTester histogram_tester;
ShowUploadBubble();
controller()->OnCancelButton();
controller()->OnBubbleClosed();
ShowUploadBubble();
controller()->OnSaveButton();
controller()->OnBubbleClosed();
ShowUploadBubble();
EXPECT_THAT( EXPECT_THAT(
histogram_tester.GetAllSamples( histogram_tester.GetAllSamples(
"Autofill.SaveCreditCardPrompt.Local.FirstShow.PreviouslyDenied"), "Autofill.SaveCreditCardPrompt.Upload.FirstShow"),
ElementsAre(Bucket(AutofillMetrics::SAVE_CARD_PROMPT_SHOW_REQUESTED, 3),
Bucket(AutofillMetrics::SAVE_CARD_PROMPT_SHOWN, 3),
Bucket(AutofillMetrics::SAVE_CARD_PROMPT_END_ACCEPTED, 1),
Bucket(AutofillMetrics::SAVE_CARD_PROMPT_END_DENIED, 1)));
EXPECT_THAT(
histogram_tester.GetAllSamples("Autofill.SaveCreditCardPrompt.Upload."
"FirstShow.NoPreviousDecision"),
ElementsAre(Bucket(AutofillMetrics::SAVE_CARD_PROMPT_SHOW_REQUESTED, 1),
Bucket(AutofillMetrics::SAVE_CARD_PROMPT_SHOWN, 1),
Bucket(AutofillMetrics::SAVE_CARD_PROMPT_END_DENIED, 1)));
EXPECT_THAT(
histogram_tester.GetAllSamples(
"Autofill.SaveCreditCardPrompt.Upload.FirstShow.PreviouslyDenied"),
ElementsAre(Bucket(AutofillMetrics::SAVE_CARD_PROMPT_SHOW_REQUESTED, 1), ElementsAre(Bucket(AutofillMetrics::SAVE_CARD_PROMPT_SHOW_REQUESTED, 1),
Bucket(AutofillMetrics::SAVE_CARD_PROMPT_SHOWN, 1), Bucket(AutofillMetrics::SAVE_CARD_PROMPT_SHOWN, 1),
Bucket(AutofillMetrics::SAVE_CARD_PROMPT_END_ACCEPTED, 1))); Bucket(AutofillMetrics::SAVE_CARD_PROMPT_END_ACCEPTED, 1)));
EXPECT_THAT(
histogram_tester.GetAllSamples(
"Autofill.SaveCreditCardPrompt.Upload.FirstShow.PreviouslyAccepted"),
ElementsAre(Bucket(AutofillMetrics::SAVE_CARD_PROMPT_SHOW_REQUESTED, 1),
Bucket(AutofillMetrics::SAVE_CARD_PROMPT_SHOWN, 1)));
}
TEST_F(SaveCardBubbleControllerImplTest,
Metrics_Local_FirstShow_CancelButton_Reshows) {
base::HistogramTester histogram_tester;
ShowLocalBubble();
CloseAndReshowBubble();
EXPECT_THAT(
histogram_tester.GetAllSamples("Autofill.SaveCreditCardPrompt.Local."
"Reshows.NoPreviousDecision"),
ElementsAre(Bucket(AutofillMetrics::SAVE_CARD_PROMPT_SHOW_REQUESTED, 1),
Bucket(AutofillMetrics::SAVE_CARD_PROMPT_SHOWN, 1)));
}
TEST_F(SaveCardBubbleControllerImplTest,
Metrics_Local_FirstShow_Reshows_Reshows) {
base::HistogramTester histogram_tester;
ShowLocalBubble();
CloseAndReshowBubble();
CloseAndReshowBubble();
EXPECT_THAT(
histogram_tester.GetAllSamples(
"Autofill.SaveCreditCardPrompt.Local.Reshows"),
ElementsAre(Bucket(AutofillMetrics::SAVE_CARD_PROMPT_SHOW_REQUESTED, 2),
Bucket(AutofillMetrics::SAVE_CARD_PROMPT_SHOWN, 2)));
EXPECT_THAT(
histogram_tester.GetAllSamples("Autofill.SaveCreditCardPrompt.Local."
"Reshows.NoPreviousDecision"),
ElementsAre(Bucket(AutofillMetrics::SAVE_CARD_PROMPT_SHOW_REQUESTED, 2),
Bucket(AutofillMetrics::SAVE_CARD_PROMPT_SHOWN, 2)));
} }
TEST_F(SaveCardBubbleControllerImplTest, TEST_F(SaveCardBubbleControllerImplTest,
......
...@@ -66,14 +66,16 @@ std::string PreviousSaveCreditCardPromptUserDecisionToString( ...@@ -66,14 +66,16 @@ std::string PreviousSaveCreditCardPromptUserDecisionToString(
prefs::NUM_PREVIOUS_SAVE_CREDIT_CARD_PROMPT_USER_DECISIONS); prefs::NUM_PREVIOUS_SAVE_CREDIT_CARD_PROMPT_USER_DECISIONS);
std::string previous_response; std::string previous_response;
if (previous_save_credit_card_prompt_user_decision == if (previous_save_credit_card_prompt_user_decision ==
prefs::PREVIOUS_SAVE_CREDIT_CARD_PROMPT_USER_DECISION_ACCEPTED) prefs::PREVIOUS_SAVE_CREDIT_CARD_PROMPT_USER_DECISION_ACCEPTED) {
previous_response = ".PreviouslyAccepted"; previous_response = ".PreviouslyAccepted";
else if (previous_save_credit_card_prompt_user_decision == } else if (previous_save_credit_card_prompt_user_decision ==
prefs::PREVIOUS_SAVE_CREDIT_CARD_PROMPT_USER_DECISION_DENIED) prefs::PREVIOUS_SAVE_CREDIT_CARD_PROMPT_USER_DECISION_DENIED) {
previous_response = ".PreviouslyDenied"; previous_response = ".PreviouslyDenied";
else } else {
DCHECK_EQ(previous_save_credit_card_prompt_user_decision, DCHECK_EQ(previous_save_credit_card_prompt_user_decision,
prefs::PREVIOUS_SAVE_CREDIT_CARD_PROMPT_USER_DECISION_NONE); prefs::PREVIOUS_SAVE_CREDIT_CARD_PROMPT_USER_DECISION_NONE);
previous_response = ".NoPreviousDecision";
}
return previous_response; return previous_response;
} }
...@@ -681,6 +683,8 @@ void AutofillMetrics::LogCreditCardInfoBarMetric( ...@@ -681,6 +683,8 @@ void AutofillMetrics::LogCreditCardInfoBarMetric(
DCHECK_LT(metric, NUM_INFO_BAR_METRICS); DCHECK_LT(metric, NUM_INFO_BAR_METRICS);
std::string destination = is_uploading ? ".Server" : ".Local"; std::string destination = is_uploading ? ".Server" : ".Local";
LogUMAHistogramEnumeration("Autofill.CreditCardInfoBar" + destination, metric,
NUM_INFO_BAR_METRICS);
LogUMAHistogramEnumeration( LogUMAHistogramEnumeration(
"Autofill.CreditCardInfoBar" + destination + "Autofill.CreditCardInfoBar" + destination +
PreviousSaveCreditCardPromptUserDecisionToString( PreviousSaveCreditCardPromptUserDecisionToString(
...@@ -704,6 +708,9 @@ void AutofillMetrics::LogSaveCardPromptMetric( ...@@ -704,6 +708,9 @@ void AutofillMetrics::LogSaveCardPromptMetric(
DCHECK_LT(metric, NUM_SAVE_CARD_PROMPT_METRICS); DCHECK_LT(metric, NUM_SAVE_CARD_PROMPT_METRICS);
std::string destination = is_uploading ? ".Upload" : ".Local"; std::string destination = is_uploading ? ".Upload" : ".Local";
std::string show = is_reshow ? ".Reshows" : ".FirstShow"; std::string show = is_reshow ? ".Reshows" : ".FirstShow";
LogUMAHistogramEnumeration(
"Autofill.SaveCreditCardPrompt" + destination + show, metric,
NUM_SAVE_CARD_PROMPT_METRICS);
LogUMAHistogramEnumeration( LogUMAHistogramEnumeration(
"Autofill.SaveCreditCardPrompt" + destination + show + "Autofill.SaveCreditCardPrompt" + destination + show +
PreviousSaveCreditCardPromptUserDecisionToString( PreviousSaveCreditCardPromptUserDecisionToString(
......
...@@ -106513,6 +106513,8 @@ http://cs/file:chrome/histograms.xml - but prefer this file for new entries. ...@@ -106513,6 +106513,8 @@ http://cs/file:chrome/histograms.xml - but prefer this file for new entries.
label="User had previously accepted save credit card prompt"/> label="User had previously accepted save credit card prompt"/>
<suffix name="PreviouslyDenied" <suffix name="PreviouslyDenied"
label="User had previously denied save credit card prompt"/> label="User had previously denied save credit card prompt"/>
<suffix name="NoPreviousDecision"
label="User previous decision not on record"/>
<affected-histogram name="Autofill.CreditCardInfoBar.Local"/> <affected-histogram name="Autofill.CreditCardInfoBar.Local"/>
<affected-histogram name="Autofill.CreditCardInfoBar.Server"/> <affected-histogram name="Autofill.CreditCardInfoBar.Server"/>
<affected-histogram name="Autofill.SaveCreditCardPrompt.Local.FirstShow"/> <affected-histogram name="Autofill.SaveCreditCardPrompt.Local.FirstShow"/>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment