summaryrefslogtreecommitdiffstats
path: root/ash
diff options
context:
space:
mode:
authortdanderson <tdanderson@chromium.org>2015-05-06 15:36:32 -0700
committerCommit bot <commit-bot@chromium.org>2015-05-06 22:37:01 +0000
commitc81ee073c9157ff85fd9d0b0cc4bfcbe17fd3034 (patch)
tree96cabf9b1628833d9e1d1cad53c8066b76c2f6ef /ash
parent139294c8f3e155136d4faea21ced5fba5046d017 (diff)
downloadchromium_src-c81ee073c9157ff85fd9d0b0cc4bfcbe17fd3034.zip
chromium_src-c81ee073c9157ff85fd9d0b0cc4bfcbe17fd3034.tar.gz
chromium_src-c81ee073c9157ff85fd9d0b0cc4bfcbe17fd3034.tar.bz2
Add a user action for the Ash TouchView overview mode button
Add a user action Tray_Overview which will be recorded when the user taps on the overview mode button in the Ash shelf (present only when in TouchView mode). BUG=481936 TEST=OverviewButtonTrayTest.TrayOverviewUserAction Review URL: https://codereview.chromium.org/1107403002 Cr-Commit-Position: refs/heads/master@{#328633}
Diffstat (limited to 'ash')
-rw-r--r--ash/metrics/user_metrics_recorder.cc3
-rw-r--r--ash/metrics/user_metrics_recorder.h1
-rw-r--r--ash/system/overview/overview_button_tray.cc1
-rw-r--r--ash/system/overview/overview_button_tray_unittest.cc35
4 files changed, 40 insertions, 0 deletions
diff --git a/ash/metrics/user_metrics_recorder.cc b/ash/metrics/user_metrics_recorder.cc
index 1571c56..dee488b 100644
--- a/ash/metrics/user_metrics_recorder.cc
+++ b/ash/metrics/user_metrics_recorder.cc
@@ -510,6 +510,9 @@ void UserMetricsRecorder::RecordUserMetricsAction(UserMetricsAction action) {
case ash::UMA_TRAY_LOCK_SCREEN:
base::RecordAction(base::UserMetricsAction("Tray_LockScreen"));
break;
+ case ash::UMA_TRAY_OVERVIEW:
+ base::RecordAction(base::UserMetricsAction("Tray_Overview"));
+ break;
case ash::UMA_TRAY_SHUT_DOWN:
base::RecordAction(base::UserMetricsAction("Tray_ShutDown"));
break;
diff --git a/ash/metrics/user_metrics_recorder.h b/ash/metrics/user_metrics_recorder.h
index d2244cd..d9ccf3f 100644
--- a/ash/metrics/user_metrics_recorder.h
+++ b/ash/metrics/user_metrics_recorder.h
@@ -106,6 +106,7 @@ enum UserMetricsAction {
UMA_TOUCHSCREEN_TAP_DOWN,
UMA_TRAY_HELP,
UMA_TRAY_LOCK_SCREEN,
+ UMA_TRAY_OVERVIEW,
UMA_TRAY_SHUT_DOWN,
UMA_WINDOW_APP_CLOSE_BUTTON_CLICK,
UMA_WINDOW_CLOSE_BUTTON_CLICK,
diff --git a/ash/system/overview/overview_button_tray.cc b/ash/system/overview/overview_button_tray.cc
index ec2912f..edd5d67 100644
--- a/ash/system/overview/overview_button_tray.cc
+++ b/ash/system/overview/overview_button_tray.cc
@@ -58,6 +58,7 @@ bool OverviewButtonTray::PerformAction(const ui::Event& event) {
Shell::GetInstance()->window_selector_controller();
controller->ToggleOverview();
SetDrawBackgroundAsActive(controller->IsSelecting());
+ Shell::GetInstance()->metrics()->RecordUserMetricsAction(UMA_TRAY_OVERVIEW);
return true;
}
diff --git a/ash/system/overview/overview_button_tray_unittest.cc b/ash/system/overview/overview_button_tray_unittest.cc
index 3268b7b..a7e6a3e 100644
--- a/ash/system/overview/overview_button_tray_unittest.cc
+++ b/ash/system/overview/overview_button_tray_unittest.cc
@@ -18,6 +18,7 @@
#include "ash/wm/maximize_mode/maximize_mode_controller.h"
#include "ash/wm/overview/window_selector_controller.h"
#include "base/command_line.h"
+#include "base/test/user_action_tester.h"
#include "base/time/time.h"
#include "ui/compositor/scoped_animation_duration_scale_mode.h"
#include "ui/events/event.h"
@@ -29,6 +30,8 @@ namespace ash {
namespace {
+const char kTrayOverview[] = "Tray_Overview";
+
OverviewButtonTray* GetTray() {
return StatusAreaWidgetTestHelper::GetStatusAreaWidget()->
overview_button_tray();
@@ -99,6 +102,38 @@ TEST_F(OverviewButtonTrayTest, PerformAction) {
IsSelecting());
}
+// Tests that tapping on the control will record the user action Tray_Overview.
+TEST_F(OverviewButtonTrayTest, TrayOverviewUserAction) {
+ ASSERT_FALSE(
+ Shell::GetInstance()->window_selector_controller()->IsSelecting());
+
+ // Tapping on the control when there are no windows (and thus the user cannot
+ // enter overview mode) should still record the action.
+ base::UserActionTester user_action_tester;
+ ui::GestureEvent tap(0, 0, 0, base::TimeDelta(),
+ ui::GestureEventDetails(ui::ET_GESTURE_TAP));
+ GetTray()->PerformAction(tap);
+ ASSERT_FALSE(
+ Shell::GetInstance()->window_selector_controller()->IsSelecting());
+ EXPECT_EQ(1, user_action_tester.GetActionCount(kTrayOverview));
+
+ // With one window present, tapping on the control to enter overview mode
+ // should record the user action.
+ scoped_ptr<aura::Window> window(
+ CreateTestWindowInShellWithBounds(gfx::Rect(5, 5, 20, 20)));
+ GetTray()->PerformAction(tap);
+ ASSERT_TRUE(
+ Shell::GetInstance()->window_selector_controller()->IsSelecting());
+ EXPECT_EQ(2, user_action_tester.GetActionCount(kTrayOverview));
+
+ // Tapping on the control to exit overview mode should record the
+ // user action.
+ GetTray()->PerformAction(tap);
+ ASSERT_FALSE(
+ Shell::GetInstance()->window_selector_controller()->IsSelecting());
+ EXPECT_EQ(3, user_action_tester.GetActionCount(kTrayOverview));
+}
+
// Tests that a second OverviewButtonTray has been created, and only shows
// when MaximizeMode has been enabled, when we are using multiple displays.
// By default the DisplayManger is in extended mode.