@@ -35,10 +35,10 @@ import org.mockito.Mockito.verify
3535import org.mockito.Mockito.`when`
3636
3737@RunWith(AndroidJUnit4 ::class )
38- class EngineViewScrollingBehaviorTest {
38+ class EngineViewScrollingGesturesBehaviorTest {
3939 @Test
4040 fun `onStartNestedScroll should attempt scrolling only if browserToolbar is valid` () {
41- val behavior = spy(EngineViewScrollingBehavior (testContext, null , ViewPosition .BOTTOM ))
41+ val behavior = spy(EngineViewScrollingGesturesBehavior (testContext, null , ViewPosition .BOTTOM ))
4242 doReturn(true ).`when `(behavior).shouldScroll
4343
4444 behavior.dynamicScrollView = null
@@ -68,7 +68,7 @@ class EngineViewScrollingBehaviorTest {
6868
6969 @Test
7070 fun `startNestedScroll should cancel an ongoing snap animation` () {
71- val behavior = spy(EngineViewScrollingBehavior (testContext, null , ViewPosition .BOTTOM ))
71+ val behavior = spy(EngineViewScrollingGesturesBehavior (testContext, null , ViewPosition .BOTTOM ))
7272 val yTranslator: ViewYTranslator = mock()
7373 behavior.yTranslator = yTranslator
7474 doReturn(true ).`when `(behavior).shouldScroll
@@ -84,7 +84,7 @@ class EngineViewScrollingBehaviorTest {
8484
8585 @Test
8686 fun `startNestedScroll should not accept nested scrolls on the horizontal axis` () {
87- val behavior = spy(EngineViewScrollingBehavior (testContext, null , ViewPosition .BOTTOM ))
87+ val behavior = spy(EngineViewScrollingGesturesBehavior (testContext, null , ViewPosition .BOTTOM ))
8888 doReturn(true ).`when `(behavior).shouldScroll
8989
9090 var acceptsNestedScroll = behavior.startNestedScroll(
@@ -102,7 +102,7 @@ class EngineViewScrollingBehaviorTest {
102102
103103 @Test
104104 fun `GIVEN a gesture that doesn't scroll the toolbar WHEN startNestedScroll THEN nested scroll is not accepted` () {
105- val behavior = spy(EngineViewScrollingBehavior (testContext, null , ViewPosition .BOTTOM ))
105+ val behavior = spy(EngineViewScrollingGesturesBehavior (testContext, null , ViewPosition .BOTTOM ))
106106 val engineView: EngineView = mock()
107107 val inputResultDetail: InputResultDetail = mock()
108108 val yTranslator: ViewYTranslator = mock()
@@ -122,7 +122,7 @@ class EngineViewScrollingBehaviorTest {
122122
123123 @Test
124124 fun `Behavior should not accept nested scrolls on the horizontal axis` () {
125- val behavior = spy(EngineViewScrollingBehavior (testContext, null , ViewPosition .BOTTOM ))
125+ val behavior = spy(EngineViewScrollingGesturesBehavior (testContext, null , ViewPosition .BOTTOM ))
126126 behavior.dynamicScrollView = mock()
127127 doReturn(true ).`when `(behavior).shouldScroll
128128
@@ -149,7 +149,7 @@ class EngineViewScrollingBehaviorTest {
149149
150150 @Test
151151 fun `Behavior should delegate the onStartNestedScroll logic` () {
152- val behavior = spy(EngineViewScrollingBehavior (testContext, null , ViewPosition .BOTTOM ))
152+ val behavior = spy(EngineViewScrollingGesturesBehavior (testContext, null , ViewPosition .BOTTOM ))
153153 val view: View = mock()
154154 behavior.dynamicScrollView = view
155155 val inputType = ViewCompat .TYPE_TOUCH
@@ -169,7 +169,7 @@ class EngineViewScrollingBehaviorTest {
169169
170170 @Test
171171 fun `onStopNestedScroll should attempt stopping nested scrolling only if browserToolbar is valid` () {
172- val behavior = spy(EngineViewScrollingBehavior (testContext, null , ViewPosition .BOTTOM ))
172+ val behavior = spy(EngineViewScrollingGesturesBehavior (testContext, null , ViewPosition .BOTTOM ))
173173
174174 behavior.dynamicScrollView = null
175175 behavior.onStopNestedScroll(
@@ -192,7 +192,7 @@ class EngineViewScrollingBehaviorTest {
192192
193193 @Test
194194 fun `Behavior should delegate the onStopNestedScroll logic` () {
195- val behavior = spy(EngineViewScrollingBehavior (testContext, null , ViewPosition .BOTTOM ))
195+ val behavior = spy(EngineViewScrollingGesturesBehavior (testContext, null , ViewPosition .BOTTOM ))
196196 val inputType = ViewCompat .TYPE_TOUCH
197197 val view: View = mock()
198198
@@ -208,7 +208,7 @@ class EngineViewScrollingBehaviorTest {
208208
209209 @Test
210210 fun `stopNestedScroll will snap toolbar up if toolbar is more than 50 percent visible` () {
211- val behavior = spy(EngineViewScrollingBehavior (testContext, null , ViewPosition .BOTTOM ))
211+ val behavior = spy(EngineViewScrollingGesturesBehavior (testContext, null , ViewPosition .BOTTOM ))
212212 val yTranslator: ViewYTranslator = mock()
213213 behavior.yTranslator = yTranslator
214214 behavior.dynamicScrollView = mock()
@@ -239,7 +239,7 @@ class EngineViewScrollingBehaviorTest {
239239
240240 @Test
241241 fun `stopNestedScroll will snap toolbar down if toolbar is less than 50 percent visible` () {
242- val behavior = spy(EngineViewScrollingBehavior (testContext, null , ViewPosition .BOTTOM ))
242+ val behavior = spy(EngineViewScrollingGesturesBehavior (testContext, null , ViewPosition .BOTTOM ))
243243 doReturn(true ).`when `(behavior).shouldScroll
244244 val yTranslator: ViewYTranslator = mock()
245245 behavior.yTranslator = yTranslator
@@ -270,7 +270,7 @@ class EngineViewScrollingBehaviorTest {
270270
271271 @Test
272272 fun `onStopNestedScroll should snap the toolbar only if browserToolbar is valid` () {
273- val behavior = spy(EngineViewScrollingBehavior (testContext, null , ViewPosition .BOTTOM ))
273+ val behavior = spy(EngineViewScrollingGesturesBehavior (testContext, null , ViewPosition .BOTTOM ))
274274 behavior.dynamicScrollView = null
275275
276276 behavior.onStopNestedScroll(
@@ -285,7 +285,7 @@ class EngineViewScrollingBehaviorTest {
285285
286286 @Test
287287 fun `Behavior will intercept MotionEvents and pass them to the custom gesture detector` () {
288- val behavior = spy(EngineViewScrollingBehavior (testContext, null , ViewPosition .BOTTOM ))
288+ val behavior = spy(EngineViewScrollingGesturesBehavior (testContext, null , ViewPosition .BOTTOM ))
289289 val gestureDetector: BrowserGestureDetector = mock()
290290 behavior.initGesturesDetector(gestureDetector)
291291 behavior.dynamicScrollView = mock()
@@ -298,7 +298,7 @@ class EngineViewScrollingBehaviorTest {
298298
299299 @Test
300300 fun `Behavior should only dispatch MotionEvents to the gesture detector only if browserToolbar is valid` () {
301- val behavior = spy(EngineViewScrollingBehavior (testContext, null , ViewPosition .BOTTOM ))
301+ val behavior = spy(EngineViewScrollingGesturesBehavior (testContext, null , ViewPosition .BOTTOM ))
302302 val gestureDetector: BrowserGestureDetector = mock()
303303 behavior.initGesturesDetector(gestureDetector)
304304 val downEvent = TestUtils .getMotionEvent(ACTION_DOWN )
@@ -310,7 +310,7 @@ class EngineViewScrollingBehaviorTest {
310310
311311 @Test
312312 fun `Behavior will apply translation to toolbar only for vertical scrolls` () {
313- val behavior = spy(EngineViewScrollingBehavior (testContext, null , ViewPosition .BOTTOM ))
313+ val behavior = spy(EngineViewScrollingGesturesBehavior (testContext, null , ViewPosition .BOTTOM ))
314314 behavior.initGesturesDetector(behavior.createGestureDetector())
315315 val child = spy(View (testContext, null , 0 ))
316316 behavior.dynamicScrollView = child
@@ -325,7 +325,7 @@ class EngineViewScrollingBehaviorTest {
325325
326326 @Test
327327 fun `GIVEN a null InputResultDetail from the EngineView WHEN shouldScroll is called THEN it returns false` () {
328- val behavior = EngineViewScrollingBehavior (testContext, null , ViewPosition .BOTTOM )
328+ val behavior = EngineViewScrollingGesturesBehavior (testContext, null , ViewPosition .BOTTOM )
329329 behavior.engineView = null
330330 assertFalse(behavior.shouldScroll)
331331 behavior.engineView = mock()
@@ -336,7 +336,7 @@ class EngineViewScrollingBehaviorTest {
336336
337337 @Test
338338 fun `GIVEN an InputResultDetail with the right values and scroll enabled WHEN shouldScroll is called THEN it returns true` () {
339- val behavior = EngineViewScrollingBehavior (testContext, null , ViewPosition .BOTTOM )
339+ val behavior = EngineViewScrollingGesturesBehavior (testContext, null , ViewPosition .BOTTOM )
340340 val engineView: EngineView = mock()
341341 behavior.engineView = engineView
342342 behavior.isScrollEnabled = true
@@ -358,7 +358,7 @@ class EngineViewScrollingBehaviorTest {
358358
359359 @Test
360360 fun `GIVEN an InputResultDetail with the right values but with scroll disabled WHEN shouldScroll is called THEN it returns false` () {
361- val behavior = EngineViewScrollingBehavior (testContext, null , ViewPosition .BOTTOM )
361+ val behavior = EngineViewScrollingGesturesBehavior (testContext, null , ViewPosition .BOTTOM )
362362 behavior.engineView = mock()
363363 behavior.isScrollEnabled = false
364364 val validInputResultDetail: InputResultDetail = mock()
@@ -370,7 +370,7 @@ class EngineViewScrollingBehaviorTest {
370370
371371 @Test
372372 fun `GIVEN scroll enabled but EngineView cannot scroll to bottom WHEN shouldScroll is called THEN it returns false` () {
373- val behavior = EngineViewScrollingBehavior (testContext, null , ViewPosition .BOTTOM )
373+ val behavior = EngineViewScrollingGesturesBehavior (testContext, null , ViewPosition .BOTTOM )
374374 behavior.engineView = mock()
375375 behavior.isScrollEnabled = true
376376 val validInputResultDetail: InputResultDetail = mock()
@@ -382,7 +382,7 @@ class EngineViewScrollingBehaviorTest {
382382
383383 @Test
384384 fun `GIVEN scroll enabled but EngineView cannot scroll to top WHEN shouldScroll is called THEN it returns false` () {
385- val behavior = EngineViewScrollingBehavior (testContext, null , ViewPosition .BOTTOM )
385+ val behavior = EngineViewScrollingGesturesBehavior (testContext, null , ViewPosition .BOTTOM )
386386 behavior.engineView = mock()
387387 behavior.isScrollEnabled = true
388388 val validInputResultDetail: InputResultDetail = mock()
@@ -394,7 +394,7 @@ class EngineViewScrollingBehaviorTest {
394394
395395 @Test
396396 fun `Behavior will vertically scroll nested scroll started and EngineView handled the event` () {
397- val behavior = spy(EngineViewScrollingBehavior (testContext, null , ViewPosition .BOTTOM ))
397+ val behavior = spy(EngineViewScrollingGesturesBehavior (testContext, null , ViewPosition .BOTTOM ))
398398 val yTranslator: ViewYTranslator = mock()
399399 behavior.yTranslator = yTranslator
400400 doReturn(true ).`when `(behavior).shouldScroll
@@ -411,7 +411,7 @@ class EngineViewScrollingBehaviorTest {
411411
412412 @Test
413413 fun `Behavior will not scroll vertically if startedScroll is false` () {
414- val behavior = spy(EngineViewScrollingBehavior (testContext, null , ViewPosition .BOTTOM ))
414+ val behavior = spy(EngineViewScrollingGesturesBehavior (testContext, null , ViewPosition .BOTTOM ))
415415 val yTranslator: ViewYTranslator = mock()
416416 behavior.yTranslator = yTranslator
417417 doReturn(true ).`when `(behavior).shouldScroll
@@ -428,7 +428,7 @@ class EngineViewScrollingBehaviorTest {
428428
429429 @Test
430430 fun `Behavior will not scroll vertically if EngineView did not handled the event` () {
431- val behavior = spy(EngineViewScrollingBehavior (testContext, null , ViewPosition .BOTTOM ))
431+ val behavior = spy(EngineViewScrollingGesturesBehavior (testContext, null , ViewPosition .BOTTOM ))
432432 val yTranslator: ViewYTranslator = mock()
433433 behavior.yTranslator = yTranslator
434434 doReturn(false ).`when `(behavior).shouldScroll
@@ -444,7 +444,7 @@ class EngineViewScrollingBehaviorTest {
444444
445445 @Test
446446 fun `forceExpand should delegate the translator` () {
447- val behavior = spy(EngineViewScrollingBehavior (testContext, null , ViewPosition .BOTTOM ))
447+ val behavior = spy(EngineViewScrollingGesturesBehavior (testContext, null , ViewPosition .BOTTOM ))
448448 val yTranslator: ViewYTranslator = mock()
449449 behavior.yTranslator = yTranslator
450450 val view: View = mock()
@@ -456,7 +456,7 @@ class EngineViewScrollingBehaviorTest {
456456
457457 @Test
458458 fun `forceCollapse should delegate the translator` () {
459- val behavior = spy(EngineViewScrollingBehavior (testContext, null , ViewPosition .BOTTOM ))
459+ val behavior = spy(EngineViewScrollingGesturesBehavior (testContext, null , ViewPosition .BOTTOM ))
460460 val yTranslator: ViewYTranslator = mock()
461461 behavior.yTranslator = yTranslator
462462 val view: View = mock()
@@ -468,7 +468,7 @@ class EngineViewScrollingBehaviorTest {
468468
469469 @Test
470470 fun `Behavior will not forceExpand when scrolling up and !shouldScroll if the touch was not yet handled in the browser` () {
471- val behavior = spy(EngineViewScrollingBehavior (testContext, null , ViewPosition .BOTTOM ))
471+ val behavior = spy(EngineViewScrollingGesturesBehavior (testContext, null , ViewPosition .BOTTOM ))
472472 val yTranslator: ViewYTranslator = mock()
473473 behavior.yTranslator = yTranslator
474474 behavior.initGesturesDetector(behavior.createGestureDetector())
@@ -500,7 +500,7 @@ class EngineViewScrollingBehaviorTest {
500500 addView(View (testContext))
501501 addView(engineView)
502502 }
503- val behavior = spy(EngineViewScrollingBehavior (testContext, null , ViewPosition .BOTTOM ))
503+ val behavior = spy(EngineViewScrollingGesturesBehavior (testContext, null , ViewPosition .BOTTOM ))
504504
505505 behavior.onLayoutChild(container, view, View .LAYOUT_DIRECTION_LTR )
506506
@@ -510,7 +510,7 @@ class EngineViewScrollingBehaviorTest {
510510
511511 @Test
512512 fun `enableScrolling sets isScrollEnabled to true` () {
513- val behavior = EngineViewScrollingBehavior (testContext, null , ViewPosition .BOTTOM )
513+ val behavior = EngineViewScrollingGesturesBehavior (testContext, null , ViewPosition .BOTTOM )
514514
515515 assertFalse(behavior.isScrollEnabled)
516516 behavior.enableScrolling()
@@ -520,7 +520,7 @@ class EngineViewScrollingBehaviorTest {
520520
521521 @Test
522522 fun `disableScrolling sets isScrollEnabled to false` () {
523- val behavior = EngineViewScrollingBehavior (testContext, null , ViewPosition .BOTTOM )
523+ val behavior = EngineViewScrollingGesturesBehavior (testContext, null , ViewPosition .BOTTOM )
524524 behavior.isScrollEnabled = true
525525
526526 assertTrue(behavior.isScrollEnabled)
0 commit comments