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