Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(14)

Side by Side Diff: third_party/WebKit/LayoutTests/fast/scrolling/scrollbar-prevent-default.html

Issue 1413493005: Update layout tests to work when smooth scrolling is enabled by default (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: worked on nit Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 <head> 1 <head>
2 <script src="../../resources/js-test.js"></script> 2 <script src="../../resources/js-test.js"></script>
3 <style> 3 <style>
4 body { 4 body {
5 height: 200vh; 5 height: 200vh;
6 width: 200vw; 6 width: 200vw;
7 margin: 0; 7 margin: 0;
8 } 8 }
9 #subframe { 9 #subframe {
10 width: 100px; 10 width: 100px;
11 height: 100px; 11 height: 100px;
12 background-color: black; 12 background-color: black;
13 overflow: scroll; 13 overflow: scroll;
14 } 14 }
15 #subframe-content { 15 #subframe-content {
16 width: 200px; 16 width: 200px;
17 height: 200px; 17 height: 200px;
18 background-color: black; 18 background-color: black;
19 } 19 }
20 </style> 20 </style>
21 </head> 21 </head>
22 <body> 22 <body>
23 <div id="subframe"> 23 <div id="subframe">
24 <div id="subframe-content"></div> 24 <div id="subframe-content"></div>
25 </div> 25 </div>
26 <pre id="console"></pre> 26 <pre id="console"></pre>
27 </body> 27 </body>
28 <script> 28 <script>
29 jsTestIsAsync = true;
30
29 description('This tests that scrollbars always receive events even when ther e is an element underneath the scrollbar which swallows the event. In this case an event handler is added to the window which swallows the event but this may al so happen with elements underneath of overlay scrollbars.'); 31 description('This tests that scrollbars always receive events even when ther e is an element underneath the scrollbar which swallows the event. In this case an event handler is added to the window which swallows the event but this may al so happen with elements underneath of overlay scrollbars.');
30 if (window.testRunner) 32 if (window.testRunner)
31 testRunner.dumpAsText(); 33 testRunner.dumpAsText();
32 if (window.internals) 34 if (window.internals)
33 internals.settings.setMockScrollbarsEnabled(true) 35 internals.settings.setMockScrollbarsEnabled(true)
34 36
35 var receivedMousedownEvent = false; 37 var receivedMousedownEvent = false;
36 38
37 document.addEventListener('mousedown', function(e) { 39 document.addEventListener('mousedown', function(e) {
38 e.preventDefault(); 40 e.preventDefault();
39 receivedMousedownEvent = true; 41 receivedMousedownEvent = true;
40 }); 42 });
41 43
42 // Test the frame scrollbar. 44 function testFrameScrollbar() {
43 window.scrollTo(0, 10); 45 // Test the frame scrollbar.
44 if (window.eventSender) { 46 window.scrollTo(0, 10);
45 eventSender.mouseMoveTo(window.innerWidth - 5, 1); 47 if (window.eventSender) {
46 eventSender.mouseDown(); 48 eventSender.mouseMoveTo(window.innerWidth - 5, 1);
47 eventSender.mouseUp(); 49 eventSender.mouseDown();
50 eventSender.mouseUp();
51 }
52 shouldBe('receivedMousedownEvent', 'true');
53 shouldBecomeEqual('window.scrollY', '0', function() {
54 testDivScrollbar();
55 });
48 } 56 }
49 57
50 shouldBe('window.scrollY', '0'); 58 function testDivScrollbar() {
51 shouldBe('receivedMousedownEvent', 'true'); 59 // Test a div scrollbar.
52 60 receivedMousedownEvent = false;
53 // Test a div scrollbar. 61 var subframe = document.getElementById('subframe');
54 receivedMousedownEvent = false; 62 subframe.scrollTop = 10;
55 var subframe = document.getElementById('subframe'); 63 if (window.eventSender) {
56 subframe.scrollTop = 10; 64 eventSender.mouseMoveTo(100 - 5, 1);
57 if (window.eventSender) { 65 eventSender.mouseDown();
58 eventSender.mouseMoveTo(100 - 5, 1); 66 eventSender.mouseUp();
59 eventSender.mouseDown(); 67 }
60 eventSender.mouseUp(); 68 shouldBe('receivedMousedownEvent', 'true');
69 shouldBecomeEqual('subframe.scrollTop', '0', function(){
70 finishJSTest();
71 });
61 } 72 }
62 73
63 shouldBe('subframe.scrollTop', '0'); 74 testFrameScrollbar();
64 shouldBe('receivedMousedownEvent', 'true');
65 </script> 75 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698