Commit de8d1919 authored by Andrew Xu's avatar Andrew Xu Committed by Commit Bot

Avoid over counting on hotseat gesture metrics

Bug: 1069625
Change-Id: I29e375bdeb4aa102714b57d60805b3a534825f96
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2146782
Commit-Queue: Andrew Xu <andrewxu@chromium.org>
Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#758531}
parent 5e12b718
...@@ -703,9 +703,14 @@ void ShelfLayoutManager::ProcessGestureEventOfInAppHotseat( ...@@ -703,9 +703,14 @@ void ShelfLayoutManager::ProcessGestureEventOfInAppHotseat(
return; return;
base::AutoReset<bool> hide_hotseat(&should_hide_hotseat_, true); base::AutoReset<bool> hide_hotseat(&should_hide_hotseat_, true);
UMA_HISTOGRAM_ENUMERATION(
kHotseatGestureHistogramName, // Record gesture metrics only for ET_GESTURE_BEGIN to avoid over counting.
InAppShelfGestures::kHotseatHiddenDueToInteractionOutsideOfShelf); if (event->type() == ui::ET_GESTURE_BEGIN) {
UMA_HISTOGRAM_ENUMERATION(
kHotseatGestureHistogramName,
InAppShelfGestures::kHotseatHiddenDueToInteractionOutsideOfShelf);
}
UpdateVisibilityState(); UpdateVisibilityState();
} }
......
...@@ -20,6 +20,8 @@ ...@@ -20,6 +20,8 @@
#include "ash/session/session_controller_impl.h" #include "ash/session/session_controller_impl.h"
#include "ash/session/test_session_controller_client.h" #include "ash/session/test_session_controller_client.h"
#include "ash/shelf/shelf.h" #include "ash/shelf/shelf.h"
#include "ash/shelf/shelf_metrics.h"
#include "ash/shelf/test/overview_animation_waiter.h"
#include "ash/shell.h" #include "ash/shell.h"
#include "ash/test/ash_test_base.h" #include "ash/test/ash_test_base.h"
#include "ash/wm/mru_window_tracker.h" #include "ash/wm/mru_window_tracker.h"
...@@ -42,6 +44,7 @@ ...@@ -42,6 +44,7 @@
#include "base/run_loop.h" #include "base/run_loop.h"
#include "base/strings/stringprintf.h" #include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/scoped_feature_list.h" #include "base/test/scoped_feature_list.h"
#include "base/values.h" #include "base/values.h"
#include "chromeos/constants/chromeos_switches.h" #include "chromeos/constants/chromeos_switches.h"
...@@ -1872,18 +1875,31 @@ TEST_P(TabletModeWindowManagerWithClamshellSplitViewTest, ...@@ -1872,18 +1875,31 @@ TEST_P(TabletModeWindowManagerWithClamshellSplitViewTest,
// Clamshell -> Tablet mode transition. If overview is active, it will remain // Clamshell -> Tablet mode transition. If overview is active, it will remain
// in overview. // in overview.
OverviewController* overview_controller = Shell::Get()->overview_controller(); OverviewController* overview_controller = Shell::Get()->overview_controller();
OverviewAnimationWaiter start_overview_waiter;
EXPECT_TRUE(overview_controller->StartOverview()); EXPECT_TRUE(overview_controller->StartOverview());
EXPECT_TRUE(overview_controller->InOverviewSession()); EXPECT_TRUE(overview_controller->InOverviewSession());
TabletModeWindowManager* manager = CreateTabletModeWindowManager(); TabletModeWindowManager* manager = CreateTabletModeWindowManager();
EXPECT_TRUE(manager); EXPECT_TRUE(manager);
EXPECT_TRUE(overview_controller->InOverviewSession()); EXPECT_TRUE(overview_controller->InOverviewSession());
start_overview_waiter.Wait();
aura::Window* home_screen_window = aura::Window* home_screen_window =
Shell::Get()->app_list_controller()->GetHomeScreenWindow(); Shell::Get()->app_list_controller()->GetHomeScreenWindow();
EXPECT_FALSE(home_screen_window->TargetVisibility()); EXPECT_FALSE(home_screen_window->TargetVisibility());
// Simulate tapping on the home button to go to home launcher. base::HistogramTester tester;
Shell::Get()->home_screen_controller()->GoHome(GetPrimaryDisplay().id()); tester.ExpectBucketCount(
kHotseatGestureHistogramName,
InAppShelfGestures::kHotseatHiddenDueToInteractionOutsideOfShelf, 0);
// Tap at window to leave the overview mode.
OverviewAnimationWaiter end_overview_waiter;
GetEventGenerator()->GestureTapAt(window->GetBoundsInScreen().CenterPoint());
end_overview_waiter.Wait();
tester.ExpectBucketCount(
kHotseatGestureHistogramName,
InAppShelfGestures::kHotseatHiddenDueToInteractionOutsideOfShelf, 1);
EXPECT_FALSE(overview_controller->InOverviewSession()); EXPECT_FALSE(overview_controller->InOverviewSession());
EXPECT_TRUE(home_screen_window->TargetVisibility()); EXPECT_TRUE(home_screen_window->TargetVisibility());
} }
......
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