| OLD | NEW |
| 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 <stdint.h> | 5 #include <stdint.h> |
| 6 | 6 |
| 7 #include <list> | 7 #include <list> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/location.h" |
| 10 #include "base/macros.h" | 11 #include "base/macros.h" |
| 11 #include "base/run_loop.h" | 12 #include "base/run_loop.h" |
| 13 #include "base/single_thread_task_runner.h" |
| 12 #include "base/strings/string_number_conversions.h" | 14 #include "base/strings/string_number_conversions.h" |
| 13 #include "base/test/simple_test_tick_clock.h" | 15 #include "base/test/simple_test_tick_clock.h" |
| 16 #include "base/threading/thread_task_runner_handle.h" |
| 14 #include "base/timer/timer.h" | 17 #include "base/timer/timer.h" |
| 15 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
| 16 #include "ui/aura/env.h" | 19 #include "ui/aura/env.h" |
| 17 #include "ui/aura/test/aura_test_base.h" | 20 #include "ui/aura/test/aura_test_base.h" |
| 18 #include "ui/aura/test/test_window_delegate.h" | 21 #include "ui/aura/test/test_window_delegate.h" |
| 19 #include "ui/aura/test/test_windows.h" | 22 #include "ui/aura/test/test_windows.h" |
| 20 #include "ui/aura/window.h" | 23 #include "ui/aura/window.h" |
| 21 #include "ui/aura/window_event_dispatcher.h" | 24 #include "ui/aura/window_event_dispatcher.h" |
| 22 #include "ui/base/hit_test.h" | 25 #include "ui/base/hit_test.h" |
| 23 #include "ui/base/ui_base_switches.h" | 26 #include "ui/base/ui_base_switches.h" |
| (...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 616 target->parent()->RemoveChild(target); | 619 target->parent()->RemoveChild(target); |
| 617 } | 620 } |
| 618 } | 621 } |
| 619 | 622 |
| 620 DISALLOW_COPY_AND_ASSIGN(RemoveOnTouchCancelHandler); | 623 DISALLOW_COPY_AND_ASSIGN(RemoveOnTouchCancelHandler); |
| 621 }; | 624 }; |
| 622 | 625 |
| 623 void DelayByLongPressTimeout() { | 626 void DelayByLongPressTimeout() { |
| 624 ui::GestureProvider::Config config; | 627 ui::GestureProvider::Config config; |
| 625 base::RunLoop run_loop; | 628 base::RunLoop run_loop; |
| 626 base::MessageLoop::current()->PostDelayedTask( | 629 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
| 627 FROM_HERE, | 630 FROM_HERE, run_loop.QuitClosure(), |
| 628 run_loop.QuitClosure(), | |
| 629 config.gesture_detector_config.longpress_timeout * 2); | 631 config.gesture_detector_config.longpress_timeout * 2); |
| 630 run_loop.Run(); | 632 run_loop.Run(); |
| 631 } | 633 } |
| 632 | 634 |
| 633 void DelayByShowPressTimeout() { | 635 void DelayByShowPressTimeout() { |
| 634 ui::GestureProvider::Config config; | 636 ui::GestureProvider::Config config; |
| 635 base::RunLoop run_loop; | 637 base::RunLoop run_loop; |
| 636 base::MessageLoop::current()->PostDelayedTask( | 638 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
| 637 FROM_HERE, | 639 FROM_HERE, run_loop.QuitClosure(), |
| 638 run_loop.QuitClosure(), | |
| 639 config.gesture_detector_config.showpress_timeout * 2); | 640 config.gesture_detector_config.showpress_timeout * 2); |
| 640 run_loop.Run(); | 641 run_loop.Run(); |
| 641 } | 642 } |
| 642 | 643 |
| 643 void SetTouchRadius(ui::TouchEvent* event, float radius_x, float radius_y) { | 644 void SetTouchRadius(ui::TouchEvent* event, float radius_x, float radius_y) { |
| 644 // Using ctor (over direct struct access) due to it's special behavior with | 645 // Using ctor (over direct struct access) due to it's special behavior with |
| 645 // radii. | 646 // radii. |
| 646 ui::PointerDetails details(ui::EventPointerType::POINTER_TYPE_TOUCH, | 647 ui::PointerDetails details(ui::EventPointerType::POINTER_TYPE_TOUCH, |
| 647 radius_x, | 648 radius_x, |
| 648 radius_y, | 649 radius_y, |
| (...skipping 3792 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4441 EXPECT_FALSE(queued_delegate2->long_press()); | 4442 EXPECT_FALSE(queued_delegate2->long_press()); |
| 4442 | 4443 |
| 4443 queued_delegate->Reset(); | 4444 queued_delegate->Reset(); |
| 4444 queued_delegate->WaitUntilReceivedGesture(ui::ET_GESTURE_SHOW_PRESS); | 4445 queued_delegate->WaitUntilReceivedGesture(ui::ET_GESTURE_SHOW_PRESS); |
| 4445 EXPECT_TRUE(queued_delegate->show_press()); | 4446 EXPECT_TRUE(queued_delegate->show_press()); |
| 4446 EXPECT_FALSE(queued_delegate->tap_down()); | 4447 EXPECT_FALSE(queued_delegate->tap_down()); |
| 4447 } | 4448 } |
| 4448 | 4449 |
| 4449 } // namespace test | 4450 } // namespace test |
| 4450 } // namespace aura | 4451 } // namespace aura |
| OLD | NEW |