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

Side by Side Diff: ash/wm/user_activity_detector_unittest.cc

Issue 11280290: events: Change gesture-event handler in EventHandler to not return any values. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years 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 | Annotate | Revision Log
« no previous file with comments | « ash/wm/user_activity_detector.cc ('k') | ash/wm/workspace/frame_maximize_button.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/wm/user_activity_detector.h" 5 #include "ash/wm/user_activity_detector.h"
6 6
7 #include "ash/shell.h" 7 #include "ash/shell.h"
8 #include "ash/test/ash_test_base.h" 8 #include "ash/test/ash_test_base.h"
9 #include "ash/wm/user_activity_observer.h" 9 #include "ash/wm/user_activity_observer.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 EXPECT_EQ(ui::ER_UNHANDLED, detector_->OnTouchEvent(&touch_event)); 120 EXPECT_EQ(ui::ER_UNHANDLED, detector_->OnTouchEvent(&touch_event));
121 EXPECT_EQ(1, observer_->num_invocations()); 121 EXPECT_EQ(1, observer_->num_invocations());
122 observer_->reset_stats(); 122 observer_->reset_stats();
123 123
124 AdvanceTime(advance_delta); 124 AdvanceTime(advance_delta);
125 ui::GestureEvent gesture_event( 125 ui::GestureEvent gesture_event(
126 ui::ET_GESTURE_TAP, 0, 0, ui::EF_NONE, 126 ui::ET_GESTURE_TAP, 0, 0, ui::EF_NONE,
127 base::TimeDelta::FromMilliseconds(base::Time::Now().ToDoubleT() * 1000), 127 base::TimeDelta::FromMilliseconds(base::Time::Now().ToDoubleT() * 1000),
128 ui::GestureEventDetails(ui::ET_GESTURE_TAP, 0, 0), 0U); 128 ui::GestureEventDetails(ui::ET_GESTURE_TAP, 0, 0), 0U);
129 SetEventTarget(window.get(), &gesture_event); 129 SetEventTarget(window.get(), &gesture_event);
130 EXPECT_FALSE(detector_->OnGestureEvent(&gesture_event)); 130 detector_->OnGestureEvent(&gesture_event);
131 EXPECT_FALSE(gesture_event.handled());
131 EXPECT_EQ(1, observer_->num_invocations()); 132 EXPECT_EQ(1, observer_->num_invocations());
132 observer_->reset_stats(); 133 observer_->reset_stats();
133 } 134 }
134 135
135 // Checks that observers aren't notified too frequently. 136 // Checks that observers aren't notified too frequently.
136 TEST_F(UserActivityDetectorTest, RateLimitNotifications) { 137 TEST_F(UserActivityDetectorTest, RateLimitNotifications) {
137 scoped_ptr<aura::Window> window(CreateTestWindowInShellWithId(12345)); 138 scoped_ptr<aura::Window> window(CreateTestWindowInShellWithId(12345));
138 139
139 // The observer should be notified about a key event. 140 // The observer should be notified about a key event.
140 ui::KeyEvent event(ui::ET_KEY_PRESSED, ui::VKEY_A, ui::EF_NONE, false); 141 ui::KeyEvent event(ui::ET_KEY_PRESSED, ui::VKEY_A, ui::EF_NONE, false);
(...skipping 30 matching lines...) Expand all
171 scoped_ptr<aura::Window> window(CreateTestWindowInShellWithId(12345)); 172 scoped_ptr<aura::Window> window(CreateTestWindowInShellWithId(12345));
172 ui::MouseEvent mouse_event( 173 ui::MouseEvent mouse_event(
173 ui::ET_MOUSE_MOVED, gfx::Point(), gfx::Point(), ui::EF_IS_SYNTHESIZED); 174 ui::ET_MOUSE_MOVED, gfx::Point(), gfx::Point(), ui::EF_IS_SYNTHESIZED);
174 SetEventTarget(window.get(), &mouse_event); 175 SetEventTarget(window.get(), &mouse_event);
175 EXPECT_EQ(ui::ER_UNHANDLED, detector_->OnMouseEvent(&mouse_event)); 176 EXPECT_EQ(ui::ER_UNHANDLED, detector_->OnMouseEvent(&mouse_event));
176 EXPECT_EQ(0, observer_->num_invocations()); 177 EXPECT_EQ(0, observer_->num_invocations());
177 } 178 }
178 179
179 } // namespace test 180 } // namespace test
180 } // namespace ash 181 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/user_activity_detector.cc ('k') | ash/wm/workspace/frame_maximize_button.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698