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

Side by Side Diff: ash/shelf/shelf_button_pressed_metric_tracker_unittest.cc

Issue 1975533002: Change ui::Event::time_stamp from TimeDelta to TimeTicks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 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
« no previous file with comments | « ash/keyboard_uma_event_filter.cc ('k') | ash/shelf/shelf_view.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/shelf/shelf_button_pressed_metric_tracker.h" 5 #include "ash/shelf/shelf_button_pressed_metric_tracker.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "ash/shelf/shelf.h" 9 #include "ash/shelf/shelf.h"
10 #include "ash/test/ash_test_base.h" 10 #include "ash/test/ash_test_base.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 private: 45 private:
46 static int next_unique_id_; 46 static int next_unique_id_;
47 int unique_id_; 47 int unique_id_;
48 48
49 DISALLOW_COPY_AND_ASSIGN(DummyEvent); 49 DISALLOW_COPY_AND_ASSIGN(DummyEvent);
50 }; 50 };
51 51
52 int DummyEvent::next_unique_id_ = 0; 52 int DummyEvent::next_unique_id_ = 0;
53 53
54 DummyEvent::DummyEvent() 54 DummyEvent::DummyEvent()
55 : Event(ui::ET_GESTURE_TAP, base::TimeDelta(), 0), 55 : Event(ui::ET_GESTURE_TAP, base::TimeTicks(), 0),
56 unique_id_(next_unique_id_++) { 56 unique_id_(next_unique_id_++) {}
57 }
58 57
59 DummyEvent::~DummyEvent() { 58 DummyEvent::~DummyEvent() {
60 } 59 }
61 60
62 // Test fixture for the ShelfButtonPressedMetricTracker class. Relies on 61 // Test fixture for the ShelfButtonPressedMetricTracker class. Relies on
63 // AshTestBase to initilize the UserMetricsRecorder and it's dependencies. 62 // AshTestBase to initilize the UserMetricsRecorder and it's dependencies.
64 class ShelfButtonPressedMetricTrackerTest : public AshTestBase { 63 class ShelfButtonPressedMetricTrackerTest : public AshTestBase {
65 public: 64 public:
66 static const char* 65 static const char*
67 kTimeBetweenWindowMinimizedAndActivatedActionsHistogramName; 66 kTimeBetweenWindowMinimizedAndActivatedActionsHistogramName;
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 metric_tracker_->ButtonPressed(kDummyEvent, sender, performed_action); 154 metric_tracker_->ButtonPressed(kDummyEvent, sender, performed_action);
156 } 155 }
157 156
158 } // namespace 157 } // namespace
159 158
160 // Verifies that a Launcher_ButtonPressed_Mouse UMA user action is recorded when 159 // Verifies that a Launcher_ButtonPressed_Mouse UMA user action is recorded when
161 // a button is pressed by a mouse event. 160 // a button is pressed by a mouse event.
162 TEST_F(ShelfButtonPressedMetricTrackerTest, 161 TEST_F(ShelfButtonPressedMetricTrackerTest,
163 Launcher_ButtonPressed_MouseIsRecordedWhenIconActivatedByMouse) { 162 Launcher_ButtonPressed_MouseIsRecordedWhenIconActivatedByMouse) {
164 const ui::MouseEvent mouse_event(ui::ET_MOUSE_PRESSED, gfx::Point(), 163 const ui::MouseEvent mouse_event(ui::ET_MOUSE_PRESSED, gfx::Point(),
165 gfx::Point(), base::TimeDelta(), 0, 0); 164 gfx::Point(), base::TimeTicks(), 0, 0);
166 165
167 base::UserActionTester user_action_tester; 166 base::UserActionTester user_action_tester;
168 ButtonPressed(mouse_event); 167 ButtonPressed(mouse_event);
169 EXPECT_EQ(1, 168 EXPECT_EQ(1,
170 user_action_tester.GetActionCount("Launcher_ButtonPressed_Mouse")); 169 user_action_tester.GetActionCount("Launcher_ButtonPressed_Mouse"));
171 } 170 }
172 171
173 // Verifies that a Launcher_ButtonPressed_Touch UMA user action is recorded when 172 // Verifies that a Launcher_ButtonPressed_Touch UMA user action is recorded when
174 // a button is pressed by a touch event. 173 // a button is pressed by a touch event.
175 TEST_F(ShelfButtonPressedMetricTrackerTest, 174 TEST_F(ShelfButtonPressedMetricTrackerTest,
176 Launcher_ButtonPressed_MouseIsRecordedWhenIconActivatedByTouch) { 175 Launcher_ButtonPressed_MouseIsRecordedWhenIconActivatedByTouch) {
177 const ui::TouchEvent touch_event(ui::ET_GESTURE_TAP, gfx::Point(), 0, 176 const ui::TouchEvent touch_event(ui::ET_GESTURE_TAP, gfx::Point(), 0,
178 base::TimeDelta()); 177 base::TimeTicks());
179 178
180 base::UserActionTester user_action_tester; 179 base::UserActionTester user_action_tester;
181 ButtonPressed(touch_event); 180 ButtonPressed(touch_event);
182 EXPECT_EQ(1, 181 EXPECT_EQ(1,
183 user_action_tester.GetActionCount("Launcher_ButtonPressed_Touch")); 182 user_action_tester.GetActionCount("Launcher_ButtonPressed_Touch"));
184 } 183 }
185 184
186 // Verifies that a Launcher_LaunchTask UMA user action is recorded when 185 // Verifies that a Launcher_LaunchTask UMA user action is recorded when
187 // pressing a button causes a new window to be created. 186 // pressing a button causes a new window to be created.
188 TEST_F(ShelfButtonPressedMetricTrackerTest, 187 TEST_F(ShelfButtonPressedMetricTrackerTest,
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 292
294 histogram_tester.ExpectTotalCount( 293 histogram_tester.ExpectTotalCount(
295 kTimeBetweenWindowMinimizedAndActivatedActionsHistogramName, 1); 294 kTimeBetweenWindowMinimizedAndActivatedActionsHistogramName, 1);
296 histogram_tester.ExpectBucketCount( 295 histogram_tester.ExpectBucketCount(
297 kTimeBetweenWindowMinimizedAndActivatedActionsHistogramName, 296 kTimeBetweenWindowMinimizedAndActivatedActionsHistogramName,
298 kTimeDeltaInMilliseconds, 1); 297 kTimeDeltaInMilliseconds, 1);
299 } 298 }
300 299
301 } // namespace test 300 } // namespace test
302 } // namespace ash 301 } // namespace ash
OLDNEW
« no previous file with comments | « ash/keyboard_uma_event_filter.cc ('k') | ash/shelf/shelf_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698