Commit 676f5554 authored by Dominic Battre's avatar Dominic Battre Committed by Commit Bot

Introduce User.ActionSimplified UKM metric

This CL introduces a new UKM metric User.ActionSimplified that corresponds to
what is recorded in PasswordManagerActionsV3. I have called it ActionSimplified
because I want to introduce a more detailed action but don't know whether I can
build that before the branch point.

Bug: 732846
Change-Id: I766ec456de100e93b61a63c0ede6fd65dbd36156
Reviewed-on: https://chromium-review.googlesource.com/571003Reviewed-by: default avatarRobert Kaplow <rkaplow@chromium.org>
Reviewed-by: default avatarBalazs Engedy <engedy@chromium.org>
Commit-Queue: Dominic Battré <battre@chromium.org>
Cr-Commit-Position: refs/heads/master@{#486765}
parent 8a8d928f
...@@ -27,6 +27,7 @@ const char kUkmSavingPromptShown[] = "Saving.Prompt.Shown"; ...@@ -27,6 +27,7 @@ const char kUkmSavingPromptShown[] = "Saving.Prompt.Shown";
const char kUkmSavingPromptTrigger[] = "Saving.Prompt.Trigger"; const char kUkmSavingPromptTrigger[] = "Saving.Prompt.Trigger";
const char kUkmSavingPromptInteraction[] = "Saving.Prompt.Interaction"; const char kUkmSavingPromptInteraction[] = "Saving.Prompt.Interaction";
const char kUkmManagerFillEvent[] = "ManagerFill.Action"; const char kUkmManagerFillEvent[] = "ManagerFill.Action";
const char kUkmUserActionSimplified[] = "User.ActionSimplified";
PasswordFormMetricsRecorder::PasswordFormMetricsRecorder( PasswordFormMetricsRecorder::PasswordFormMetricsRecorder(
bool is_main_frame_secure, bool is_main_frame_secure,
...@@ -37,6 +38,7 @@ PasswordFormMetricsRecorder::PasswordFormMetricsRecorder( ...@@ -37,6 +38,7 @@ PasswordFormMetricsRecorder::PasswordFormMetricsRecorder(
PasswordFormMetricsRecorder::~PasswordFormMetricsRecorder() { PasswordFormMetricsRecorder::~PasswordFormMetricsRecorder() {
UMA_HISTOGRAM_ENUMERATION("PasswordManager.ActionsTakenV3", GetActionsTaken(), UMA_HISTOGRAM_ENUMERATION("PasswordManager.ActionsTakenV3", GetActionsTaken(),
kMaxNumActionsTaken); kMaxNumActionsTaken);
RecordUkmMetric(kUkmUserActionSimplified, static_cast<int64_t>(user_action_));
// Use the visible main frame URL at the time the PasswordFormManager // Use the visible main frame URL at the time the PasswordFormManager
// is created, in case a navigation has already started and the // is created, in case a navigation has already started and the
......
...@@ -66,6 +66,10 @@ extern const char kUkmSavingPromptInteraction[]; ...@@ -66,6 +66,10 @@ extern const char kUkmSavingPromptInteraction[];
// PasswordFormMetricsRecorder::ManagerFillEvent. // PasswordFormMetricsRecorder::ManagerFillEvent.
extern const char kUkmManagerFillEvent[]; extern const char kUkmManagerFillEvent[];
// This metric records what the user does with a form. Values correspond to the
// enum UserAction.
extern const char kUkmUserActionSimplified[];
class FormFetcher; class FormFetcher;
// The pupose of this class is to record various types of metrics about the // The pupose of this class is to record various types of metrics about the
......
...@@ -242,12 +242,13 @@ TEST(PasswordFormMetricsRecorder, Actions) { ...@@ -242,12 +242,13 @@ TEST(PasswordFormMetricsRecorder, Actions) {
base::HistogramTester histogram_tester; base::HistogramTester histogram_tester;
base::UserActionTester user_action_tester; base::UserActionTester user_action_tester;
ukm::TestUkmRecorder test_ukm_recorder;
// Use a scoped PasswordFromMetricsRecorder because some metrics are recored // Use a scoped PasswordFromMetricsRecorder because some metrics are recored
// on destruction. // on destruction.
{ {
auto recorder = base::MakeRefCounted<PasswordFormMetricsRecorder>( auto recorder = base::MakeRefCounted<PasswordFormMetricsRecorder>(
test.is_main_frame_secure, nullptr); test.is_main_frame_secure, CreateUkmEntryBuilder(&test_ukm_recorder));
recorder->SetManagerAction(test.manager_action); recorder->SetManagerAction(test.manager_action);
if (test.user_action != UserAction::kNone) if (test.user_action != UserAction::kNone)
...@@ -294,6 +295,12 @@ TEST(PasswordFormMetricsRecorder, Actions) { ...@@ -294,6 +295,12 @@ TEST(PasswordFormMetricsRecorder, Actions) {
case UserAction::kMax: case UserAction::kMax:
break; break;
} }
const ukm::UkmSource* source = test_ukm_recorder.GetSourceForUrl(kTestUrl);
ASSERT_TRUE(source);
test_ukm_recorder.ExpectMetric(*source, "PasswordForm",
kUkmUserActionSimplified,
static_cast<int64_t>(test.user_action));
} }
} }
......
...@@ -850,6 +850,12 @@ be describing additional metrics about the same event. ...@@ -850,6 +850,12 @@ be describing additional metrics about the same event.
correspond to the enum PasswordFormMetricsRecorder::BubbleTrigger. correspond to the enum PasswordFormMetricsRecorder::BubbleTrigger.
</summary> </summary>
</metric> </metric>
<metric name="User.ActionSimplified">
<summary>
Records what the user does with a form. Recorded values correspond to the
enum password_manager::UserAction.
</summary>
</metric>
</event> </event>
<event name="PageWithPassword"> <event name="PageWithPassword">
......
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