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

Side by Side Diff: ui/views/corewm/compound_event_filter_unittest.cc

Issue 56053004: Dispatches touch events to captured window (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: disable test Created 7 years, 1 month 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
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 "ui/views/corewm/compound_event_filter.h" 5 #include "ui/views/corewm/compound_event_filter.h"
6 6
7 #include "ui/aura/client/activation_client.h" 7 #include "ui/aura/client/activation_client.h"
8 #include "ui/aura/client/cursor_client.h" 8 #include "ui/aura/client/cursor_client.h"
9 #include "ui/aura/env.h" 9 #include "ui/aura/env.h"
10 #include "ui/aura/root_window.h" 10 #include "ui/aura/root_window.h"
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 root_window()->AsRootWindowHostDelegate()->OnHostKeyEvent(&key); 87 root_window()->AsRootWindowHostDelegate()->OnHostKeyEvent(&key);
88 EXPECT_FALSE(cursor_client.IsCursorVisible()); 88 EXPECT_FALSE(cursor_client.IsCursorVisible());
89 89
90 // Mouse synthesized exit event should not show the cursor. 90 // Mouse synthesized exit event should not show the cursor.
91 ui::MouseEvent exit(ui::ET_MOUSE_EXITED, gfx::Point(10, 10), 91 ui::MouseEvent exit(ui::ET_MOUSE_EXITED, gfx::Point(10, 10),
92 gfx::Point(10, 10), 0); 92 gfx::Point(10, 10), 0);
93 exit.set_flags(enter.flags() | ui::EF_IS_SYNTHESIZED); 93 exit.set_flags(enter.flags() | ui::EF_IS_SYNTHESIZED);
94 root_window()->AsRootWindowHostDelegate()->OnHostMouseEvent(&exit); 94 root_window()->AsRootWindowHostDelegate()->OnHostMouseEvent(&exit);
95 EXPECT_FALSE(cursor_client.IsCursorVisible()); 95 EXPECT_FALSE(cursor_client.IsCursorVisible());
96 } 96 }
97 #endif
98 97
99 TEST_F(CompoundEventFilterTest, TouchHidesCursor) { 98 TEST_F(CompoundEventFilterTest, TouchHidesCursor) {
100 scoped_ptr<CompoundEventFilter> compound_filter(new CompoundEventFilter); 99 scoped_ptr<CompoundEventFilter> compound_filter(new CompoundEventFilter);
101 aura::Env::GetInstance()->AddPreTargetHandler(compound_filter.get()); 100 aura::Env::GetInstance()->AddPreTargetHandler(compound_filter.get());
102 aura::test::TestWindowDelegate delegate; 101 aura::test::TestWindowDelegate delegate;
103 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate(&delegate, 1234, 102 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate(&delegate, 1234,
104 gfx::Rect(5, 5, 100, 100), root_window())); 103 gfx::Rect(5, 5, 100, 100), root_window()));
105 window->Show(); 104 window->Show();
106 window->SetCapture(); 105 window->SetCapture();
107 106
(...skipping 28 matching lines...) Expand all
136 135
137 // Now activate the window and press on it again. 136 // Now activate the window and press on it again.
138 ui::TouchEvent press1( 137 ui::TouchEvent press1(
139 ui::ET_TOUCH_PRESSED, gfx::Point(90, 90), 1, GetTime()); 138 ui::ET_TOUCH_PRESSED, gfx::Point(90, 90), 1, GetTime());
140 aura::client::GetActivationClient( 139 aura::client::GetActivationClient(
141 root_window())->ActivateWindow(window.get()); 140 root_window())->ActivateWindow(window.get());
142 root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press1); 141 root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press1);
143 EXPECT_FALSE(cursor_client.IsMouseEventsEnabled()); 142 EXPECT_FALSE(cursor_client.IsMouseEventsEnabled());
144 aura::Env::GetInstance()->RemovePreTargetHandler(compound_filter.get()); 143 aura::Env::GetInstance()->RemovePreTargetHandler(compound_filter.get());
145 } 144 }
145 #endif
146 146
147 // Tests that if an event filter consumes a gesture, then it doesn't focus the 147 // Tests that if an event filter consumes a gesture, then it doesn't focus the
148 // window. 148 // window.
149 TEST_F(CompoundEventFilterTest, FilterConsumedGesture) { 149 TEST_F(CompoundEventFilterTest, FilterConsumedGesture) {
150 scoped_ptr<CompoundEventFilter> compound_filter(new CompoundEventFilter); 150 scoped_ptr<CompoundEventFilter> compound_filter(new CompoundEventFilter);
151 scoped_ptr<ui::EventHandler> gesure_handler(new ConsumeGestureEventFilter); 151 scoped_ptr<ui::EventHandler> gesure_handler(new ConsumeGestureEventFilter);
152 compound_filter->AddHandler(gesure_handler.get()); 152 compound_filter->AddHandler(gesure_handler.get());
153 aura::Env::GetInstance()->AddPreTargetHandler(compound_filter.get()); 153 aura::Env::GetInstance()->AddPreTargetHandler(compound_filter.get());
154 aura::test::TestWindowDelegate delegate; 154 aura::test::TestWindowDelegate delegate;
155 DCHECK(root_window()); 155 DCHECK(root_window());
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 193
194 // Do a touch event. As the mouse button is down this should not disable mouse 194 // Do a touch event. As the mouse button is down this should not disable mouse
195 // events. 195 // events.
196 event_generator.PressTouch(); 196 event_generator.PressTouch();
197 EXPECT_TRUE(cursor_client.IsMouseEventsEnabled()); 197 EXPECT_TRUE(cursor_client.IsMouseEventsEnabled());
198 aura::Env::GetInstance()->RemovePreTargetHandler(compound_filter.get()); 198 aura::Env::GetInstance()->RemovePreTargetHandler(compound_filter.get());
199 } 199 }
200 200
201 } // namespace corewm 201 } // namespace corewm
202 } // namespace views 202 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/corewm/compound_event_filter.cc ('k') | ui/views/widget/desktop_aura/desktop_root_window_host_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698