| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 11555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11566 WebInputEvent::kMouseUp, WebFloatPoint(1, 1), WebFloatPoint(1, 1), | 11566 WebInputEvent::kMouseUp, WebFloatPoint(1, 1), WebFloatPoint(1, 1), |
| 11567 WebPointerProperties::Button::kLeft, 0, | 11567 WebPointerProperties::Button::kLeft, 0, |
| 11568 WebInputEvent::Modifiers::kLeftButtonDown, TimeTicks::Now().InSeconds()); | 11568 WebInputEvent::Modifiers::kLeftButtonDown, TimeTicks::Now().InSeconds()); |
| 11569 mouse_release_event.SetFrameScale(1); | 11569 mouse_release_event.SetFrameScale(1); |
| 11570 document->GetFrame()->GetEventHandler().HandleMouseReleaseEvent( | 11570 document->GetFrame()->GetEventHandler().HandleMouseReleaseEvent( |
| 11571 mouse_release_event); | 11571 mouse_release_event); |
| 11572 EXPECT_EQ(scrollbar->PressedPart(), ScrollbarPart::kNoPart); | 11572 EXPECT_EQ(scrollbar->PressedPart(), ScrollbarPart::kNoPart); |
| 11573 EXPECT_EQ(scrollbar->HoveredPart(), ScrollbarPart::kNoPart); | 11573 EXPECT_EQ(scrollbar->HoveredPart(), ScrollbarPart::kNoPart); |
| 11574 } | 11574 } |
| 11575 | 11575 |
| 11576 class TapChangeHoverStateTest : public ParameterizedWebFrameTest { | |
| 11577 public: | |
| 11578 void RunTest(bool viewport_enabled, | |
| 11579 bool viewport_meta, | |
| 11580 bool should_change_hover_state) { | |
| 11581 std::string test_page = | |
| 11582 viewport_meta ? "viewport-2-div.html" : "noviewport-2-div.html"; | |
| 11583 | |
| 11584 FakeCompositingWebViewClient client; | |
| 11585 RegisterMockedHttpURLLoad(test_page); | |
| 11586 FrameTestHelpers::WebViewHelper web_view_helper; | |
| 11587 WebViewBase* web_view; | |
| 11588 if (viewport_enabled) { | |
| 11589 web_view = web_view_helper.InitializeAndLoad( | |
| 11590 base_url_ + test_page, nullptr, &client, nullptr, ConfigureAndroid); | |
| 11591 } else { | |
| 11592 web_view = web_view_helper.InitializeAndLoad(base_url_ + test_page); | |
| 11593 } | |
| 11594 web_view_helper.Resize(WebSize(250, 250)); | |
| 11595 | |
| 11596 Document* document = | |
| 11597 ToLocalFrame(web_view->GetPage()->MainFrame())->GetDocument(); | |
| 11598 | |
| 11599 Element* div1 = document->getElementById("div1"); | |
| 11600 Element* div2 = document->getElementById("div2"); | |
| 11601 | |
| 11602 // Move mouse over div1 should hover div1. | |
| 11603 WebMouseEvent mouse_move_over_div1( | |
| 11604 WebInputEvent::kMouseMove, WebFloatPoint(10, 10), WebFloatPoint(10, 10), | |
| 11605 WebPointerProperties::Button::kNoButton, 0, WebInputEvent::kNoModifiers, | |
| 11606 TimeTicks::Now().InSeconds()); | |
| 11607 mouse_move_over_div1.SetFrameScale(1); | |
| 11608 document->GetFrame()->GetEventHandler().HandleMouseMoveEvent( | |
| 11609 mouse_move_over_div1, Vector<WebMouseEvent>()); | |
| 11610 | |
| 11611 DCHECK(document->HoverElement() == div1); | |
| 11612 | |
| 11613 // Tap on div2. | |
| 11614 WebGestureEvent tap_on_div2(WebInputEvent::kGestureTap, | |
| 11615 WebInputEvent::kNoModifiers, | |
| 11616 WebInputEvent::kTimeStampForTesting); | |
| 11617 tap_on_div2.SetFrameScale(1); | |
| 11618 tap_on_div2.x = tap_on_div2.global_x = 10; | |
| 11619 tap_on_div2.y = tap_on_div2.global_y = 110; | |
| 11620 tap_on_div2.source_device = kWebGestureDeviceTouchscreen; | |
| 11621 web_view_helper.WebView() | |
| 11622 ->MainFrameImpl() | |
| 11623 ->GetFrame() | |
| 11624 ->GetEventHandler() | |
| 11625 .HandleGestureEvent(tap_on_div2); | |
| 11626 | |
| 11627 Element* expected_hover_element = should_change_hover_state ? div2 : div1; | |
| 11628 EXPECT_EQ(expected_hover_element, document->HoverElement()); | |
| 11629 } | |
| 11630 }; | |
| 11631 | |
| 11632 INSTANTIATE_TEST_CASE_P(All, TapChangeHoverStateTest, ::testing::Bool()); | |
| 11633 | |
| 11634 TEST_P(TapChangeHoverStateTest, TapNotChangeHoverStateOnViewportMetaAndMobile) { | |
| 11635 RunTest(true, true, false); | |
| 11636 } | |
| 11637 | |
| 11638 TEST_P(TapChangeHoverStateTest, TapChangeHoverStateOnNoViewportMetaAndMobile) { | |
| 11639 RunTest(true, false, true); | |
| 11640 } | |
| 11641 | |
| 11642 TEST_P(TapChangeHoverStateTest, TapChangeHoverStateOnViewportMetaAndDesktop) { | |
| 11643 RunTest(false, true, true); | |
| 11644 } | |
| 11645 | |
| 11646 TEST_P(ParameterizedWebFrameTest, | 11576 TEST_P(ParameterizedWebFrameTest, |
| 11647 CustomScrollbarInOverlayScrollbarThemeWillNotCauseDCHECKFails) { | 11577 CustomScrollbarInOverlayScrollbarThemeWillNotCauseDCHECKFails) { |
| 11648 RegisterMockedHttpURLLoad( | 11578 RegisterMockedHttpURLLoad( |
| 11649 "custom-scrollbar-dcheck-failed-when-paint-scroll-corner.html"); | 11579 "custom-scrollbar-dcheck-failed-when-paint-scroll-corner.html"); |
| 11650 FrameTestHelpers::WebViewHelper web_view_helper; | 11580 FrameTestHelpers::WebViewHelper web_view_helper; |
| 11651 WebViewBase* web_view = web_view_helper.InitializeAndLoad( | 11581 WebViewBase* web_view = web_view_helper.InitializeAndLoad( |
| 11652 base_url_ + | 11582 base_url_ + |
| 11653 "custom-scrollbar-dcheck-failed-when-paint-scroll-corner.html"); | 11583 "custom-scrollbar-dcheck-failed-when-paint-scroll-corner.html"); |
| 11654 | 11584 |
| 11655 web_view_helper.Resize(WebSize(200, 200)); | 11585 web_view_helper.Resize(WebSize(200, 200)); |
| (...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12257 tester.ExpectBucketCount(histogramName, kSPANavTypeOtherFragmentNavigation, | 12187 tester.ExpectBucketCount(histogramName, kSPANavTypeOtherFragmentNavigation, |
| 12258 1); | 12188 1); |
| 12259 // kSameDocumentNavigationHistoryApi and kFrameLoadTypeBackForward is an | 12189 // kSameDocumentNavigationHistoryApi and kFrameLoadTypeBackForward is an |
| 12260 // illegal combination, which has been caught by DCHECK in | 12190 // illegal combination, which has been caught by DCHECK in |
| 12261 // UpdateForSameDocumentNavigation(). | 12191 // UpdateForSameDocumentNavigation(). |
| 12262 | 12192 |
| 12263 tester.ExpectTotalCount(histogramName, 3); | 12193 tester.ExpectTotalCount(histogramName, 3); |
| 12264 } | 12194 } |
| 12265 | 12195 |
| 12266 } // namespace blink | 12196 } // namespace blink |
| OLD | NEW |