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

Side by Side Diff: ui/aura/window_event_dispatcher_unittest.cc

Issue 1372253002: gfx: Make conversions from gfx::Point to PointF explicit. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: pointfconvert-event: browsertests Created 5 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
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/aura/window_event_dispatcher.h" 5 #include "ui/aura/window_event_dispatcher.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/run_loop.h" 10 #include "base/run_loop.h"
(...skipping 2495 matching lines...) Expand 10 before | Expand all | Expand 10 after
2506 HoldPointerOnScrollHandler handler(host()->dispatcher(), &recorder); 2506 HoldPointerOnScrollHandler handler(host()->dispatcher(), &recorder);
2507 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( 2507 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate(
2508 &delegate, 2508 &delegate,
2509 1, 2509 1,
2510 gfx::Rect(kWindowOffset, kWindowOffset, 100, 100), 2510 gfx::Rect(kWindowOffset, kWindowOffset, 100, 100),
2511 root_window())); 2511 root_window()));
2512 window->AddPreTargetHandler(&handler); 2512 window->AddPreTargetHandler(&handler);
2513 2513
2514 delegate.set_window(window.get()); 2514 delegate.set_window(window.get());
2515 2515
2516 ui::TouchEvent touch_pressed_event( 2516 ui::TouchEvent touch_pressed_event(ui::ET_TOUCH_PRESSED, gfx::Point(), 0,
2517 ui::ET_TOUCH_PRESSED, gfx::PointF(kX, kY), 0, ui::EventTimeForNow()); 2517 ui::EventTimeForNow());
2518 touch_pressed_event.set_location_f(gfx::PointF(kX, kY));
2519 touch_pressed_event.set_root_location_f(gfx::PointF(kX, kY));
2518 2520
2519 DispatchEventUsingWindowDispatcher(&touch_pressed_event); 2521 DispatchEventUsingWindowDispatcher(&touch_pressed_event);
2520 2522
2521 ASSERT_EQ(1u, recorder.touch_locations().size()); 2523 ASSERT_EQ(1u, recorder.touch_locations().size());
2522 EXPECT_EQ(gfx::Point(kX - kWindowOffset, kY - kWindowOffset).ToString(), 2524 EXPECT_EQ(gfx::Point(kX - kWindowOffset, kY - kWindowOffset).ToString(),
2523 recorder.touch_locations()[0].ToString()); 2525 recorder.touch_locations()[0].ToString());
2524 2526
2525 ASSERT_EQ(2u, recorder.gesture_locations().size()); 2527 ASSERT_EQ(2u, recorder.gesture_locations().size());
2526 EXPECT_EQ(gfx::Point(kX - kWindowOffset, kY - kWindowOffset).ToString(), 2528 EXPECT_EQ(gfx::Point(kX - kWindowOffset, kY - kWindowOffset).ToString(),
2527 recorder.gesture_locations()[0].ToString()); 2529 recorder.gesture_locations()[0].ToString());
(...skipping 29 matching lines...) Expand all
2557 0, 2559 0,
2558 ui::EventTimeForNow()); 2560 ui::EventTimeForNow());
2559 DispatchEventUsingWindowDispatcher(&move2); 2561 DispatchEventUsingWindowDispatcher(&move2);
2560 EXPECT_TRUE(recorder.LastTouchMayCauseScrolling()); 2562 EXPECT_TRUE(recorder.LastTouchMayCauseScrolling());
2561 EXPECT_TRUE(recorder.HasReceivedEvent(ui::ET_TOUCH_MOVED)); 2563 EXPECT_TRUE(recorder.HasReceivedEvent(ui::ET_TOUCH_MOVED));
2562 EXPECT_TRUE(recorder.HasReceivedEvent(ui::ET_GESTURE_SCROLL_UPDATE)); 2564 EXPECT_TRUE(recorder.HasReceivedEvent(ui::ET_GESTURE_SCROLL_UPDATE));
2563 recorder.Reset(); 2565 recorder.Reset();
2564 2566
2565 // Delay the release to avoid fling generation. 2567 // Delay the release to avoid fling generation.
2566 ui::TouchEvent release( 2568 ui::TouchEvent release(
2567 ui::ET_TOUCH_RELEASED, 2569 ui::ET_TOUCH_RELEASED, location + gfx::Vector2d(200, 200), 0,
2568 location + gfx::Vector2dF(200, 200),
2569 0,
2570 ui::EventTimeForNow() + base::TimeDelta::FromSeconds(1)); 2570 ui::EventTimeForNow() + base::TimeDelta::FromSeconds(1));
2571 DispatchEventUsingWindowDispatcher(&release); 2571 DispatchEventUsingWindowDispatcher(&release);
2572 EXPECT_FALSE(recorder.LastTouchMayCauseScrolling()); 2572 EXPECT_FALSE(recorder.LastTouchMayCauseScrolling());
2573 EXPECT_TRUE(recorder.HasReceivedEvent(ui::ET_TOUCH_RELEASED)); 2573 EXPECT_TRUE(recorder.HasReceivedEvent(ui::ET_TOUCH_RELEASED));
2574 EXPECT_TRUE(recorder.HasReceivedEvent(ui::ET_GESTURE_SCROLL_END)); 2574 EXPECT_TRUE(recorder.HasReceivedEvent(ui::ET_GESTURE_SCROLL_END));
2575 2575
2576 root_window()->RemovePreTargetHandler(&recorder); 2576 root_window()->RemovePreTargetHandler(&recorder);
2577 } 2577 }
2578 2578
2579 // OnCursorMovedToRootLocation() is sometimes called instead of 2579 // OnCursorMovedToRootLocation() is sometimes called instead of
(...skipping 21 matching lines...) Expand all
2601 // 2x. A ET_MOUSE_EXITED event should have been sent to |w|. 2601 // 2x. A ET_MOUSE_EXITED event should have been sent to |w|.
2602 test_screen()->SetDeviceScaleFactor(2.f); 2602 test_screen()->SetDeviceScaleFactor(2.f);
2603 dispatcher->OnCursorMovedToRootLocation(gfx::Point(11, 11)); 2603 dispatcher->OnCursorMovedToRootLocation(gfx::Point(11, 11));
2604 RunAllPendingInMessageLoop(); 2604 RunAllPendingInMessageLoop();
2605 EXPECT_TRUE(recorder.HasReceivedEvent(ui::ET_MOUSE_EXITED)); 2605 EXPECT_TRUE(recorder.HasReceivedEvent(ui::ET_MOUSE_EXITED));
2606 2606
2607 w->RemovePreTargetHandler(&recorder); 2607 w->RemovePreTargetHandler(&recorder);
2608 } 2608 }
2609 2609
2610 } // namespace aura 2610 } // namespace aura
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698