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

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

Issue 2715743005: Revert of Avoid two targeting phases in aura client-lib and EventProcessor. (Closed)
Patch Set: Created 3 years, 10 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/root_window_controller.cc ('k') | ash/wm/immersive_fullscreen_controller_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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/common/shelf/shelf_widget.h" 5 #include "ash/common/shelf/shelf_widget.h"
6 6
7 #include "ash/common/shelf/shelf_constants.h" 7 #include "ash/common/shelf/shelf_constants.h"
8 #include "ash/common/shelf/shelf_layout_manager.h" 8 #include "ash/common/shelf/shelf_layout_manager.h"
9 #include "ash/common/shelf/shelf_view.h" 9 #include "ash/common/shelf/shelf_view.h"
10 #include "ash/common/shelf/wm_shelf.h" 10 #include "ash/common/shelf/wm_shelf.h"
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 params.bounds = gfx::Rect(shelf_bounds.height() - kOverlapSize, 207 params.bounds = gfx::Rect(shelf_bounds.height() - kOverlapSize,
208 shelf_bounds.y() - kWindowHeight + kOverlapSize, 208 shelf_bounds.y() - kWindowHeight + kOverlapSize,
209 kWindowWidth, kWindowHeight); 209 kWindowWidth, kWindowHeight);
210 params.context = CurrentContext(); 210 params.context = CurrentContext();
211 // Widget is now owned by the parent window. 211 // Widget is now owned by the parent window.
212 widget->Init(params); 212 widget->Init(params);
213 widget->Show(); 213 widget->Show();
214 gfx::Rect widget_bounds = widget->GetWindowBoundsInScreen(); 214 gfx::Rect widget_bounds = widget->GetWindowBoundsInScreen();
215 EXPECT_TRUE(widget_bounds.Intersects(shelf_bounds)); 215 EXPECT_TRUE(widget_bounds.Intersects(shelf_bounds));
216 216
217 aura::Window* root = widget->GetNativeWindow()->GetRootWindow(); 217 ui::EventTarget* root = widget->GetNativeWindow()->GetRootWindow();
218 ui::EventTargeter* targeter = 218 ui::EventTargeter* targeter = root->GetEventTargeter();
219 root->GetHost()->dispatcher()->GetDefaultEventTargeter();
220 { 219 {
221 // Create a mouse-event targeting the top of the shelf widget. The 220 // Create a mouse-event targeting the top of the shelf widget. The
222 // window-targeter should find |widget| as the target (instead of the 221 // window-targeter should find |widget| as the target (instead of the
223 // shelf). 222 // shelf).
224 gfx::Point event_location(widget_bounds.x() + 5, shelf_bounds.y() + 1); 223 gfx::Point event_location(widget_bounds.x() + 5, shelf_bounds.y() + 1);
225 ui::MouseEvent mouse(ui::ET_MOUSE_MOVED, event_location, event_location, 224 ui::MouseEvent mouse(ui::ET_MOUSE_MOVED, event_location, event_location,
226 ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE); 225 ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE);
227 ui::EventTarget* target = targeter->FindTargetForEvent(root, &mouse); 226 ui::EventTarget* target = targeter->FindTargetForEvent(root, &mouse);
228 EXPECT_EQ(widget->GetNativeWindow(), target); 227 EXPECT_EQ(widget->GetNativeWindow(), target);
229 } 228 }
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 283
285 // Create a widget to make sure that the shelf does auto-hide. 284 // Create a widget to make sure that the shelf does auto-hide.
286 views::Widget* widget = new views::Widget; 285 views::Widget* widget = new views::Widget;
287 views::Widget::InitParams params(views::Widget::InitParams::TYPE_WINDOW); 286 views::Widget::InitParams params(views::Widget::InitParams::TYPE_WINDOW);
288 params.bounds = gfx::Rect(0, 0, 200, 200); 287 params.bounds = gfx::Rect(0, 0, 200, 200);
289 params.context = CurrentContext(); 288 params.context = CurrentContext();
290 // Widget is now owned by the parent window. 289 // Widget is now owned by the parent window.
291 widget->Init(params); 290 widget->Init(params);
292 widget->Show(); 291 widget->Show();
293 292
294 aura::Window* root = shelf_widget->GetNativeWindow()->GetRootWindow(); 293 ui::EventTarget* root = shelf_widget->GetNativeWindow()->GetRootWindow();
295 ui::EventTargeter* targeter = 294 ui::EventTargeter* targeter = root->GetEventTargeter();
296 root->GetHost()->dispatcher()->GetDefaultEventTargeter();
297 // Touch just over the shelf. Since the shelf is visible, the window-targeter 295 // Touch just over the shelf. Since the shelf is visible, the window-targeter
298 // should not find the shelf as the target. 296 // should not find the shelf as the target.
299 { 297 {
300 gfx::Point event_location(20, shelf_bounds.y() - 1); 298 gfx::Point event_location(20, shelf_bounds.y() - 1);
301 ui::TouchEvent touch(ui::ET_TOUCH_PRESSED, event_location, 0, 299 ui::TouchEvent touch(ui::ET_TOUCH_PRESSED, event_location, 0,
302 ui::EventTimeForNow()); 300 ui::EventTimeForNow());
303 EXPECT_NE(shelf_widget->GetNativeWindow(), 301 EXPECT_NE(shelf_widget->GetNativeWindow(),
304 targeter->FindTargetForEvent(root, &touch)); 302 targeter->FindTargetForEvent(root, &touch));
305 } 303 }
306 304
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 } 406 }
409 407
410 TEST_F(ShelfWidgetTestWithInitializer, CreateLockedShelf) { 408 TEST_F(ShelfWidgetTestWithInitializer, CreateLockedShelf) {
411 // The auto hide state 'HIDDEN' is returned for any non-auto-hide behavior. 409 // The auto hide state 'HIDDEN' is returned for any non-auto-hide behavior.
412 TestCreateShelfWithInitialValues(SHELF_ALIGNMENT_BOTTOM_LOCKED, 410 TestCreateShelfWithInitialValues(SHELF_ALIGNMENT_BOTTOM_LOCKED,
413 SHELF_AUTO_HIDE_BEHAVIOR_NEVER, 411 SHELF_AUTO_HIDE_BEHAVIOR_NEVER,
414 SHELF_VISIBLE, SHELF_AUTO_HIDE_HIDDEN); 412 SHELF_VISIBLE, SHELF_AUTO_HIDE_HIDDEN);
415 } 413 }
416 414
417 } // namespace ash 415 } // namespace ash
OLDNEW
« no previous file with comments | « ash/root_window_controller.cc ('k') | ash/wm/immersive_fullscreen_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698