| 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 "content/browser/renderer_host/render_widget_host_view_aura.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_aura.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <tuple> | 10 #include <tuple> |
| 11 #include <utility> | 11 #include <utility> |
| 12 | 12 |
| 13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
| 14 #include "base/location.h" | 14 #include "base/location.h" |
| 15 #include "base/macros.h" | 15 #include "base/macros.h" |
| 16 #include "base/memory/ptr_util.h" | 16 #include "base/memory/ptr_util.h" |
| 17 #include "base/memory/shared_memory.h" | 17 #include "base/memory/shared_memory.h" |
| 18 #include "base/message_loop/message_loop.h" | 18 #include "base/message_loop/message_loop.h" |
| 19 #include "base/run_loop.h" | 19 #include "base/run_loop.h" |
| 20 #include "base/single_thread_task_runner.h" | 20 #include "base/single_thread_task_runner.h" |
| 21 #include "base/strings/utf_string_conversions.h" | 21 #include "base/strings/utf_string_conversions.h" |
| 22 #include "base/test/scoped_feature_list.h" |
| 22 #include "base/test/simple_test_tick_clock.h" | 23 #include "base/test/simple_test_tick_clock.h" |
| 23 #include "base/threading/thread_task_runner_handle.h" | 24 #include "base/threading/thread_task_runner_handle.h" |
| 24 #include "build/build_config.h" | 25 #include "build/build_config.h" |
| 25 #include "cc/output/begin_frame_args.h" | 26 #include "cc/output/begin_frame_args.h" |
| 26 #include "cc/output/compositor_frame.h" | 27 #include "cc/output/compositor_frame.h" |
| 27 #include "cc/output/compositor_frame_metadata.h" | 28 #include "cc/output/compositor_frame_metadata.h" |
| 28 #include "cc/output/copy_output_request.h" | 29 #include "cc/output/copy_output_request.h" |
| 29 #include "cc/surfaces/surface.h" | 30 #include "cc/surfaces/surface.h" |
| 30 #include "cc/surfaces/surface_manager.h" | 31 #include "cc/surfaces/surface_manager.h" |
| 31 #include "components/display_compositor/gl_helper.h" | 32 #include "components/display_compositor/gl_helper.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 47 #include "content/browser/renderer_host/resize_lock.h" | 48 #include "content/browser/renderer_host/resize_lock.h" |
| 48 #include "content/browser/renderer_host/text_input_manager.h" | 49 #include "content/browser/renderer_host/text_input_manager.h" |
| 49 #include "content/browser/web_contents/web_contents_view_aura.h" | 50 #include "content/browser/web_contents/web_contents_view_aura.h" |
| 50 #include "content/common/host_shared_bitmap_manager.h" | 51 #include "content/common/host_shared_bitmap_manager.h" |
| 51 #include "content/common/input/synthetic_web_input_event_builders.h" | 52 #include "content/common/input/synthetic_web_input_event_builders.h" |
| 52 #include "content/common/input_messages.h" | 53 #include "content/common/input_messages.h" |
| 53 #include "content/common/text_input_state.h" | 54 #include "content/common/text_input_state.h" |
| 54 #include "content/common/view_messages.h" | 55 #include "content/common/view_messages.h" |
| 55 #include "content/public/browser/render_widget_host_view.h" | 56 #include "content/public/browser/render_widget_host_view.h" |
| 56 #include "content/public/browser/web_contents_view_delegate.h" | 57 #include "content/public/browser/web_contents_view_delegate.h" |
| 58 #include "content/public/common/content_features.h" |
| 57 #include "content/public/common/context_menu_params.h" | 59 #include "content/public/common/context_menu_params.h" |
| 58 #include "content/public/test/mock_render_process_host.h" | 60 #include "content/public/test/mock_render_process_host.h" |
| 59 #include "content/public/test/test_browser_context.h" | 61 #include "content/public/test/test_browser_context.h" |
| 60 #include "content/test/test_render_view_host.h" | 62 #include "content/test/test_render_view_host.h" |
| 61 #include "content/test/test_web_contents.h" | 63 #include "content/test/test_web_contents.h" |
| 62 #include "ipc/ipc_message.h" | 64 #include "ipc/ipc_message.h" |
| 63 #include "ipc/ipc_test_sink.h" | 65 #include "ipc/ipc_test_sink.h" |
| 64 #include "media/base/video_frame.h" | 66 #include "media/base/video_frame.h" |
| 65 #include "testing/gmock/include/gmock/gmock.h" | 67 #include "testing/gmock/include/gmock/gmock.h" |
| 66 #include "testing/gtest/include/gtest/gtest.h" | 68 #include "testing/gtest/include/gtest/gtest.h" |
| (...skipping 621 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 688 | 690 |
| 689 const blink::WebInputEvent* event = std::get<0>(params); | 691 const blink::WebInputEvent* event = std::get<0>(params); |
| 690 SendTouchEventACK(event->type(), ack_result, | 692 SendTouchEventACK(event->type(), ack_result, |
| 691 WebInputEventTraits::GetUniqueTouchEventId(*event)); | 693 WebInputEventTraits::GetUniqueTouchEventId(*event)); |
| 692 } | 694 } |
| 693 | 695 |
| 694 const ui::MotionEventAura& pointer_state() { | 696 const ui::MotionEventAura& pointer_state() { |
| 695 return view_->pointer_state_for_test(); | 697 return view_->pointer_state_for_test(); |
| 696 } | 698 } |
| 697 | 699 |
| 700 void EnableRafAlignedTouchInput() { |
| 701 feature_list_.InitFromCommandLine( |
| 702 features::kRafAlignedTouchInputEvents.name, ""); |
| 703 } |
| 704 |
| 705 void DisableRafAlignedTouchInput() { |
| 706 feature_list_.InitFromCommandLine( |
| 707 "", features::kRafAlignedTouchInputEvents.name); |
| 708 } |
| 709 |
| 698 protected: | 710 protected: |
| 699 BrowserContext* browser_context() { return browser_context_.get(); } | 711 BrowserContext* browser_context() { return browser_context_.get(); } |
| 700 | 712 |
| 701 MockRenderWidgetHostDelegate* render_widget_host_delegate() const { | 713 MockRenderWidgetHostDelegate* render_widget_host_delegate() const { |
| 702 return delegates_.back().get(); | 714 return delegates_.back().get(); |
| 703 } | 715 } |
| 704 | 716 |
| 705 // Sets the |view| active in TextInputManager with the given |type|. |type| | 717 // Sets the |view| active in TextInputManager with the given |type|. |type| |
| 706 // cannot be ui::TEXT_INPUT_TYPE_NONE. | 718 // cannot be ui::TEXT_INPUT_TYPE_NONE. |
| 707 // Must not be called in the destruction path of |view|. | 719 // Must not be called in the destruction path of |view|. |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 748 // destruction. | 760 // destruction. |
| 749 RenderWidgetHostImpl* parent_host_; | 761 RenderWidgetHostImpl* parent_host_; |
| 750 RenderWidgetHostViewAura* parent_view_; | 762 RenderWidgetHostViewAura* parent_view_; |
| 751 | 763 |
| 752 // Tests should set these to nullptr if they've already triggered their | 764 // Tests should set these to nullptr if they've already triggered their |
| 753 // destruction. | 765 // destruction. |
| 754 MockRenderWidgetHostImpl* widget_host_; | 766 MockRenderWidgetHostImpl* widget_host_; |
| 755 FakeRenderWidgetHostViewAura* view_; | 767 FakeRenderWidgetHostViewAura* view_; |
| 756 | 768 |
| 757 IPC::TestSink* sink_; | 769 IPC::TestSink* sink_; |
| 770 base::test::ScopedFeatureList feature_list_; |
| 758 | 771 |
| 759 private: | 772 private: |
| 760 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewAuraTest); | 773 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewAuraTest); |
| 761 }; | 774 }; |
| 762 | 775 |
| 776 class RenderWidgetHostViewAuraRafAlignedTouchEnabledTest |
| 777 : public RenderWidgetHostViewAuraTest { |
| 778 public: |
| 779 void SetUp() override { |
| 780 EnableRafAlignedTouchInput(); |
| 781 RenderWidgetHostViewAuraTest::SetUp(); |
| 782 } |
| 783 }; |
| 784 |
| 785 class RenderWidgetHostViewAuraRafAlignedTouchDisabledTest |
| 786 : public RenderWidgetHostViewAuraTest { |
| 787 public: |
| 788 void SetUp() override { |
| 789 DisableRafAlignedTouchInput(); |
| 790 RenderWidgetHostViewAuraTest::SetUp(); |
| 791 } |
| 792 }; |
| 793 |
| 763 void InstallDelegatedFrameHostClient( | 794 void InstallDelegatedFrameHostClient( |
| 764 RenderWidgetHostViewAura* render_widget_host_view, | 795 RenderWidgetHostViewAura* render_widget_host_view, |
| 765 std::unique_ptr<DelegatedFrameHostClient> delegated_frame_host_client) { | 796 std::unique_ptr<DelegatedFrameHostClient> delegated_frame_host_client) { |
| 766 RenderWidgetHostViewAuraTest::InstallDelegatedFrameHostClient( | 797 RenderWidgetHostViewAuraTest::InstallDelegatedFrameHostClient( |
| 767 render_widget_host_view, std::move(delegated_frame_host_client)); | 798 render_widget_host_view, std::move(delegated_frame_host_client)); |
| 768 } | 799 } |
| 769 | 800 |
| 770 // Helper class to instantiate RenderWidgetHostViewGuest which is backed | 801 // Helper class to instantiate RenderWidgetHostViewGuest which is backed |
| 771 // by an aura platform view. | 802 // by an aura platform view. |
| 772 class RenderWidgetHostViewGuestAuraTest : public RenderWidgetHostViewAuraTest { | 803 class RenderWidgetHostViewGuestAuraTest : public RenderWidgetHostViewAuraTest { |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 811 void SetUp() override {} | 842 void SetUp() override {} |
| 812 | 843 |
| 813 protected: | 844 protected: |
| 814 void SetUpOverscrollEnvironmentWithDebounce(int debounce_interval_in_ms) { | 845 void SetUpOverscrollEnvironmentWithDebounce(int debounce_interval_in_ms) { |
| 815 SetUpOverscrollEnvironmentImpl(debounce_interval_in_ms); | 846 SetUpOverscrollEnvironmentImpl(debounce_interval_in_ms); |
| 816 } | 847 } |
| 817 | 848 |
| 818 void SetUpOverscrollEnvironment() { SetUpOverscrollEnvironmentImpl(0); } | 849 void SetUpOverscrollEnvironment() { SetUpOverscrollEnvironmentImpl(0); } |
| 819 | 850 |
| 820 void SetUpOverscrollEnvironmentImpl(int debounce_interval_in_ms) { | 851 void SetUpOverscrollEnvironmentImpl(int debounce_interval_in_ms) { |
| 852 EnableRafAlignedTouchInput(); |
| 821 ui::GestureConfiguration::GetInstance()->set_scroll_debounce_interval_in_ms( | 853 ui::GestureConfiguration::GetInstance()->set_scroll_debounce_interval_in_ms( |
| 822 debounce_interval_in_ms); | 854 debounce_interval_in_ms); |
| 823 | 855 |
| 824 RenderWidgetHostViewAuraTest::SetUp(); | 856 RenderWidgetHostViewAuraTest::SetUp(); |
| 825 | 857 |
| 826 view_->SetOverscrollControllerEnabled(true); | 858 view_->SetOverscrollControllerEnabled(true); |
| 827 overscroll_delegate_.reset(new TestOverscrollDelegate(view_)); | 859 overscroll_delegate_.reset(new TestOverscrollDelegate(view_)); |
| 828 view_->overscroll_controller()->set_delegate(overscroll_delegate_.get()); | 860 view_->overscroll_controller()->set_delegate(overscroll_delegate_.get()); |
| 829 | 861 |
| 830 view_->InitAsChild(nullptr); | 862 view_->InitAsChild(nullptr); |
| (...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1348 if (sink_->message_count() == 2) { | 1380 if (sink_->message_count() == 2) { |
| 1349 // Verify mouse event happens after the finish composing text event. | 1381 // Verify mouse event happens after the finish composing text event. |
| 1350 EXPECT_EQ(InputMsg_ImeFinishComposingText::ID, | 1382 EXPECT_EQ(InputMsg_ImeFinishComposingText::ID, |
| 1351 sink_->GetMessageAt(0)->type()); | 1383 sink_->GetMessageAt(0)->type()); |
| 1352 EXPECT_EQ(InputMsg_HandleInputEvent::ID, | 1384 EXPECT_EQ(InputMsg_HandleInputEvent::ID, |
| 1353 sink_->GetMessageAt(1)->type()); | 1385 sink_->GetMessageAt(1)->type()); |
| 1354 } | 1386 } |
| 1355 } | 1387 } |
| 1356 | 1388 |
| 1357 // Checks that touch-event state is maintained correctly. | 1389 // Checks that touch-event state is maintained correctly. |
| 1358 TEST_F(RenderWidgetHostViewAuraTest, TouchEventState) { | 1390 TEST_F(RenderWidgetHostViewAuraRafAlignedTouchDisabledTest, TouchEventState) { |
| 1359 view_->InitAsChild(nullptr); | 1391 view_->InitAsChild(nullptr); |
| 1360 view_->Show(); | 1392 view_->Show(); |
| 1361 GetSentMessageCountAndResetSink(); | 1393 GetSentMessageCountAndResetSink(); |
| 1362 | 1394 |
| 1363 // Start with no touch-event handler in the renderer. | 1395 // Start with no touch-event handler in the renderer. |
| 1364 widget_host_->OnMessageReceived(ViewHostMsg_HasTouchEventHandlers(0, false)); | 1396 widget_host_->OnMessageReceived(ViewHostMsg_HasTouchEventHandlers(0, false)); |
| 1365 | 1397 |
| 1366 ui::TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(30, 30), 0, | 1398 ui::TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(30, 30), 0, |
| 1367 ui::EventTimeForNow()); | 1399 ui::EventTimeForNow()); |
| 1368 ui::TouchEvent move(ui::ET_TOUCH_MOVED, gfx::Point(20, 20), 0, | 1400 ui::TouchEvent move(ui::ET_TOUCH_MOVED, gfx::Point(20, 20), 0, |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1429 EXPECT_EQ(ui::MotionEvent::ACTION_MOVE, pointer_state().GetAction()); | 1461 EXPECT_EQ(ui::MotionEvent::ACTION_MOVE, pointer_state().GetAction()); |
| 1430 EXPECT_EQ(1U, pointer_state().GetPointerCount()); | 1462 EXPECT_EQ(1U, pointer_state().GetPointerCount()); |
| 1431 | 1463 |
| 1432 ui::TouchEvent release2(ui::ET_TOUCH_RELEASED, gfx::Point(20, 20), 0, | 1464 ui::TouchEvent release2(ui::ET_TOUCH_RELEASED, gfx::Point(20, 20), 0, |
| 1433 base::TimeTicks::Now()); | 1465 base::TimeTicks::Now()); |
| 1434 view_->OnTouchEvent(&release2); | 1466 view_->OnTouchEvent(&release2); |
| 1435 EXPECT_TRUE(press.synchronous_handling_disabled()); | 1467 EXPECT_TRUE(press.synchronous_handling_disabled()); |
| 1436 EXPECT_EQ(0U, pointer_state().GetPointerCount()); | 1468 EXPECT_EQ(0U, pointer_state().GetPointerCount()); |
| 1437 } | 1469 } |
| 1438 | 1470 |
| 1471 // Checks that touch-event state is maintained correctly. |
| 1472 TEST_F(RenderWidgetHostViewAuraRafAlignedTouchEnabledTest, TouchEventState) { |
| 1473 view_->InitAsChild(nullptr); |
| 1474 view_->Show(); |
| 1475 GetSentMessageCountAndResetSink(); |
| 1476 |
| 1477 // Start with no touch-event handler in the renderer. |
| 1478 widget_host_->OnMessageReceived(ViewHostMsg_HasTouchEventHandlers(0, false)); |
| 1479 |
| 1480 ui::TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(30, 30), 0, |
| 1481 ui::EventTimeForNow()); |
| 1482 ui::TouchEvent move(ui::ET_TOUCH_MOVED, gfx::Point(20, 20), 0, |
| 1483 ui::EventTimeForNow()); |
| 1484 ui::TouchEvent release(ui::ET_TOUCH_RELEASED, gfx::Point(20, 20), 0, |
| 1485 ui::EventTimeForNow()); |
| 1486 |
| 1487 // The touch events should get forwarded from the view, but they should not |
| 1488 // reach the renderer. |
| 1489 view_->OnTouchEvent(&press); |
| 1490 EXPECT_EQ(0U, GetSentMessageCountAndResetSink()); |
| 1491 EXPECT_TRUE(press.synchronous_handling_disabled()); |
| 1492 EXPECT_EQ(ui::MotionEvent::ACTION_DOWN, pointer_state().GetAction()); |
| 1493 |
| 1494 view_->OnTouchEvent(&move); |
| 1495 EXPECT_EQ(0U, GetSentMessageCountAndResetSink()); |
| 1496 EXPECT_TRUE(press.synchronous_handling_disabled()); |
| 1497 EXPECT_EQ(ui::MotionEvent::ACTION_MOVE, pointer_state().GetAction()); |
| 1498 EXPECT_EQ(1U, pointer_state().GetPointerCount()); |
| 1499 |
| 1500 view_->OnTouchEvent(&release); |
| 1501 EXPECT_EQ(0U, GetSentMessageCountAndResetSink()); |
| 1502 EXPECT_TRUE(press.synchronous_handling_disabled()); |
| 1503 EXPECT_EQ(0U, pointer_state().GetPointerCount()); |
| 1504 |
| 1505 // Now install some touch-event handlers and do the same steps. The touch |
| 1506 // events should now be consumed. However, the touch-event state should be |
| 1507 // updated as before. |
| 1508 widget_host_->OnMessageReceived(ViewHostMsg_HasTouchEventHandlers(0, true)); |
| 1509 |
| 1510 view_->OnTouchEvent(&press); |
| 1511 EXPECT_EQ(1U, GetSentMessageCountAndResetSink()); |
| 1512 EXPECT_TRUE(press.synchronous_handling_disabled()); |
| 1513 EXPECT_EQ(ui::MotionEvent::ACTION_DOWN, pointer_state().GetAction()); |
| 1514 EXPECT_EQ(1U, pointer_state().GetPointerCount()); |
| 1515 |
| 1516 view_->OnTouchEvent(&move); |
| 1517 EXPECT_TRUE(move.synchronous_handling_disabled()); |
| 1518 EXPECT_EQ(ui::MotionEvent::ACTION_MOVE, pointer_state().GetAction()); |
| 1519 EXPECT_EQ(1U, pointer_state().GetPointerCount()); |
| 1520 view_->OnTouchEvent(&release); |
| 1521 EXPECT_TRUE(release.synchronous_handling_disabled()); |
| 1522 EXPECT_EQ(0U, pointer_state().GetPointerCount()); |
| 1523 |
| 1524 // Now start a touch event, and remove the event-handlers before the release. |
| 1525 view_->OnTouchEvent(&press); |
| 1526 EXPECT_TRUE(press.synchronous_handling_disabled()); |
| 1527 EXPECT_EQ(ui::MotionEvent::ACTION_DOWN, pointer_state().GetAction()); |
| 1528 EXPECT_EQ(1U, pointer_state().GetPointerCount()); |
| 1529 EXPECT_EQ(3U, GetSentMessageCountAndResetSink()); |
| 1530 |
| 1531 widget_host_->OnMessageReceived(ViewHostMsg_HasTouchEventHandlers(0, false)); |
| 1532 |
| 1533 // All outstanding events should have already been sent but no new events |
| 1534 // should get sent. |
| 1535 InputEventAck ack( |
| 1536 InputEventAckSource::COMPOSITOR_THREAD, blink::WebInputEvent::TouchStart, |
| 1537 INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS, press.unique_event_id()); |
| 1538 widget_host_->OnMessageReceived(InputHostMsg_HandleInputEvent_ACK(0, ack)); |
| 1539 EXPECT_EQ(0U, GetSentMessageCountAndResetSink()); |
| 1540 |
| 1541 ui::TouchEvent move2(ui::ET_TOUCH_MOVED, gfx::Point(20, 20), 0, |
| 1542 base::TimeTicks::Now()); |
| 1543 view_->OnTouchEvent(&move2); |
| 1544 EXPECT_TRUE(press.synchronous_handling_disabled()); |
| 1545 EXPECT_EQ(ui::MotionEvent::ACTION_MOVE, pointer_state().GetAction()); |
| 1546 EXPECT_EQ(1U, pointer_state().GetPointerCount()); |
| 1547 |
| 1548 ui::TouchEvent release2(ui::ET_TOUCH_RELEASED, gfx::Point(20, 20), 0, |
| 1549 base::TimeTicks::Now()); |
| 1550 view_->OnTouchEvent(&release2); |
| 1551 EXPECT_TRUE(press.synchronous_handling_disabled()); |
| 1552 EXPECT_EQ(0U, pointer_state().GetPointerCount()); |
| 1553 EXPECT_EQ(0U, GetSentMessageCountAndResetSink()); |
| 1554 } |
| 1555 |
| 1439 // Checks that touch-event state is maintained correctly for multiple touch | 1556 // Checks that touch-event state is maintained correctly for multiple touch |
| 1440 // points. | 1557 // points. |
| 1441 TEST_F(RenderWidgetHostViewAuraTest, MultiTouchPointsStates) { | 1558 TEST_F(RenderWidgetHostViewAuraTest, MultiTouchPointsStates) { |
| 1442 view_->InitAsFullscreen(parent_view_); | 1559 view_->InitAsFullscreen(parent_view_); |
| 1443 view_->Show(); | 1560 view_->Show(); |
| 1444 view_->UseFakeDispatcher(); | 1561 view_->UseFakeDispatcher(); |
| 1445 GetSentMessageCountAndResetSink(); | 1562 GetSentMessageCountAndResetSink(); |
| 1446 | 1563 |
| 1447 ui::TouchEvent press0(ui::ET_TOUCH_PRESSED, gfx::Point(30, 30), 0, | 1564 ui::TouchEvent press0(ui::ET_TOUCH_PRESSED, gfx::Point(30, 30), 0, |
| 1448 ui::EventTimeForNow()); | 1565 ui::EventTimeForNow()); |
| (...skipping 1850 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3299 // initiate the navigation gesture. | 3416 // initiate the navigation gesture. |
| 3300 SimulateGestureScrollUpdateEvent(55, -5, 0); | 3417 SimulateGestureScrollUpdateEvent(55, -5, 0); |
| 3301 SendInputEventACK(WebInputEvent::GestureScrollUpdate, | 3418 SendInputEventACK(WebInputEvent::GestureScrollUpdate, |
| 3302 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | 3419 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
| 3303 EXPECT_EQ(OVERSCROLL_EAST, overscroll_mode()); | 3420 EXPECT_EQ(OVERSCROLL_EAST, overscroll_mode()); |
| 3304 EXPECT_EQ(OVERSCROLL_EAST, overscroll_delegate()->current_mode()); | 3421 EXPECT_EQ(OVERSCROLL_EAST, overscroll_delegate()->current_mode()); |
| 3305 EXPECT_EQ(55.f, overscroll_delta_x()); | 3422 EXPECT_EQ(55.f, overscroll_delta_x()); |
| 3306 EXPECT_EQ(-5.f, overscroll_delta_y()); | 3423 EXPECT_EQ(-5.f, overscroll_delta_y()); |
| 3307 EXPECT_EQ(5.f, overscroll_delegate()->delta_x()); | 3424 EXPECT_EQ(5.f, overscroll_delegate()->delta_x()); |
| 3308 EXPECT_EQ(-5.f, overscroll_delegate()->delta_y()); | 3425 EXPECT_EQ(-5.f, overscroll_delegate()->delta_y()); |
| 3309 EXPECT_EQ(1U, GetSentMessageCountAndResetSink()); | 3426 EXPECT_EQ(2U, GetSentMessageCountAndResetSink()); |
| 3310 | 3427 |
| 3311 // Send another gesture update event. This event should be consumed by the | 3428 // Send another gesture update event. This event should be consumed by the |
| 3312 // controller, and not be forwarded to the renderer. The gesture-event filter | 3429 // controller, and not be forwarded to the renderer. The gesture-event filter |
| 3313 // should not also receive this event. | 3430 // should not also receive this event. |
| 3314 SimulateGestureScrollUpdateEvent(10, -5, 0); | 3431 SimulateGestureScrollUpdateEvent(10, -5, 0); |
| 3315 EXPECT_EQ(OVERSCROLL_EAST, overscroll_mode()); | 3432 EXPECT_EQ(OVERSCROLL_EAST, overscroll_mode()); |
| 3316 EXPECT_EQ(OVERSCROLL_EAST, overscroll_delegate()->current_mode()); | 3433 EXPECT_EQ(OVERSCROLL_EAST, overscroll_delegate()->current_mode()); |
| 3317 EXPECT_EQ(65.f, overscroll_delta_x()); | 3434 EXPECT_EQ(65.f, overscroll_delta_x()); |
| 3318 EXPECT_EQ(-10.f, overscroll_delta_y()); | 3435 EXPECT_EQ(-10.f, overscroll_delta_y()); |
| 3319 EXPECT_EQ(15.f, overscroll_delegate()->delta_x()); | 3436 EXPECT_EQ(15.f, overscroll_delegate()->delta_x()); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3365 GestureScrollDebounceOverscrolls) { | 3482 GestureScrollDebounceOverscrolls) { |
| 3366 SetUpOverscrollEnvironmentWithDebounce(100); | 3483 SetUpOverscrollEnvironmentWithDebounce(100); |
| 3367 | 3484 |
| 3368 // Start scrolling. Receive ACK as it being processed. | 3485 // Start scrolling. Receive ACK as it being processed. |
| 3369 SimulateGestureEvent(WebInputEvent::GestureScrollBegin, | 3486 SimulateGestureEvent(WebInputEvent::GestureScrollBegin, |
| 3370 blink::WebGestureDeviceTouchscreen); | 3487 blink::WebGestureDeviceTouchscreen); |
| 3371 EXPECT_EQ(1U, GetSentMessageCountAndResetSink()); | 3488 EXPECT_EQ(1U, GetSentMessageCountAndResetSink()); |
| 3372 | 3489 |
| 3373 // Send update events. | 3490 // Send update events. |
| 3374 SimulateGestureScrollUpdateEvent(25, 0, 0); | 3491 SimulateGestureScrollUpdateEvent(25, 0, 0); |
| 3375 EXPECT_EQ(1U, GetSentMessageCountAndResetSink()); | 3492 EXPECT_EQ(2U, GetSentMessageCountAndResetSink()); |
| 3376 | 3493 |
| 3377 // Quickly end and restart the scroll gesture. These two events should get | 3494 // Quickly end and restart the scroll gesture. These two events should get |
| 3378 // discarded. | 3495 // discarded. |
| 3379 SimulateGestureEvent(WebInputEvent::GestureScrollEnd, | 3496 SimulateGestureEvent(WebInputEvent::GestureScrollEnd, |
| 3380 blink::WebGestureDeviceTouchscreen); | 3497 blink::WebGestureDeviceTouchscreen); |
| 3381 EXPECT_EQ(0U, sink_->message_count()); | 3498 EXPECT_EQ(0U, sink_->message_count()); |
| 3382 | 3499 |
| 3383 SimulateGestureEvent(WebInputEvent::GestureScrollBegin, | 3500 SimulateGestureEvent(WebInputEvent::GestureScrollBegin, |
| 3384 blink::WebGestureDeviceTouchscreen); | 3501 blink::WebGestureDeviceTouchscreen); |
| 3385 EXPECT_EQ(0U, sink_->message_count()); | 3502 EXPECT_EQ(0U, sink_->message_count()); |
| 3386 | 3503 |
| 3387 // Send another update event. This should get into the queue. | 3504 // Send another update event. This should be sent right away. |
| 3388 SimulateGestureScrollUpdateEvent(30, 0, 0); | 3505 SimulateGestureScrollUpdateEvent(30, 0, 0); |
| 3389 EXPECT_EQ(0U, sink_->message_count()); | 3506 EXPECT_EQ(1U, GetSentMessageCountAndResetSink()); |
| 3390 | 3507 |
| 3391 // Receive an ACK for the first scroll-update event as not being processed. | 3508 // Receive an ACK for the first scroll-update event as not being processed. |
| 3392 // This will contribute to the overscroll gesture, but not enough for the | 3509 // This will contribute to the overscroll gesture, but not enough for the |
| 3393 // overscroll controller to start consuming gesture events. This also cause | 3510 // overscroll controller to start consuming gesture events. This also cause |
| 3394 // the queued gesture event to be forwarded to the renderer. | 3511 // the queued gesture event to be forwarded to the renderer. |
| 3395 SendInputEventACK(WebInputEvent::GestureScrollUpdate, | 3512 SendInputEventACK(WebInputEvent::GestureScrollUpdate, |
| 3396 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | 3513 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
| 3397 EXPECT_EQ(OVERSCROLL_NONE, overscroll_mode()); | 3514 EXPECT_EQ(OVERSCROLL_NONE, overscroll_mode()); |
| 3398 EXPECT_EQ(OVERSCROLL_NONE, overscroll_delegate()->current_mode()); | 3515 EXPECT_EQ(OVERSCROLL_NONE, overscroll_delegate()->current_mode()); |
| 3399 EXPECT_EQ(1U, GetSentMessageCountAndResetSink()); | 3516 EXPECT_EQ(1U, GetSentMessageCountAndResetSink()); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 3422 GestureScrollDebounceTimerOverscroll) { | 3539 GestureScrollDebounceTimerOverscroll) { |
| 3423 SetUpOverscrollEnvironmentWithDebounce(10); | 3540 SetUpOverscrollEnvironmentWithDebounce(10); |
| 3424 | 3541 |
| 3425 // Start scrolling. Receive ACK as it being processed. | 3542 // Start scrolling. Receive ACK as it being processed. |
| 3426 SimulateGestureEvent(WebInputEvent::GestureScrollBegin, | 3543 SimulateGestureEvent(WebInputEvent::GestureScrollBegin, |
| 3427 blink::WebGestureDeviceTouchscreen); | 3544 blink::WebGestureDeviceTouchscreen); |
| 3428 EXPECT_EQ(1U, GetSentMessageCountAndResetSink()); | 3545 EXPECT_EQ(1U, GetSentMessageCountAndResetSink()); |
| 3429 | 3546 |
| 3430 // Send update events. | 3547 // Send update events. |
| 3431 SimulateGestureScrollUpdateEvent(55, 0, 0); | 3548 SimulateGestureScrollUpdateEvent(55, 0, 0); |
| 3432 EXPECT_EQ(1U, GetSentMessageCountAndResetSink()); | 3549 EXPECT_EQ(2U, GetSentMessageCountAndResetSink()); |
| 3433 | 3550 |
| 3434 // Send an end event. This should get in the debounce queue. | 3551 // Send an end event. This should get in the debounce queue. |
| 3435 SimulateGestureEvent(WebInputEvent::GestureScrollEnd, | 3552 SimulateGestureEvent(WebInputEvent::GestureScrollEnd, |
| 3436 blink::WebGestureDeviceTouchscreen); | 3553 blink::WebGestureDeviceTouchscreen); |
| 3437 EXPECT_EQ(0U, sink_->message_count()); | 3554 EXPECT_EQ(0U, sink_->message_count()); |
| 3438 | 3555 |
| 3439 // Receive ACK for the scroll-update event. | 3556 // Receive ACK for the scroll-update event. |
| 3440 SendInputEventACK(WebInputEvent::GestureScrollUpdate, | 3557 SendInputEventACK(WebInputEvent::GestureScrollUpdate, |
| 3441 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | 3558 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
| 3442 EXPECT_EQ(OVERSCROLL_EAST, overscroll_mode()); | 3559 EXPECT_EQ(OVERSCROLL_EAST, overscroll_mode()); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3483 | 3600 |
| 3484 EXPECT_EQ(OVERSCROLL_NONE, overscroll_mode()); | 3601 EXPECT_EQ(OVERSCROLL_NONE, overscroll_mode()); |
| 3485 EXPECT_EQ(OVERSCROLL_NONE, overscroll_delegate()->current_mode()); | 3602 EXPECT_EQ(OVERSCROLL_NONE, overscroll_delegate()->current_mode()); |
| 3486 | 3603 |
| 3487 SimulateGestureEvent(WebInputEvent::GestureScrollBegin, | 3604 SimulateGestureEvent(WebInputEvent::GestureScrollBegin, |
| 3488 blink::WebGestureDeviceTouchscreen); | 3605 blink::WebGestureDeviceTouchscreen); |
| 3489 EXPECT_EQ(1U, GetSentMessageCountAndResetSink()); | 3606 EXPECT_EQ(1U, GetSentMessageCountAndResetSink()); |
| 3490 SimulateGestureScrollUpdateEvent(20, 0, 0); | 3607 SimulateGestureScrollUpdateEvent(20, 0, 0); |
| 3491 SendInputEventACK(WebInputEvent::GestureScrollUpdate, | 3608 SendInputEventACK(WebInputEvent::GestureScrollUpdate, |
| 3492 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | 3609 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
| 3493 EXPECT_EQ(1U, GetSentMessageCountAndResetSink()); | 3610 EXPECT_EQ(2U, GetSentMessageCountAndResetSink()); |
| 3494 EXPECT_EQ(OVERSCROLL_NONE, overscroll_mode()); | 3611 EXPECT_EQ(OVERSCROLL_NONE, overscroll_mode()); |
| 3495 EXPECT_EQ(OVERSCROLL_NONE, overscroll_delegate()->current_mode()); | 3612 EXPECT_EQ(OVERSCROLL_NONE, overscroll_delegate()->current_mode()); |
| 3496 | 3613 |
| 3497 // Another touch move event should reach the renderer since overscroll hasn't | 3614 // Another touch move event should reach the renderer since overscroll hasn't |
| 3498 // started yet. Note that touch events sent during the scroll period may | 3615 // started yet. Note that touch events sent during the scroll period may |
| 3499 // not require an ack (having been marked uncancelable). | 3616 // not require an ack (having been marked uncancelable). |
| 3500 MoveTouchPoint(0, 65, 10); | 3617 MoveTouchPoint(0, 65, 10); |
| 3501 SendTouchEvent(); | 3618 SendTouchEvent(); |
| 3502 AckLastSentInputEventIfNecessary(INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | 3619 AckLastSentInputEventIfNecessary(INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
| 3503 EXPECT_EQ(1U, GetSentMessageCountAndResetSink()); | 3620 EXPECT_EQ(1U, GetSentMessageCountAndResetSink()); |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3580 SimulateGestureEvent(WebInputEvent::GestureScrollBegin, | 3697 SimulateGestureEvent(WebInputEvent::GestureScrollBegin, |
| 3581 blink::WebGestureDeviceTouchscreen); | 3698 blink::WebGestureDeviceTouchscreen); |
| 3582 EXPECT_EQ(1U, GetSentMessageCountAndResetSink()); | 3699 EXPECT_EQ(1U, GetSentMessageCountAndResetSink()); |
| 3583 // The scroll begin event will have received a synthetic ack from the input | 3700 // The scroll begin event will have received a synthetic ack from the input |
| 3584 // router. | 3701 // router. |
| 3585 EXPECT_EQ(OVERSCROLL_NONE, overscroll_mode()); | 3702 EXPECT_EQ(OVERSCROLL_NONE, overscroll_mode()); |
| 3586 EXPECT_EQ(OVERSCROLL_NONE, overscroll_delegate()->current_mode()); | 3703 EXPECT_EQ(OVERSCROLL_NONE, overscroll_delegate()->current_mode()); |
| 3587 | 3704 |
| 3588 // Send update events. | 3705 // Send update events. |
| 3589 SimulateGestureScrollUpdateEvent(55, -5, 0); | 3706 SimulateGestureScrollUpdateEvent(55, -5, 0); |
| 3590 EXPECT_EQ(1U, GetSentMessageCountAndResetSink()); | 3707 EXPECT_EQ(2U, GetSentMessageCountAndResetSink()); |
| 3591 EXPECT_EQ(OVERSCROLL_NONE, overscroll_mode()); | 3708 EXPECT_EQ(OVERSCROLL_NONE, overscroll_mode()); |
| 3592 EXPECT_EQ(OVERSCROLL_NONE, overscroll_delegate()->current_mode()); | 3709 EXPECT_EQ(OVERSCROLL_NONE, overscroll_delegate()->current_mode()); |
| 3593 | 3710 |
| 3594 SendInputEventACK(WebInputEvent::GestureScrollUpdate, | 3711 SendInputEventACK(WebInputEvent::GestureScrollUpdate, |
| 3595 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | 3712 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
| 3596 EXPECT_EQ(0U, sink_->message_count()); | 3713 EXPECT_EQ(0U, sink_->message_count()); |
| 3597 EXPECT_EQ(OVERSCROLL_EAST, overscroll_mode()); | 3714 EXPECT_EQ(OVERSCROLL_EAST, overscroll_mode()); |
| 3598 EXPECT_EQ(OVERSCROLL_EAST, overscroll_delegate()->current_mode()); | 3715 EXPECT_EQ(OVERSCROLL_EAST, overscroll_delegate()->current_mode()); |
| 3599 EXPECT_EQ(55.f, overscroll_delta_x()); | 3716 EXPECT_EQ(55.f, overscroll_delta_x()); |
| 3600 EXPECT_EQ(5.f, overscroll_delegate()->delta_x()); | 3717 EXPECT_EQ(5.f, overscroll_delegate()->delta_x()); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 3615 | 3732 |
| 3616 // Start scrolling. Receive ACK as it being processed. | 3733 // Start scrolling. Receive ACK as it being processed. |
| 3617 SimulateGestureEvent(WebInputEvent::GestureScrollBegin, | 3734 SimulateGestureEvent(WebInputEvent::GestureScrollBegin, |
| 3618 blink::WebGestureDeviceTouchscreen); | 3735 blink::WebGestureDeviceTouchscreen); |
| 3619 EXPECT_EQ(1U, GetSentMessageCountAndResetSink()); | 3736 EXPECT_EQ(1U, GetSentMessageCountAndResetSink()); |
| 3620 EXPECT_EQ(OVERSCROLL_NONE, overscroll_mode()); | 3737 EXPECT_EQ(OVERSCROLL_NONE, overscroll_mode()); |
| 3621 EXPECT_EQ(OVERSCROLL_NONE, overscroll_delegate()->current_mode()); | 3738 EXPECT_EQ(OVERSCROLL_NONE, overscroll_delegate()->current_mode()); |
| 3622 | 3739 |
| 3623 // Send update events. | 3740 // Send update events. |
| 3624 SimulateGestureScrollUpdateEvent(235, -5, 0); | 3741 SimulateGestureScrollUpdateEvent(235, -5, 0); |
| 3625 EXPECT_EQ(1U, GetSentMessageCountAndResetSink()); | 3742 EXPECT_EQ(2U, GetSentMessageCountAndResetSink()); |
| 3626 EXPECT_EQ(OVERSCROLL_NONE, overscroll_mode()); | 3743 EXPECT_EQ(OVERSCROLL_NONE, overscroll_mode()); |
| 3627 EXPECT_EQ(OVERSCROLL_NONE, overscroll_delegate()->current_mode()); | 3744 EXPECT_EQ(OVERSCROLL_NONE, overscroll_delegate()->current_mode()); |
| 3628 | 3745 |
| 3629 SendInputEventACK(WebInputEvent::GestureScrollUpdate, | 3746 SendInputEventACK(WebInputEvent::GestureScrollUpdate, |
| 3630 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | 3747 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
| 3631 EXPECT_EQ(0U, sink_->message_count()); | 3748 EXPECT_EQ(0U, sink_->message_count()); |
| 3632 EXPECT_EQ(OVERSCROLL_EAST, overscroll_mode()); | 3749 EXPECT_EQ(OVERSCROLL_EAST, overscroll_mode()); |
| 3633 EXPECT_EQ(OVERSCROLL_EAST, overscroll_delegate()->current_mode()); | 3750 EXPECT_EQ(OVERSCROLL_EAST, overscroll_delegate()->current_mode()); |
| 3634 EXPECT_EQ(235.f, overscroll_delta_x()); | 3751 EXPECT_EQ(235.f, overscroll_delta_x()); |
| 3635 EXPECT_EQ(185.f, overscroll_delegate()->delta_x()); | 3752 EXPECT_EQ(185.f, overscroll_delegate()->delta_x()); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 3652 TEST_F(RenderWidgetHostViewAuraOverscrollTest, OverscrollDirectionChange) { | 3769 TEST_F(RenderWidgetHostViewAuraOverscrollTest, OverscrollDirectionChange) { |
| 3653 SetUpOverscrollEnvironmentWithDebounce(100); | 3770 SetUpOverscrollEnvironmentWithDebounce(100); |
| 3654 | 3771 |
| 3655 // Start scrolling. Receive ACK as it being processed. | 3772 // Start scrolling. Receive ACK as it being processed. |
| 3656 SimulateGestureEvent(WebInputEvent::GestureScrollBegin, | 3773 SimulateGestureEvent(WebInputEvent::GestureScrollBegin, |
| 3657 blink::WebGestureDeviceTouchscreen); | 3774 blink::WebGestureDeviceTouchscreen); |
| 3658 EXPECT_EQ(1U, GetSentMessageCountAndResetSink()); | 3775 EXPECT_EQ(1U, GetSentMessageCountAndResetSink()); |
| 3659 | 3776 |
| 3660 // Send update events and receive ack as not consumed. | 3777 // Send update events and receive ack as not consumed. |
| 3661 SimulateGestureScrollUpdateEvent(125, -5, 0); | 3778 SimulateGestureScrollUpdateEvent(125, -5, 0); |
| 3662 EXPECT_EQ(1U, GetSentMessageCountAndResetSink()); | 3779 EXPECT_EQ(2U, GetSentMessageCountAndResetSink()); |
| 3663 | 3780 |
| 3664 SendInputEventACK(WebInputEvent::GestureScrollUpdate, | 3781 SendInputEventACK(WebInputEvent::GestureScrollUpdate, |
| 3665 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | 3782 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
| 3666 EXPECT_EQ(OVERSCROLL_EAST, overscroll_mode()); | 3783 EXPECT_EQ(OVERSCROLL_EAST, overscroll_mode()); |
| 3667 EXPECT_EQ(OVERSCROLL_EAST, overscroll_delegate()->current_mode()); | 3784 EXPECT_EQ(OVERSCROLL_EAST, overscroll_delegate()->current_mode()); |
| 3668 EXPECT_EQ(0U, sink_->message_count()); | 3785 EXPECT_EQ(0U, sink_->message_count()); |
| 3669 | 3786 |
| 3670 // Send another update event, but in the reverse direction. The overscroll | 3787 // Send another update event, but in the reverse direction. The overscroll |
| 3671 // controller will not consume the event, because it is not triggering | 3788 // controller will not consume the event, because it is not triggering |
| 3672 // gesture-nav. | 3789 // gesture-nav. |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3892 | 4009 |
| 3893 // Start an overscroll with gesture scroll. In the middle of the scroll, blur | 4010 // Start an overscroll with gesture scroll. In the middle of the scroll, blur |
| 3894 // the host. | 4011 // the host. |
| 3895 SimulateGestureEvent(WebInputEvent::GestureScrollBegin, | 4012 SimulateGestureEvent(WebInputEvent::GestureScrollBegin, |
| 3896 blink::WebGestureDeviceTouchscreen); | 4013 blink::WebGestureDeviceTouchscreen); |
| 3897 SimulateGestureScrollUpdateEvent(300, -5, 0); | 4014 SimulateGestureScrollUpdateEvent(300, -5, 0); |
| 3898 SendInputEventACK(WebInputEvent::GestureScrollUpdate, | 4015 SendInputEventACK(WebInputEvent::GestureScrollUpdate, |
| 3899 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | 4016 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
| 3900 EXPECT_EQ(OVERSCROLL_EAST, overscroll_mode()); | 4017 EXPECT_EQ(OVERSCROLL_EAST, overscroll_mode()); |
| 3901 EXPECT_EQ(OVERSCROLL_EAST, overscroll_delegate()->current_mode()); | 4018 EXPECT_EQ(OVERSCROLL_EAST, overscroll_delegate()->current_mode()); |
| 3902 EXPECT_EQ(2U, GetSentMessageCountAndResetSink()); | 4019 EXPECT_EQ(3U, GetSentMessageCountAndResetSink()); |
| 3903 | 4020 |
| 3904 view_->OnWindowFocused(nullptr, view_->GetNativeView()); | 4021 view_->OnWindowFocused(nullptr, view_->GetNativeView()); |
| 3905 EXPECT_EQ(OVERSCROLL_NONE, overscroll_mode()); | 4022 EXPECT_EQ(OVERSCROLL_NONE, overscroll_mode()); |
| 3906 EXPECT_EQ(OVERSCROLL_NONE, overscroll_delegate()->current_mode()); | 4023 EXPECT_EQ(OVERSCROLL_NONE, overscroll_delegate()->current_mode()); |
| 3907 EXPECT_EQ(OVERSCROLL_NONE, overscroll_delegate()->completed_mode()); | 4024 EXPECT_EQ(OVERSCROLL_NONE, overscroll_delegate()->completed_mode()); |
| 3908 EXPECT_EQ(0.f, overscroll_delegate()->delta_x()); | 4025 EXPECT_EQ(0.f, overscroll_delegate()->delta_x()); |
| 3909 EXPECT_EQ(0.f, overscroll_delegate()->delta_y()); | 4026 EXPECT_EQ(0.f, overscroll_delegate()->delta_y()); |
| 3910 sink_->ClearMessages(); | 4027 sink_->ClearMessages(); |
| 3911 | 4028 |
| 3912 SimulateGestureEvent(WebInputEvent::GestureScrollEnd, | 4029 SimulateGestureEvent(WebInputEvent::GestureScrollEnd, |
| 3913 blink::WebGestureDeviceTouchscreen); | 4030 blink::WebGestureDeviceTouchscreen); |
| 3914 EXPECT_EQ(1U, GetSentMessageCountAndResetSink()); | 4031 EXPECT_EQ(1U, GetSentMessageCountAndResetSink()); |
| 3915 | 4032 |
| 3916 // Start a scroll gesture again. This should correctly start the overscroll | 4033 // Start a scroll gesture again. This should correctly start the overscroll |
| 3917 // after the threshold. | 4034 // after the threshold. |
| 3918 SimulateGestureEvent(WebInputEvent::GestureScrollBegin, | 4035 SimulateGestureEvent(WebInputEvent::GestureScrollBegin, |
| 3919 blink::WebGestureDeviceTouchscreen); | 4036 blink::WebGestureDeviceTouchscreen); |
| 3920 SimulateGestureScrollUpdateEvent(300, -5, 0); | 4037 SimulateGestureScrollUpdateEvent(300, -5, 0); |
| 3921 SendInputEventACK(WebInputEvent::GestureScrollUpdate, | 4038 SendInputEventACK(WebInputEvent::GestureScrollUpdate, |
| 3922 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | 4039 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
| 3923 EXPECT_EQ(OVERSCROLL_EAST, overscroll_mode()); | 4040 EXPECT_EQ(OVERSCROLL_EAST, overscroll_mode()); |
| 3924 EXPECT_EQ(OVERSCROLL_EAST, overscroll_delegate()->current_mode()); | 4041 EXPECT_EQ(OVERSCROLL_EAST, overscroll_delegate()->current_mode()); |
| 3925 EXPECT_EQ(OVERSCROLL_NONE, overscroll_delegate()->completed_mode()); | 4042 EXPECT_EQ(OVERSCROLL_NONE, overscroll_delegate()->completed_mode()); |
| 3926 | 4043 |
| 3927 SimulateGestureEvent(WebInputEvent::GestureScrollEnd, | 4044 SimulateGestureEvent(WebInputEvent::GestureScrollEnd, |
| 3928 blink::WebGestureDeviceTouchscreen); | 4045 blink::WebGestureDeviceTouchscreen); |
| 3929 EXPECT_EQ(OVERSCROLL_NONE, overscroll_delegate()->current_mode()); | 4046 EXPECT_EQ(OVERSCROLL_NONE, overscroll_delegate()->current_mode()); |
| 3930 EXPECT_EQ(OVERSCROLL_EAST, overscroll_delegate()->completed_mode()); | 4047 EXPECT_EQ(OVERSCROLL_EAST, overscroll_delegate()->completed_mode()); |
| 3931 EXPECT_EQ(3U, sink_->message_count()); | 4048 EXPECT_EQ(4U, sink_->message_count()); |
| 3932 } | 4049 } |
| 3933 | 4050 |
| 3934 // Tests that when view initiated shutdown happens (i.e. RWHView is deleted | 4051 // Tests that when view initiated shutdown happens (i.e. RWHView is deleted |
| 3935 // before RWH), we clean up properly and don't leak the RWHVGuest. | 4052 // before RWH), we clean up properly and don't leak the RWHVGuest. |
| 3936 TEST_F(RenderWidgetHostViewGuestAuraTest, GuestViewDoesNotLeak) { | 4053 TEST_F(RenderWidgetHostViewGuestAuraTest, GuestViewDoesNotLeak) { |
| 3937 view_->InitAsChild(nullptr); | 4054 view_->InitAsChild(nullptr); |
| 3938 TearDownEnvironment(); | 4055 TearDownEnvironment(); |
| 3939 ASSERT_FALSE(guest_view_weak_.get()); | 4056 ASSERT_FALSE(guest_view_weak_.get()); |
| 3940 } | 4057 } |
| 3941 | 4058 |
| (...skipping 774 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4716 // There is no composition in the beginning. | 4833 // There is no composition in the beginning. |
| 4717 EXPECT_FALSE(has_composition_text()); | 4834 EXPECT_FALSE(has_composition_text()); |
| 4718 SetHasCompositionTextToTrue(); | 4835 SetHasCompositionTextToTrue(); |
| 4719 view->ImeCancelComposition(); | 4836 view->ImeCancelComposition(); |
| 4720 // The composition must have been canceled. | 4837 // The composition must have been canceled. |
| 4721 EXPECT_FALSE(has_composition_text()); | 4838 EXPECT_FALSE(has_composition_text()); |
| 4722 } | 4839 } |
| 4723 } | 4840 } |
| 4724 | 4841 |
| 4725 } // namespace content | 4842 } // namespace content |
| OLD | NEW |