| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2015 Google Inc. All rights reserved. | 2 * Copyright (C) 2015 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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 settings->setShrinksViewportContentToFit(true); | 91 settings->setShrinksViewportContentToFit(true); |
| 92 settings->setMainFrameResizesAreOrientationChanges(true); | 92 settings->setMainFrameResizesAreOrientationChanges(true); |
| 93 } | 93 } |
| 94 | 94 |
| 95 void registerMockedHttpURLLoad(const std::string& fileName) { | 95 void registerMockedHttpURLLoad(const std::string& fileName) { |
| 96 URLTestHelpers::registerMockedURLFromBaseURL( | 96 URLTestHelpers::registerMockedURLFromBaseURL( |
| 97 WebString::fromUTF8(m_baseURL.c_str()), | 97 WebString::fromUTF8(m_baseURL.c_str()), |
| 98 WebString::fromUTF8(fileName.c_str())); | 98 WebString::fromUTF8(fileName.c_str())); |
| 99 } | 99 } |
| 100 | 100 |
| 101 WebGestureEvent generateEvent(WebInputEvent::Type type, | 101 WebCoalescedInputEvent generateEvent(WebInputEvent::Type type, |
| 102 int deltaX = 0, | 102 int deltaX = 0, |
| 103 int deltaY = 0) { | 103 int deltaY = 0) { |
| 104 WebGestureEvent event(type, WebInputEvent::NoModifiers, | 104 WebGestureEvent event(type, WebInputEvent::NoModifiers, |
| 105 WebInputEvent::TimeStampForTesting); | 105 WebInputEvent::TimeStampForTesting); |
| 106 event.sourceDevice = WebGestureDeviceTouchscreen; | 106 event.sourceDevice = WebGestureDeviceTouchscreen; |
| 107 event.x = 100; | 107 event.x = 100; |
| 108 event.y = 100; | 108 event.y = 100; |
| 109 if (type == WebInputEvent::GestureScrollUpdate) { | 109 if (type == WebInputEvent::GestureScrollUpdate) { |
| 110 event.data.scrollUpdate.deltaX = deltaX; | 110 event.data.scrollUpdate.deltaX = deltaX; |
| 111 event.data.scrollUpdate.deltaY = deltaY; | 111 event.data.scrollUpdate.deltaY = deltaY; |
| 112 } | 112 } |
| 113 return event; | 113 return WebCoalescedInputEvent(event); |
| 114 } | 114 } |
| 115 | 115 |
| 116 void verticalScroll(float deltaY) { | 116 void verticalScroll(float deltaY) { |
| 117 webViewImpl()->handleInputEvent( | 117 webViewImpl()->handleInputEvent( |
| 118 generateEvent(WebInputEvent::GestureScrollBegin)); | 118 generateEvent(WebInputEvent::GestureScrollBegin)); |
| 119 webViewImpl()->handleInputEvent( | 119 webViewImpl()->handleInputEvent( |
| 120 generateEvent(WebInputEvent::GestureScrollUpdate, 0, deltaY)); | 120 generateEvent(WebInputEvent::GestureScrollUpdate, 0, deltaY)); |
| 121 webViewImpl()->handleInputEvent( | 121 webViewImpl()->handleInputEvent( |
| 122 generateEvent(WebInputEvent::GestureScrollEnd)); | 122 generateEvent(WebInputEvent::GestureScrollEnd)); |
| 123 } | 123 } |
| (...skipping 875 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 999 view->setScrollOffset(view->getScrollOffset(), ProgrammaticScroll); | 999 view->setScrollOffset(view->getScrollOffset(), ProgrammaticScroll); |
| 1000 | 1000 |
| 1001 ASSERT_EQ(80.f, webView->browserControls().contentOffset()); | 1001 ASSERT_EQ(80.f, webView->browserControls().contentOffset()); |
| 1002 EXPECT_EQ(expectedRootOffset, rootViewport->getScrollOffset().height()); | 1002 EXPECT_EQ(expectedRootOffset, rootViewport->getScrollOffset().height()); |
| 1003 | 1003 |
| 1004 webView->handleInputEvent(generateEvent(WebInputEvent::GestureScrollEnd)); | 1004 webView->handleInputEvent(generateEvent(WebInputEvent::GestureScrollEnd)); |
| 1005 } | 1005 } |
| 1006 } | 1006 } |
| 1007 | 1007 |
| 1008 } // namespace blink | 1008 } // namespace blink |
| OLD | NEW |