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

Side by Side Diff: ui/wm/core/user_activity_detector_unittest.cc

Issue 565583005: Clean up GestureEventDetails constructors (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Upload to the most recent patch Created 6 years, 3 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 | « ui/views/widget/widget_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "ui/wm/core/user_activity_detector.h" 5 #include "ui/wm/core/user_activity_detector.h"
6 6
7 #include "base/compiler_specific.h" 7 #include "base/compiler_specific.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/time/time.h" 9 #include "base/time/time.h"
10 #include "ui/aura/test/aura_test_base.h" 10 #include "ui/aura/test/aura_test_base.h"
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 ui::ET_TOUCH_PRESSED, gfx::Point(), 0, base::TimeDelta()); 132 ui::ET_TOUCH_PRESSED, gfx::Point(), 0, base::TimeDelta());
133 detector_->OnTouchEvent(&touch_event); 133 detector_->OnTouchEvent(&touch_event);
134 EXPECT_FALSE(touch_event.handled()); 134 EXPECT_FALSE(touch_event.handled());
135 EXPECT_EQ(now_.ToInternalValue(), 135 EXPECT_EQ(now_.ToInternalValue(),
136 detector_->last_activity_time().ToInternalValue()); 136 detector_->last_activity_time().ToInternalValue());
137 EXPECT_EQ(1, observer_->num_invocations()); 137 EXPECT_EQ(1, observer_->num_invocations());
138 observer_->reset_stats(); 138 observer_->reset_stats();
139 139
140 AdvanceTime(advance_delta); 140 AdvanceTime(advance_delta);
141 ui::GestureEvent gesture_event( 141 ui::GestureEvent gesture_event(
142 0, 0, ui::EF_NONE, 142 0,
143 0,
144 ui::EF_NONE,
143 base::TimeDelta::FromMilliseconds(base::Time::Now().ToDoubleT() * 1000), 145 base::TimeDelta::FromMilliseconds(base::Time::Now().ToDoubleT() * 1000),
144 ui::GestureEventDetails(ui::ET_GESTURE_TAP, 0, 0)); 146 ui::GestureEventDetails(ui::ET_GESTURE_TAP));
145 detector_->OnGestureEvent(&gesture_event); 147 detector_->OnGestureEvent(&gesture_event);
146 EXPECT_FALSE(gesture_event.handled()); 148 EXPECT_FALSE(gesture_event.handled());
147 EXPECT_EQ(now_.ToInternalValue(), 149 EXPECT_EQ(now_.ToInternalValue(),
148 detector_->last_activity_time().ToInternalValue()); 150 detector_->last_activity_time().ToInternalValue());
149 EXPECT_EQ(1, observer_->num_invocations()); 151 EXPECT_EQ(1, observer_->num_invocations());
150 observer_->reset_stats(); 152 observer_->reset_stats();
151 } 153 }
152 154
153 // Checks that observers aren't notified too frequently. 155 // Checks that observers aren't notified too frequently.
154 TEST_F(UserActivityDetectorTest, RateLimitNotifications) { 156 TEST_F(UserActivityDetectorTest, RateLimitNotifications) {
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 ui::ET_MOUSE_MOVED, gfx::Point(), gfx::Point(), ui::EF_IS_SYNTHESIZED, 193 ui::ET_MOUSE_MOVED, gfx::Point(), gfx::Point(), ui::EF_IS_SYNTHESIZED,
192 ui::EF_NONE); 194 ui::EF_NONE);
193 detector_->OnMouseEvent(&mouse_event); 195 detector_->OnMouseEvent(&mouse_event);
194 EXPECT_FALSE(mouse_event.handled()); 196 EXPECT_FALSE(mouse_event.handled());
195 EXPECT_EQ(base::TimeTicks().ToInternalValue(), 197 EXPECT_EQ(base::TimeTicks().ToInternalValue(),
196 detector_->last_activity_time().ToInternalValue()); 198 detector_->last_activity_time().ToInternalValue());
197 EXPECT_EQ(0, observer_->num_invocations()); 199 EXPECT_EQ(0, observer_->num_invocations());
198 } 200 }
199 201
200 } // namespace wm 202 } // namespace wm
OLDNEW
« no previous file with comments | « ui/views/widget/widget_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698