| 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 8132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8143 event.sourceDevice = GetParam(); | 8143 event.sourceDevice = GetParam(); |
| 8144 event.x = 100; | 8144 event.x = 100; |
| 8145 event.y = 100; | 8145 event.y = 100; |
| 8146 if (type == WebInputEvent::GestureScrollUpdate) { | 8146 if (type == WebInputEvent::GestureScrollUpdate) { |
| 8147 event.data.scrollUpdate.deltaX = deltaX; | 8147 event.data.scrollUpdate.deltaX = deltaX; |
| 8148 event.data.scrollUpdate.deltaY = deltaY; | 8148 event.data.scrollUpdate.deltaY = deltaY; |
| 8149 } | 8149 } |
| 8150 return event; | 8150 return event; |
| 8151 } | 8151 } |
| 8152 | 8152 |
| 8153 void ScrollByWheel(FrameTestHelpers::WebViewHelper* webViewHelper, int windo
wX, int windowY, float deltaX, float deltaY) | |
| 8154 { | |
| 8155 WebMouseWheelEvent event; | |
| 8156 event.type = WebInputEvent::MouseWheel; | |
| 8157 event.deltaX = deltaX; | |
| 8158 event.deltaY = deltaY; | |
| 8159 event.windowX = windowX; | |
| 8160 event.windowY = windowY; | |
| 8161 event.canScroll = true; | |
| 8162 event.hasPreciseScrollingDeltas = true; | |
| 8163 webViewHelper->webViewImpl()->handleInputEvent(event); | |
| 8164 } | |
| 8165 | |
| 8166 void ScrollBegin(FrameTestHelpers::WebViewHelper* webViewHelper) | 8153 void ScrollBegin(FrameTestHelpers::WebViewHelper* webViewHelper) |
| 8167 { | 8154 { |
| 8168 webViewHelper->webViewImpl()->handleInputEvent(generateEvent(WebInputEve
nt::GestureScrollBegin)); | 8155 webViewHelper->webViewImpl()->handleInputEvent(generateEvent(WebInputEve
nt::GestureScrollBegin)); |
| 8169 } | 8156 } |
| 8170 | 8157 |
| 8171 void ScrollUpdate(FrameTestHelpers::WebViewHelper* webViewHelper, float delt
aX, float deltaY) | 8158 void ScrollUpdate(FrameTestHelpers::WebViewHelper* webViewHelper, float delt
aX, float deltaY) |
| 8172 { | 8159 { |
| 8173 webViewHelper->webViewImpl()->handleInputEvent(generateEvent(WebInputEve
nt::GestureScrollUpdate, deltaX, deltaY)); | 8160 webViewHelper->webViewImpl()->handleInputEvent(generateEvent(WebInputEve
nt::GestureScrollUpdate, deltaX, deltaY)); |
| 8174 } | 8161 } |
| 8175 | 8162 |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8403 | 8390 |
| 8404 EXPECT_CALL(client, didOverscroll(_, _, _, _)).Times(0); | 8391 EXPECT_CALL(client, didOverscroll(_, _, _, _)).Times(0); |
| 8405 ScrollUpdate(&webViewHelper, -0.09, 0); | 8392 ScrollUpdate(&webViewHelper, -0.09, 0); |
| 8406 Mock::VerifyAndClearExpectations(&client); | 8393 Mock::VerifyAndClearExpectations(&client); |
| 8407 | 8394 |
| 8408 EXPECT_CALL(client, didOverscroll(_, _, _, _)).Times(0); | 8395 EXPECT_CALL(client, didOverscroll(_, _, _, _)).Times(0); |
| 8409 ScrollEnd(&webViewHelper); | 8396 ScrollEnd(&webViewHelper); |
| 8410 Mock::VerifyAndClearExpectations(&client); | 8397 Mock::VerifyAndClearExpectations(&client); |
| 8411 } | 8398 } |
| 8412 | 8399 |
| 8413 TEST_P(WebFrameOverscrollTest, ReportingLatestOverscrollForElasticOverscroll) | |
| 8414 { | |
| 8415 OverscrollWebViewClient client; | |
| 8416 registerMockedHttpURLLoad("overscroll/overscroll.html"); | |
| 8417 FrameTestHelpers::WebViewHelper webViewHelper; | |
| 8418 webViewHelper.initializeAndLoad(m_baseURL + "overscroll/overscroll.html", tr
ue, nullptr, &client, nullptr, configureAndroid); | |
| 8419 webViewHelper.resize(WebSize(200, 200)); | |
| 8420 | |
| 8421 EXPECT_CALL(client, didOverscroll(WebFloatSize(-1000, -1000), WebFloatSize(-
1000, -1000), WebFloatPoint(), WebFloatSize())); | |
| 8422 ScrollByWheel(&webViewHelper, 10, 10, 1000, 1000); | |
| 8423 Mock::VerifyAndClearExpectations(&client); | |
| 8424 } | |
| 8425 | |
| 8426 TEST_P(WebFrameOverscrollTest, ScrollPageWithBodyExplicitlyOverflowing) | |
| 8427 { | |
| 8428 RuntimeEnabledFeatures::setScrollTopLeftInteropEnabled(false); | |
| 8429 | |
| 8430 OverscrollWebViewClient client; | |
| 8431 registerMockedHttpURLLoad("mouse-wheel-overflow-body.html"); | |
| 8432 FrameTestHelpers::WebViewHelper webViewHelper; | |
| 8433 webViewHelper.initializeAndLoad(m_baseURL + "mouse-wheel-overflow-body.html"
, true, nullptr, &client, nullptr, configureAndroid); | |
| 8434 webViewHelper.resize(WebSize(800, 600)); | |
| 8435 | |
| 8436 FrameView* view = webViewHelper.webViewImpl()->mainFrameImpl()->frameView(); | |
| 8437 Document* document = toWebLocalFrameImpl(webViewHelper.webViewImpl()->mainFr
ame())->frame()->document(); | |
| 8438 | |
| 8439 { | |
| 8440 EXPECT_CALL(client, didOverscroll(_, _, _, _)).Times(0); | |
| 8441 ScrollByWheel(&webViewHelper, 100, 100, 0, -450); | |
| 8442 | |
| 8443 LayoutBox* layoutBody = toLayoutBox(document->body()->layoutObject()); | |
| 8444 ASSERT_EQ(400, layoutBody->getScrollableArea()->scrollPosition().y()); | |
| 8445 ASSERT_EQ(400, layoutBody->getScrollableArea()->maximumScrollPosition().
y()); | |
| 8446 | |
| 8447 Mock::VerifyAndClearExpectations(&client); | |
| 8448 } | |
| 8449 | |
| 8450 view->setScrollPosition(DoublePoint(0, 0), ProgrammaticScroll); | |
| 8451 | |
| 8452 { | |
| 8453 EXPECT_CALL(client, didOverscroll(WebFloatSize(0, 200), WebFloatSize(0,
200), WebFloatPoint(), WebFloatSize())); | |
| 8454 ScrollByWheel(&webViewHelper, 100, 100, 0, -300); | |
| 8455 | |
| 8456 ASSERT_EQ(100, view->getScrollableArea()->scrollPosition().y()); | |
| 8457 ASSERT_EQ(100, view->getScrollableArea()->maximumScrollPosition().y()); | |
| 8458 | |
| 8459 Mock::VerifyAndClearExpectations(&client); | |
| 8460 } | |
| 8461 } | |
| 8462 | |
| 8463 TEST_F(WebFrameTest, OrientationFrameDetach) | 8400 TEST_F(WebFrameTest, OrientationFrameDetach) |
| 8464 { | 8401 { |
| 8465 RuntimeEnabledFeatures::setOrientationEventEnabled(true); | 8402 RuntimeEnabledFeatures::setOrientationEventEnabled(true); |
| 8466 registerMockedHttpURLLoad("orientation-frame-detach.html"); | 8403 registerMockedHttpURLLoad("orientation-frame-detach.html"); |
| 8467 FrameTestHelpers::WebViewHelper webViewHelper; | 8404 FrameTestHelpers::WebViewHelper webViewHelper; |
| 8468 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(m_baseURL + "orie
ntation-frame-detach.html", true); | 8405 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(m_baseURL + "orie
ntation-frame-detach.html", true); |
| 8469 webViewImpl->mainFrameImpl()->sendOrientationChangeEvent(); | 8406 webViewImpl->mainFrameImpl()->sendOrientationChangeEvent(); |
| 8470 } | 8407 } |
| 8471 | 8408 |
| 8472 TEST_F(WebFrameTest, MaxFramesDetach) | 8409 TEST_F(WebFrameTest, MaxFramesDetach) |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8735 ASSERT_FALSE(grandchildFrame->canHaveSecureChild()); | 8672 ASSERT_FALSE(grandchildFrame->canHaveSecureChild()); |
| 8736 Document* mainDocument = mainFrame->document(); | 8673 Document* mainDocument = mainFrame->document(); |
| 8737 Document* childDocument = childFrame->document(); | 8674 Document* childDocument = childFrame->document(); |
| 8738 Document* grandchildDocument = grandchildFrame->document(); | 8675 Document* grandchildDocument = grandchildFrame->document(); |
| 8739 ASSERT_FALSE(mainDocument->isSecureContext()); | 8676 ASSERT_FALSE(mainDocument->isSecureContext()); |
| 8740 ASSERT_TRUE(childDocument->isSecureContext()); | 8677 ASSERT_TRUE(childDocument->isSecureContext()); |
| 8741 ASSERT_FALSE(grandchildDocument->isSecureContext()); | 8678 ASSERT_FALSE(grandchildDocument->isSecureContext()); |
| 8742 } | 8679 } |
| 8743 | 8680 |
| 8744 } // namespace blink | 8681 } // namespace blink |
| OLD | NEW |