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

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

Issue 1126333005: Added metrics to track the time between task switches done via Alt+Tab and Alt+Shift+Tab. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changed "window_list.size() > 0" to "window.empty()". Created 5 years, 7 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
« no previous file with comments | « ash/metrics/task_switch_metrics_recorder.cc ('k') | ash/metrics/user_metrics_recorder.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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::kWindowCycleController source
66 // adds data to the Ash.WindowCycleController.TimeBetweenTaskSwitches histogram.
67 TEST_F(TaskSwitchMetricsRecorderTest,
68 VerifyTaskSwitchesForWindowCycleControllerAreRecorded) {
69 const std::string kHistogramName =
70 "Ash.WindowCycleController.TimeBetweenTaskSwitches";
71
72 OnTaskSwitch(TaskSwitchMetricsRecorder::kWindowCycleController);
73 OnTaskSwitch(TaskSwitchMetricsRecorder::kWindowCycleController);
74 histogram_tester_->ExpectTotalCount(kHistogramName, 1);
75
76 OnTaskSwitch(TaskSwitchMetricsRecorder::kWindowCycleController);
77 histogram_tester_->ExpectTotalCount(kHistogramName, 2);
78 }
79
65 // Verifies that the TaskSwitchMetricsRecorder::kShelf source adds data to the 80 // Verifies that the TaskSwitchMetricsRecorder::kShelf source adds data to the
66 // Ash.Shelf.TimeBetweenNavigateToTaskSwitches histogram. 81 // Ash.Shelf.TimeBetweenNavigateToTaskSwitches histogram.
67 TEST_F(TaskSwitchMetricsRecorderTest, 82 TEST_F(TaskSwitchMetricsRecorderTest,
68 VerifyTaskSwitchesFromTheShelfAreRecorded) { 83 VerifyTaskSwitchesFromTheShelfAreRecorded) {
69 const std::string kHistogramName = 84 const std::string kHistogramName =
70 "Ash.Shelf.TimeBetweenNavigateToTaskSwitches"; 85 "Ash.Shelf.TimeBetweenNavigateToTaskSwitches";
71 86
72 OnTaskSwitch(TaskSwitchMetricsRecorder::kShelf); 87 OnTaskSwitch(TaskSwitchMetricsRecorder::kShelf);
73 OnTaskSwitch(TaskSwitchMetricsRecorder::kShelf); 88 OnTaskSwitch(TaskSwitchMetricsRecorder::kShelf);
74 histogram_tester_->ExpectTotalCount(kHistogramName, 1); 89 histogram_tester_->ExpectTotalCount(kHistogramName, 1);
75 90
76 OnTaskSwitch(TaskSwitchMetricsRecorder::kShelf); 91 OnTaskSwitch(TaskSwitchMetricsRecorder::kShelf);
77 histogram_tester_->ExpectTotalCount(kHistogramName, 2); 92 histogram_tester_->ExpectTotalCount(kHistogramName, 2);
78 } 93 }
79 94
80 } // namespace ash 95 } // namespace ash
OLDNEW
« no previous file with comments | « ash/metrics/task_switch_metrics_recorder.cc ('k') | ash/metrics/user_metrics_recorder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698