| 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 8118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8129 | 8129 |
| 8130 void ScrollByWheel(FrameTestHelpers::WebViewHelper* webViewHelper, int windo
wX, int windowY, float deltaX, float deltaY) | 8130 void ScrollByWheel(FrameTestHelpers::WebViewHelper* webViewHelper, int windo
wX, int windowY, float deltaX, float deltaY) |
| 8131 { | 8131 { |
| 8132 WebMouseWheelEvent event; | 8132 WebMouseWheelEvent event; |
| 8133 event.type = WebInputEvent::MouseWheel; | 8133 event.type = WebInputEvent::MouseWheel; |
| 8134 event.deltaX = deltaX; | 8134 event.deltaX = deltaX; |
| 8135 event.deltaY = deltaY; | 8135 event.deltaY = deltaY; |
| 8136 event.windowX = windowX; | 8136 event.windowX = windowX; |
| 8137 event.windowY = windowY; | 8137 event.windowY = windowY; |
| 8138 event.canScroll = true; | 8138 event.canScroll = true; |
| 8139 event.hasPreciseScrollingDeltas = true; |
| 8139 webViewHelper->webViewImpl()->handleInputEvent(event); | 8140 webViewHelper->webViewImpl()->handleInputEvent(event); |
| 8140 } | 8141 } |
| 8141 | 8142 |
| 8142 void ScrollBegin(FrameTestHelpers::WebViewHelper* webViewHelper) | 8143 void ScrollBegin(FrameTestHelpers::WebViewHelper* webViewHelper) |
| 8143 { | 8144 { |
| 8144 webViewHelper->webViewImpl()->handleInputEvent(generateEvent(WebInputEve
nt::GestureScrollBegin)); | 8145 webViewHelper->webViewImpl()->handleInputEvent(generateEvent(WebInputEve
nt::GestureScrollBegin)); |
| 8145 } | 8146 } |
| 8146 | 8147 |
| 8147 void ScrollUpdate(FrameTestHelpers::WebViewHelper* webViewHelper, float delt
aX, float deltaY) | 8148 void ScrollUpdate(FrameTestHelpers::WebViewHelper* webViewHelper, float delt
aX, float deltaY) |
| 8148 { | 8149 { |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8392 registerMockedHttpURLLoad("overscroll/overscroll.html"); | 8393 registerMockedHttpURLLoad("overscroll/overscroll.html"); |
| 8393 FrameTestHelpers::WebViewHelper webViewHelper; | 8394 FrameTestHelpers::WebViewHelper webViewHelper; |
| 8394 webViewHelper.initializeAndLoad(m_baseURL + "overscroll/overscroll.html", tr
ue, 0, &client, configureAndroid); | 8395 webViewHelper.initializeAndLoad(m_baseURL + "overscroll/overscroll.html", tr
ue, 0, &client, configureAndroid); |
| 8395 webViewHelper.resize(WebSize(200, 200)); | 8396 webViewHelper.resize(WebSize(200, 200)); |
| 8396 | 8397 |
| 8397 EXPECT_CALL(client, didOverscroll(WebFloatSize(-1000, -1000), WebFloatSize(-
1000, -1000), WebFloatPoint(), WebFloatSize())); | 8398 EXPECT_CALL(client, didOverscroll(WebFloatSize(-1000, -1000), WebFloatSize(-
1000, -1000), WebFloatPoint(), WebFloatSize())); |
| 8398 ScrollByWheel(&webViewHelper, 10, 10, 1000, 1000); | 8399 ScrollByWheel(&webViewHelper, 10, 10, 1000, 1000); |
| 8399 Mock::VerifyAndClearExpectations(&client); | 8400 Mock::VerifyAndClearExpectations(&client); |
| 8400 } | 8401 } |
| 8401 | 8402 |
| 8403 TEST_P(WebFrameOverscrollTest, ScrollPageWithBodyExplicitlyOverflowing) |
| 8404 { |
| 8405 RuntimeEnabledFeatures::setScrollTopLeftInteropEnabled(false); |
| 8406 |
| 8407 OverscrollWebViewClient client; |
| 8408 registerMockedHttpURLLoad("mouse-wheel-overflow-body.html"); |
| 8409 FrameTestHelpers::WebViewHelper webViewHelper; |
| 8410 webViewHelper.initializeAndLoad(m_baseURL + "mouse-wheel-overflow-body.html"
, true, 0, &client, configureAndroid); |
| 8411 webViewHelper.resize(WebSize(800, 600)); |
| 8412 |
| 8413 FrameView* view = webViewHelper.webViewImpl()->mainFrameImpl()->frameView(); |
| 8414 Document* document = toWebLocalFrameImpl(webViewHelper.webViewImpl()->mainFr
ame())->frame()->document(); |
| 8415 |
| 8416 { |
| 8417 EXPECT_CALL(client, didOverscroll(_, _, _, _)).Times(0); |
| 8418 ScrollByWheel(&webViewHelper, 100, 100, 0, -450); |
| 8419 |
| 8420 LayoutBox* layoutBody = toLayoutBox(document->body()->layoutObject()); |
| 8421 ASSERT_EQ(400, layoutBody->getScrollableArea()->scrollPosition().y()); |
| 8422 ASSERT_EQ(400, layoutBody->getScrollableArea()->maximumScrollPosition().
y()); |
| 8423 |
| 8424 Mock::VerifyAndClearExpectations(&client); |
| 8425 } |
| 8426 |
| 8427 view->setScrollPosition(DoublePoint(0, 0), ProgrammaticScroll); |
| 8428 |
| 8429 { |
| 8430 EXPECT_CALL(client, didOverscroll(WebFloatSize(0, 200), WebFloatSize(0,
200), WebFloatPoint(), WebFloatSize())); |
| 8431 ScrollByWheel(&webViewHelper, 100, 100, 0, -300); |
| 8432 |
| 8433 ASSERT_EQ(100, view->getScrollableArea()->scrollPosition().y()); |
| 8434 ASSERT_EQ(100, view->getScrollableArea()->maximumScrollPosition().y()); |
| 8435 |
| 8436 Mock::VerifyAndClearExpectations(&client); |
| 8437 } |
| 8438 } |
| 8439 |
| 8402 TEST_F(WebFrameTest, OrientationFrameDetach) | 8440 TEST_F(WebFrameTest, OrientationFrameDetach) |
| 8403 { | 8441 { |
| 8404 RuntimeEnabledFeatures::setOrientationEventEnabled(true); | 8442 RuntimeEnabledFeatures::setOrientationEventEnabled(true); |
| 8405 registerMockedHttpURLLoad("orientation-frame-detach.html"); | 8443 registerMockedHttpURLLoad("orientation-frame-detach.html"); |
| 8406 FrameTestHelpers::WebViewHelper webViewHelper; | 8444 FrameTestHelpers::WebViewHelper webViewHelper; |
| 8407 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(m_baseURL + "orie
ntation-frame-detach.html", true); | 8445 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(m_baseURL + "orie
ntation-frame-detach.html", true); |
| 8408 webViewImpl->mainFrameImpl()->sendOrientationChangeEvent(); | 8446 webViewImpl->mainFrameImpl()->sendOrientationChangeEvent(); |
| 8409 } | 8447 } |
| 8410 | 8448 |
| 8411 TEST_F(WebFrameTest, MaxFramesDetach) | 8449 TEST_F(WebFrameTest, MaxFramesDetach) |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8616 WebLocalFrame* mainFrame = helper.webView()->mainFrame()->toWebLocalFrame(); | 8654 WebLocalFrame* mainFrame = helper.webView()->mainFrame()->toWebLocalFrame(); |
| 8617 v8::HandleScope scope(v8::Isolate::GetCurrent()); | 8655 v8::HandleScope scope(v8::Isolate::GetCurrent()); |
| 8618 mainFrame->executeScript(WebScriptSource("hello = 'world';")); | 8656 mainFrame->executeScript(WebScriptSource("hello = 'world';")); |
| 8619 FrameTestHelpers::loadFrame(mainFrame, "data:text/html,new page"); | 8657 FrameTestHelpers::loadFrame(mainFrame, "data:text/html,new page"); |
| 8620 v8::Local<v8::Value> result = mainFrame->executeScriptAndReturnValue(WebScri
ptSource("hello")); | 8658 v8::Local<v8::Value> result = mainFrame->executeScriptAndReturnValue(WebScri
ptSource("hello")); |
| 8621 ASSERT_TRUE(result->IsString()); | 8659 ASSERT_TRUE(result->IsString()); |
| 8622 EXPECT_EQ("world", toCoreString(result->ToString(mainFrame->mainWorldScriptC
ontext()).ToLocalChecked())); | 8660 EXPECT_EQ("world", toCoreString(result->ToString(mainFrame->mainWorldScriptC
ontext()).ToLocalChecked())); |
| 8623 } | 8661 } |
| 8624 | 8662 |
| 8625 } // namespace blink | 8663 } // namespace blink |
| OLD | NEW |