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

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

Issue 1148723006: Added Ash.TimeBetweenTaskSwitches to record time deltas between all recorded task switches. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 task switches from a non kAny source also add data to the
66 // Ash.TimeBetweenTaskSwitches histogram.
67 TEST_F(TaskSwitchMetricsRecorderTest,
68 VerifyTaskSwitchesRecordInAllTaskSwitchHistogram) {
69 const std::string kHistogramName = "Ash.TimeBetweenTaskSwitches";
70
71 OnTaskSwitch(TaskSwitchMetricsRecorder::kShelf);
72 OnTaskSwitch(TaskSwitchMetricsRecorder::kShelf);
73 histogram_tester_->ExpectTotalCount(kHistogramName, 1);
74 }
75
65 // Verifies that the TaskSwitchMetricsRecorder::kWindowCycleController source 76 // Verifies that the TaskSwitchMetricsRecorder::kWindowCycleController source
66 // adds data to the Ash.WindowCycleController.TimeBetweenTaskSwitches histogram. 77 // adds data to the Ash.WindowCycleController.TimeBetweenTaskSwitches histogram.
67 TEST_F(TaskSwitchMetricsRecorderTest, 78 TEST_F(TaskSwitchMetricsRecorderTest,
68 VerifyTaskSwitchesForWindowCycleControllerAreRecorded) { 79 VerifyTaskSwitchesForWindowCycleControllerAreRecorded) {
69 const std::string kHistogramName = 80 const std::string kHistogramName =
70 "Ash.WindowCycleController.TimeBetweenTaskSwitches"; 81 "Ash.WindowCycleController.TimeBetweenTaskSwitches";
71 82
72 OnTaskSwitch(TaskSwitchMetricsRecorder::kWindowCycleController); 83 OnTaskSwitch(TaskSwitchMetricsRecorder::kWindowCycleController);
73 OnTaskSwitch(TaskSwitchMetricsRecorder::kWindowCycleController); 84 OnTaskSwitch(TaskSwitchMetricsRecorder::kWindowCycleController);
74 histogram_tester_->ExpectTotalCount(kHistogramName, 1); 85 histogram_tester_->ExpectTotalCount(kHistogramName, 1);
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 141
131 OnTaskSwitch(TaskSwitchMetricsRecorder::kAppList); 142 OnTaskSwitch(TaskSwitchMetricsRecorder::kAppList);
132 OnTaskSwitch(TaskSwitchMetricsRecorder::kAppList); 143 OnTaskSwitch(TaskSwitchMetricsRecorder::kAppList);
133 histogram_tester_->ExpectTotalCount(kHistogramName, 1); 144 histogram_tester_->ExpectTotalCount(kHistogramName, 1);
134 145
135 OnTaskSwitch(TaskSwitchMetricsRecorder::kAppList); 146 OnTaskSwitch(TaskSwitchMetricsRecorder::kAppList);
136 histogram_tester_->ExpectTotalCount(kHistogramName, 2); 147 histogram_tester_->ExpectTotalCount(kHistogramName, 2);
137 } 148 }
138 149
139 } // namespace ash 150 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698