| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <script src="../../../../resources/js-test.js"></script> | 2 <script src="../../../../resources/testharness.js"></script> |
| 3 <script src="../../../../resources/testharnessreport.js"></script> |
| 3 <style> | 4 <style> |
| 4 ::-webkit-scrollbar { | 5 ::-webkit-scrollbar { |
| 5 background-color: #ccc; | 6 background-color: #ccc; |
| 6 /* fixed size for consistent touch adjustment behavior across platforms */ | 7 /* fixed size for consistent touch adjustment behavior across platforms */ |
| 7 width: 15px; | 8 width: 15px; |
| 8 } | 9 } |
| 9 | 10 |
| 10 ::-webkit-scrollbar-button { | 11 ::-webkit-scrollbar-button { |
| 11 display: none; | 12 display: none; |
| 12 } | 13 } |
| (...skipping 13 matching lines...) Expand all Loading... |
| 26 } | 27 } |
| 27 </style> | 28 </style> |
| 28 <div id="console"></div> | 29 <div id="console"></div> |
| 29 <div class="large"> | 30 <div class="large"> |
| 30 | 31 |
| 31 <script type="text/javascript"> | 32 <script type="text/javascript"> |
| 32 | 33 |
| 33 // Ensure there's a candidate for touch adjustment. | 34 // Ensure there's a candidate for touch adjustment. |
| 34 document.addEventListener("click", function() {}); | 35 document.addEventListener("click", function() {}); |
| 35 | 36 |
| 36 function scrollTest() { | 37 test(function(t) { |
| 37 shouldBeGreaterThan("window.innerWidth - document.body.clientWidth", "5"); | 38 assert_not_equals(window.eventSender, undefined, 'This test requires eventSend
er.'); |
| 38 var scrollbarX = document.body.clientWidth + 5; | |
| 39 var scrollbarY = window.innerHeight / 2; // Trying to grab the thumb | |
| 40 | 39 |
| 41 // Ensure we use a touch with an area to test under touch adjustment | 40 //if (window.internals) |
| 42 var touchWidth = 25; | 41 // internals.settings.setMockScrollbarsEnabled(true); |
| 43 var touchHeight = 25; | |
| 44 | 42 |
| 45 // Scroll down to ensure we test the difference between content and client | 43 assert_greater_than(window.innerWidth - document.body.clientWidth, 5); |
| 46 // co-ordinate spaces. | 44 var scrollbarX = document.body.clientWidth + 5; |
| 47 window.scrollTo(0, 800); | 45 var scrollbarY = window.innerHeight / 2; // Trying to grab the thumb |
| 48 shouldBe('window.scrollY', '800'); | |
| 49 | 46 |
| 50 if (!window.eventSender) { | 47 // Ensure we use a touch with an area to test under touch adjustment |
| 51 testFailed("This test requires eventSender"); | 48 var touchWidth = 25; |
| 52 return; | 49 var touchHeight = 25; |
| 53 } | |
| 54 | 50 |
| 55 eventSender.gestureTapDown(scrollbarX, scrollbarY, touchWidth, touchHeight); | 51 // Scroll down to ensure we test the difference between content and client |
| 56 eventSender.gestureShowPress(scrollbarX, scrollbarY, touchWidth, touchHeight
); | 52 // co-ordinate spaces. |
| 57 eventSender.gestureScrollBegin(scrollbarX - 20, scrollbarY, touchWidth, touc
hHeight); | 53 window.scrollTo(0, 800); |
| 58 eventSender.gestureTapCancel(scrollbarX, scrollbarY); | 54 assert_equals(window.scrollY, 800); |
| 59 shouldBe('window.scrollY', '800'); | |
| 60 eventSender.gestureScrollUpdate(0, 20); | |
| 61 // We don't know exactly how far draging the thumb will scroll. If we end | |
| 62 // up scrolling in the wrong direction it probably means hit tests are passi
ng | |
| 63 // through the scrollbar and hitting the content. | |
| 64 shouldBeGreaterThan('window.scrollY', '820'); | |
| 65 eventSender.gestureScrollUpdate(0, 60); | |
| 66 shouldBeGreaterThan('window.scrollY', '885'); | |
| 67 eventSender.gestureScrollEnd(0, 0); | |
| 68 shouldBeGreaterThan('window.scrollY', '885'); | |
| 69 } | |
| 70 | 55 |
| 71 //if (window.internals) | 56 eventSender.gestureTapDown(scrollbarX, scrollbarY, touchWidth, touchHeight); |
| 72 // internals.settings.setMockScrollbarsEnabled(true); | 57 eventSender.gestureShowPress(scrollbarX, scrollbarY, touchWidth, touchHeight); |
| 58 eventSender.gestureScrollBegin(scrollbarX - 20, scrollbarY, touchWidth, touchH
eight); |
| 59 eventSender.gestureTapCancel(scrollbarX, scrollbarY); |
| 60 assert_equals(window.scrollY, 800); |
| 61 eventSender.gestureScrollUpdate(0, 20); |
| 62 // We don't know exactly how far draging the thumb will scroll. If we end |
| 63 // up scrolling in the wrong direction it probably means hit tests are passing |
| 64 // through the scrollbar and hitting the content. |
| 65 assert_greater_than(window.scrollY, 820); |
| 66 eventSender.gestureScrollUpdate(0, 60); |
| 67 assert_greater_than(window.scrollY, 885); |
| 68 eventSender.gestureScrollEnd(0, 0); |
| 69 assert_greater_than(window.scrollY, 885); |
| 70 }, 'This tests scroll gesture events on main frame scroll bars The document shou
ld be slightly scrolled down if successful.'); |
| 73 | 71 |
| 74 description('This tests scroll gesture events on main frame scroll bars. ' + | |
| 75 'The document should be slightly scrolled down if successful.'); | |
| 76 | |
| 77 scrollTest(); | |
| 78 </script> | 72 </script> |
| OLD | NEW |