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

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

Issue 101573006: Changes MouseEvent constructor to take changed_button_flags. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix test; needs updated expectations as mouse entered wasnt sent before because of env::mouse_butto… Created 7 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/sticky_keys_unittest.cc ('k') | ash/wm/window_manager_unittest.cc » ('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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 EXPECT_FALSE(key_event.handled()); 98 EXPECT_FALSE(key_event.handled());
99 EXPECT_EQ(now_.ToInternalValue(), 99 EXPECT_EQ(now_.ToInternalValue(),
100 detector_->last_activity_time().ToInternalValue()); 100 detector_->last_activity_time().ToInternalValue());
101 EXPECT_EQ(1, observer_->num_invocations()); 101 EXPECT_EQ(1, observer_->num_invocations());
102 observer_->reset_stats(); 102 observer_->reset_stats();
103 103
104 base::TimeDelta advance_delta = base::TimeDelta::FromMilliseconds( 104 base::TimeDelta advance_delta = base::TimeDelta::FromMilliseconds(
105 UserActivityDetector::kNotifyIntervalMs); 105 UserActivityDetector::kNotifyIntervalMs);
106 AdvanceTime(advance_delta); 106 AdvanceTime(advance_delta);
107 ui::MouseEvent mouse_event( 107 ui::MouseEvent mouse_event(
108 ui::ET_MOUSE_MOVED, gfx::Point(), gfx::Point(), ui::EF_NONE); 108 ui::ET_MOUSE_MOVED, gfx::Point(), gfx::Point(), ui::EF_NONE, ui::EF_NONE);
109 SetEventTarget(window.get(), &mouse_event); 109 SetEventTarget(window.get(), &mouse_event);
110 detector_->OnMouseEvent(&mouse_event); 110 detector_->OnMouseEvent(&mouse_event);
111 EXPECT_FALSE(mouse_event.handled()); 111 EXPECT_FALSE(mouse_event.handled());
112 EXPECT_EQ(now_.ToInternalValue(), 112 EXPECT_EQ(now_.ToInternalValue(),
113 detector_->last_activity_time().ToInternalValue()); 113 detector_->last_activity_time().ToInternalValue());
114 EXPECT_EQ(1, observer_->num_invocations()); 114 EXPECT_EQ(1, observer_->num_invocations());
115 observer_->reset_stats(); 115 observer_->reset_stats();
116 116
117 base::TimeTicks time_before_ignore = now_; 117 base::TimeTicks time_before_ignore = now_;
118 118
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 205
206 detector_->OnKeyEvent(&event); 206 detector_->OnKeyEvent(&event);
207 EXPECT_FALSE(event.handled()); 207 EXPECT_FALSE(event.handled());
208 EXPECT_EQ(1, observer_->num_invocations()); 208 EXPECT_EQ(1, observer_->num_invocations());
209 } 209 }
210 210
211 // Checks that the detector ignores synthetic mouse events. 211 // Checks that the detector ignores synthetic mouse events.
212 TEST_F(UserActivityDetectorTest, IgnoreSyntheticMouseEvents) { 212 TEST_F(UserActivityDetectorTest, IgnoreSyntheticMouseEvents) {
213 scoped_ptr<aura::Window> window(CreateTestWindowInShellWithId(12345)); 213 scoped_ptr<aura::Window> window(CreateTestWindowInShellWithId(12345));
214 ui::MouseEvent mouse_event( 214 ui::MouseEvent mouse_event(
215 ui::ET_MOUSE_MOVED, gfx::Point(), gfx::Point(), ui::EF_IS_SYNTHESIZED); 215 ui::ET_MOUSE_MOVED, gfx::Point(), gfx::Point(), ui::EF_IS_SYNTHESIZED,
216 ui::EF_NONE);
216 SetEventTarget(window.get(), &mouse_event); 217 SetEventTarget(window.get(), &mouse_event);
217 detector_->OnMouseEvent(&mouse_event); 218 detector_->OnMouseEvent(&mouse_event);
218 EXPECT_FALSE(mouse_event.handled()); 219 EXPECT_FALSE(mouse_event.handled());
219 EXPECT_EQ(base::TimeTicks().ToInternalValue(), 220 EXPECT_EQ(base::TimeTicks().ToInternalValue(),
220 detector_->last_activity_time().ToInternalValue()); 221 detector_->last_activity_time().ToInternalValue());
221 EXPECT_EQ(0, observer_->num_invocations()); 222 EXPECT_EQ(0, observer_->num_invocations());
222 } 223 }
223 224
224 } // namespace test 225 } // namespace test
225 } // namespace ash 226 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/sticky_keys_unittest.cc ('k') | ash/wm/window_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698