Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(266)

Side by Side Diff: ash/metrics/task_switch_metrics_recorder_unittest.cc

Issue 1153633006: Added UMA statistics for changing the active window via click or touch events. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added the missed desktop_task_switch_metric_recorder files. Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ash/metrics/task_switch_metrics_recorder.h" 5 #include "ash/metrics/task_switch_metrics_recorder.h"
6 6
7 #include "base/test/histogram_tester.h" 7 #include "base/test/histogram_tester.h"
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 9
10 namespace ash { 10 namespace ash {
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 55
56 void TaskSwitchMetricsRecorderTest::TearDown() { 56 void TaskSwitchMetricsRecorderTest::TearDown() {
57 testing::Test::TearDown(); 57 testing::Test::TearDown();
58 58
59 histogram_tester_.reset(); 59 histogram_tester_.reset();
60 task_switch_metrics_recorder_.reset(); 60 task_switch_metrics_recorder_.reset();
61 } 61 }
62 62
63 } // namespace 63 } // namespace
64 64
65 // Verifies that the TaskSwitchMetricsRecorder::kDesktop source adds data to the
66 // Ash.Desktop.TimeBetweenNavigateToTaskSwitches histogram.
67 TEST_F(TaskSwitchMetricsRecorderTest, VerifyTaskSwitchesForDesktopAreRecorded) {
68 const std::string kHistogramName =
69 "Ash.Desktop.TimeBetweenNavigateToTaskSwitches";
70
71 OnTaskSwitch(TaskSwitchMetricsRecorder::kDesktop);
72 OnTaskSwitch(TaskSwitchMetricsRecorder::kDesktop);
73 histogram_tester_->ExpectTotalCount(kHistogramName, 1);
74
75 OnTaskSwitch(TaskSwitchMetricsRecorder::kDesktop);
76 histogram_tester_->ExpectTotalCount(kHistogramName, 2);
77 }
78
65 // Verifies that the TaskSwitchMetricsRecorder::kWindowCycleController source 79 // Verifies that the TaskSwitchMetricsRecorder::kWindowCycleController source
66 // adds data to the Ash.WindowCycleController.TimeBetweenTaskSwitches histogram. 80 // adds data to the Ash.WindowCycleController.TimeBetweenTaskSwitches histogram.
67 TEST_F(TaskSwitchMetricsRecorderTest, 81 TEST_F(TaskSwitchMetricsRecorderTest,
68 VerifyTaskSwitchesForWindowCycleControllerAreRecorded) { 82 VerifyTaskSwitchesForWindowCycleControllerAreRecorded) {
69 const std::string kHistogramName = 83 const std::string kHistogramName =
70 "Ash.WindowCycleController.TimeBetweenTaskSwitches"; 84 "Ash.WindowCycleController.TimeBetweenTaskSwitches";
71 85
72 OnTaskSwitch(TaskSwitchMetricsRecorder::kWindowCycleController); 86 OnTaskSwitch(TaskSwitchMetricsRecorder::kWindowCycleController);
73 OnTaskSwitch(TaskSwitchMetricsRecorder::kWindowCycleController); 87 OnTaskSwitch(TaskSwitchMetricsRecorder::kWindowCycleController);
74 histogram_tester_->ExpectTotalCount(kHistogramName, 1); 88 histogram_tester_->ExpectTotalCount(kHistogramName, 1);
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 144
131 OnTaskSwitch(TaskSwitchMetricsRecorder::kAppList); 145 OnTaskSwitch(TaskSwitchMetricsRecorder::kAppList);
132 OnTaskSwitch(TaskSwitchMetricsRecorder::kAppList); 146 OnTaskSwitch(TaskSwitchMetricsRecorder::kAppList);
133 histogram_tester_->ExpectTotalCount(kHistogramName, 1); 147 histogram_tester_->ExpectTotalCount(kHistogramName, 1);
134 148
135 OnTaskSwitch(TaskSwitchMetricsRecorder::kAppList); 149 OnTaskSwitch(TaskSwitchMetricsRecorder::kAppList);
136 histogram_tester_->ExpectTotalCount(kHistogramName, 2); 150 histogram_tester_->ExpectTotalCount(kHistogramName, 2);
137 } 151 }
138 152
139 } // namespace ash 153 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698