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

Side by Side Diff: ui/views/view_targeter_unittest.cc

Issue 619183002: Move check for gesture end events out of RootViewTargeter (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comment removed Created 6 years, 2 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 | « no previous file | ui/views/widget/root_view.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 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/views/view_targeter.h" 5 #include "ui/views/view_targeter.h"
6 6
7 #include "ui/events/event_targeter.h" 7 #include "ui/events/event_targeter.h"
8 #include "ui/events/event_utils.h" 8 #include "ui/events/event_utils.h"
9 #include "ui/gfx/path.h" 9 #include "ui/gfx/path.h"
10 #include "ui/views/masked_targeter_delegate.h" 10 #include "ui/views/masked_targeter_delegate.h"
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 end = GestureEventForTest(details, center_point.x(), center_point.y()); 336 end = GestureEventForTest(details, center_point.x(), center_point.y());
337 337
338 // If no default gesture handler is currently set, targeting should be 338 // If no default gesture handler is currently set, targeting should be
339 // performed using the location of the gesture event for a TAP and a 339 // performed using the location of the gesture event for a TAP and a
340 // SCROLL_BEGIN. 340 // SCROLL_BEGIN.
341 SetGestureHandlerSetBeforeProcessing(root_view, false); 341 SetGestureHandlerSetBeforeProcessing(root_view, false);
342 EXPECT_EQ(grandchild, targeter->FindTargetForEvent(root_view, &tap)); 342 EXPECT_EQ(grandchild, targeter->FindTargetForEvent(root_view, &tap));
343 EXPECT_EQ(grandchild, targeter->FindTargetForEvent(root_view, &scroll_begin)); 343 EXPECT_EQ(grandchild, targeter->FindTargetForEvent(root_view, &scroll_begin));
344 344
345 // If no default gesture handler is currently set, GESTURE_END events 345 // If no default gesture handler is currently set, GESTURE_END events
346 // should never be targeted or re-targeted to any View. 346 // should never be re-targeted to any View.
347 EXPECT_EQ(NULL, targeter->FindTargetForEvent(root_view, &end));
348 EXPECT_EQ(NULL, targeter->FindNextBestTarget(NULL, &end)); 347 EXPECT_EQ(NULL, targeter->FindNextBestTarget(NULL, &end));
349 EXPECT_EQ(NULL, targeter->FindNextBestTarget(child, &end)); 348 EXPECT_EQ(NULL, targeter->FindNextBestTarget(child, &end));
350 } 349 }
351 350
352 // Tests that calls to FindTargetForEvent() and FindNextBestTarget() change 351 // Tests that calls to FindTargetForEvent() and FindNextBestTarget() change
353 // the location of a gesture event to be in the correct coordinate space. 352 // the location of a gesture event to be in the correct coordinate space.
354 TEST_F(ViewTargeterTest, GestureEventCoordinateConversion) { 353 TEST_F(ViewTargeterTest, GestureEventCoordinateConversion) {
355 Widget widget; 354 Widget widget;
356 Widget::InitParams init_params = CreateParams(Widget::InitParams::TYPE_POPUP); 355 Widget::InitParams init_params = CreateParams(Widget::InitParams::TYPE_POPUP);
357 init_params.ownership = Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; 356 init_params.ownership = Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
571 EXPECT_EQ(v1, root_view->GetTooltipHandlerForPoint(v1_origin)); 570 EXPECT_EQ(v1, root_view->GetTooltipHandlerForPoint(v1_origin));
572 EXPECT_EQ(root_view, root_view->GetTooltipHandlerForPoint(v2_origin)); 571 EXPECT_EQ(root_view, root_view->GetTooltipHandlerForPoint(v2_origin));
573 572
574 EXPECT_FALSE(v1->GetTooltipHandlerForPoint(v2_origin)); 573 EXPECT_FALSE(v1->GetTooltipHandlerForPoint(v2_origin));
575 574
576 widget->CloseNow(); 575 widget->CloseNow();
577 } 576 }
578 577
579 } // namespace test 578 } // namespace test
580 } // namespace views 579 } // namespace views
OLDNEW
« no previous file with comments | « no previous file | ui/views/widget/root_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698