Commit 0a7ca336 authored by tdanderson's avatar tdanderson Committed by Commit bot

Record time between switching the active window from Ash overview mode

Introduce the histogram
Ash.WindowSelector.TimeBetweenActiveWindowChanges
which records the amount of time between uses
of overview mode in which the user selects a window
which was not previously active.

BUG=488180
TEST=TaskSwitchMetricsRecorderTest.VerifyTaskSwitchesFromOverviewModeAreRecorded

Review URL: https://codereview.chromium.org/1132293004

Cr-Commit-Position: refs/heads/master@{#330260}
parent 11eeebaa
...@@ -19,10 +19,15 @@ const char kTabStripHistogramName[] = ...@@ -19,10 +19,15 @@ const char kTabStripHistogramName[] =
const char kAcceleratorWindowCycleHistogramName[] = const char kAcceleratorWindowCycleHistogramName[] =
"Ash.WindowCycleController.TimeBetweenTaskSwitches"; "Ash.WindowCycleController.TimeBetweenTaskSwitches";
const char kOverviewModeHistogramName[] =
"Ash.WindowSelector.TimeBetweenActiveWindowChanges";
// Returns the histogram name for the given |task_switch_source|. // Returns the histogram name for the given |task_switch_source|.
const char* GetHistogramName( const char* GetHistogramName(
TaskSwitchMetricsRecorder::TaskSwitchSource task_switch_source) { TaskSwitchMetricsRecorder::TaskSwitchSource task_switch_source) {
switch (task_switch_source) { switch (task_switch_source) {
case TaskSwitchMetricsRecorder::kOverviewMode:
return kOverviewModeHistogramName;
case TaskSwitchMetricsRecorder::kShelf: case TaskSwitchMetricsRecorder::kShelf:
return kShelfHistogramName; return kShelfHistogramName;
case TaskSwitchMetricsRecorder::kTabStrip: case TaskSwitchMetricsRecorder::kTabStrip:
......
...@@ -22,6 +22,9 @@ class ASH_EXPORT TaskSwitchMetricsRecorder { ...@@ -22,6 +22,9 @@ class ASH_EXPORT TaskSwitchMetricsRecorder {
// Enumeration of the different user interfaces that could be the source of // Enumeration of the different user interfaces that could be the source of
// a task switch. Note this is not necessarily comprehensive of all sources. // a task switch. Note this is not necessarily comprehensive of all sources.
enum TaskSwitchSource { enum TaskSwitchSource {
// Task switches caused by selecting a window from overview mode which is
// different from the previously-active window.
kOverviewMode,
// All task switches caused by shelf buttons, not including sub-menus. // All task switches caused by shelf buttons, not including sub-menus.
kShelf, kShelf,
// All task switches caused by the tab strip. // All task switches caused by the tab strip.
......
...@@ -107,4 +107,19 @@ TEST_F(TaskSwitchMetricsRecorderTest, ...@@ -107,4 +107,19 @@ TEST_F(TaskSwitchMetricsRecorderTest,
histogram_tester_->ExpectTotalCount(kHistogramName, 2); histogram_tester_->ExpectTotalCount(kHistogramName, 2);
} }
// Verifies that the TaskSwitchMetricsRecorder::kOverviewMode source adds data
// to the Ash.WindowSelector.TimeBetweenActiveWindowChanges histogram.
TEST_F(TaskSwitchMetricsRecorderTest,
VerifyTaskSwitchesFromOverviewModeAreRecorded) {
const std::string kHistogramName =
"Ash.WindowSelector.TimeBetweenActiveWindowChanges";
OnTaskSwitch(TaskSwitchMetricsRecorder::kOverviewMode);
OnTaskSwitch(TaskSwitchMetricsRecorder::kOverviewMode);
histogram_tester_->ExpectTotalCount(kHistogramName, 1);
OnTaskSwitch(TaskSwitchMetricsRecorder::kOverviewMode);
histogram_tester_->ExpectTotalCount(kHistogramName, 2);
}
} // namespace ash } // namespace ash
...@@ -584,6 +584,8 @@ void UserMetricsRecorder::RecordUserMetricsAction(UserMetricsAction action) { ...@@ -584,6 +584,8 @@ void UserMetricsRecorder::RecordUserMetricsAction(UserMetricsAction action) {
case ash::UMA_WINDOW_OVERVIEW_ACTIVE_WINDOW_CHANGED: case ash::UMA_WINDOW_OVERVIEW_ACTIVE_WINDOW_CHANGED:
base::RecordAction( base::RecordAction(
base::UserMetricsAction("WindowSelector_ActiveWindowChanged")); base::UserMetricsAction("WindowSelector_ActiveWindowChanged"));
task_switch_metrics_recorder_.OnTaskSwitch(
TaskSwitchMetricsRecorder::kOverviewMode);
break; break;
case ash::UMA_WINDOW_OVERVIEW_ENTER_KEY: case ash::UMA_WINDOW_OVERVIEW_ENTER_KEY:
base::RecordAction( base::RecordAction(
......
...@@ -1016,11 +1016,25 @@ Therefore, the affected-histogram name has to have at least one dot in it. ...@@ -1016,11 +1016,25 @@ Therefore, the affected-histogram name has to have at least one dot in it.
</summary> </summary>
</histogram> </histogram>
<histogram name="Ash.WindowSelector.TimeBetweenActiveWindowChanges"
units="seconds">
<owner>bruthig@chromium.org</owner>
<owner>tdanderson@chromium.org</owner>
<summary>
The amount of time between endings of overview mode sessions which were
caused by the user selecting a window which was not previously active. Only
recorded on the second and later times after startup that the user selected
a window which was not previously active.
</summary>
</histogram>
<histogram name="Ash.WindowSelector.TimeBetweenUse" units="milliseconds"> <histogram name="Ash.WindowSelector.TimeBetweenUse" units="milliseconds">
<owner>flackr@chromium.org</owner> <owner>flackr@chromium.org</owner>
<owner>kuscher@google.com</owner> <owner>kuscher@google.com</owner>
<summary> <summary>
The amount of time between uses of overview mode to switch between windows. The amount of time between uses of overview mode, recorded when overview
mode is entered. Only recorded on the second and later times after startup
that the user entered overview mode.
</summary> </summary>
</histogram> </histogram>
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