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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/events/node-event-anchor-lock.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 <html><body> 1 <html><body>
2 This test does the following:</br> 2 This test does the following:</br>
3 1. Navigate to an anchor link. WebKit will ensure that the anchor remains visib le as other objects load around it and scripts execute.</br> 3 1. Navigate to an anchor link. WebKit will ensure that the anchor remains visib le as other objects load around it and scripts execute.</br>
4 2. The div containing the anchor link will be scrolled via PageDown. This simul ated user action should stop us locking the screen to where the anchor is.</br> 4 2. The div containing the anchor link will be scrolled via PageDown. This simul ated user action should stop us locking the screen to where the anchor is.</br>
5 3. Force a repaint. If the lock to the anchor was properly released, the scroll caused by the PageDown will not be reverted and parentDiv.scrollTop will be grea ter than 600px (the offset of the anchor). If we return to the anchor, the test has failed.</br> 5 3. Force a repaint. If the lock to the anchor was properly released, the scroll caused by the PageDown will not be reverted and parentDiv.scrollTop will be grea ter than 600px (the offset of the anchor). If we return to the anchor, the test has failed.</br>
6 <a id="startLink" href="#anchor">Go to anchor</a> 6 <a id="startLink" href="#anchor">Go to anchor</a>
7 <div id="console"></div> 7 <div id="console"></div>
8 <div id="parentDiv" style="width:500; height:300; overflow:auto"> 8 <div id="parentDiv" style="width:500; height:300; overflow:auto">
9 <div style="height: 600px"></div> 9 <div style="height: 600px"></div>
10 <a id="anchor"></a> 10 <a id="anchor"></a>
11 <div style="height: 800px"></div> 11 <div style="height: 800px"></div>
12 </div> 12 </div>
13 <script> 13 <script>
14 14
15 if (window.testRunner) { 15 if (window.testRunner) {
16 testRunner.dumpAsText(); 16 testRunner.dumpAsText();
17 testRunner.waitUntilDone(); 17 testRunner.waitUntilDone();
18 } 18 }
19 19
20 if (window.internals) {
21 internals.settings.setScrollAnimatorEnabled(false);
22 }
23
20 if (window.eventSender) { 24 if (window.eventSender) {
21 // Lock to the anchor inside the div 25 // Lock to the anchor inside the div
22 var target = document.getElementById("startLink"); 26 var target = document.getElementById("startLink");
23 eventSender.mouseMoveTo(target.offsetLeft + 2, target.offsetTop + 2); 27 eventSender.mouseMoveTo(target.offsetLeft + 2, target.offsetTop + 2);
24 eventSender.mouseDown(); 28 eventSender.mouseDown();
25 eventSender.mouseUp(); 29 eventSender.mouseUp();
26 30
27 // Perform a page down to be handled by div, should release anchor lock 31 // Perform a page down to be handled by div, should release anchor lock
28 var divInfo = document.getElementById("parentDiv"); 32 var divInfo = document.getElementById("parentDiv");
29 eventSender.mouseMoveTo(divInfo.offsetLeft + 2, divInfo.offsetTop + 2); 33 eventSender.mouseMoveTo(divInfo.offsetLeft + 2, divInfo.offsetTop + 2);
30 eventSender.mouseDown(); 34 eventSender.mouseDown();
31 eventSender.keyDown("pageDown"); 35 eventSender.keyDown("pageDown");
32 } 36 }
33 37
34 // Force layout. If the scrollbar gets reset during layout, the test has failed 38 // Force layout. If the scrollbar gets reset during layout, the test has failed
35 document.getElementById("startLink").offsetHeight += 1; 39 document.getElementById("startLink").offsetHeight += 1;
36 40
37 var scrollTop = document.getElementById("parentDiv").scrollTop; 41 var scrollTop = document.getElementById("parentDiv").scrollTop;
38 var line = document.createElement('div'); 42 var line = document.createElement('div');
39 if (scrollTop > 600) 43 if (scrollTop > 600)
40 line.appendChild(document.createTextNode("PASS: scrollTop is greater than 60 0px")); 44 line.appendChild(document.createTextNode("PASS: scrollTop is greater than 60 0px"));
41 else 45 else
42 line.appendChild(document.createTextNode("FAIL: scrollTop is " + scrollTop+ "px, but should be more than 600px")); 46 line.appendChild(document.createTextNode("FAIL: scrollTop is " + scrollTop+ "px, but should be more than 600px"));
43 document.getElementById('console').appendChild(line); 47 document.getElementById('console').appendChild(line);
44 48
45 if (window.testRunner) 49 if (window.testRunner)
46 testRunner.notifyDone(); 50 testRunner.notifyDone();
47 51
48 </script></body></html> 52 </script></body></html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698