OLD | NEW |
---|---|
(Empty) | |
1 <!DOCTYPE HTML> | |
2 <script src="../../../resources/js-test.js"></script> | |
3 <style> | |
4 | |
5 ::-webkit-scrollbar { | |
6 display: none; | |
7 } | |
8 body { | |
9 margin: 0px; | |
10 height: 1000px; | |
11 width: 1000px; | |
12 } | |
13 #parent { | |
14 background-color: #FF7F7F; | |
15 height: 600px; | |
16 width: 600px; | |
17 overflow: scroll; | |
18 } | |
19 #content1 { | |
20 height: 700px; | |
21 width: 700px; | |
22 } | |
23 #child { | |
24 background-color: #84BE6A; | |
25 height: 500px; | |
26 width: 500px; | |
27 overflow: scroll; | |
28 } | |
29 #content2 { | |
30 height: 600px; | |
31 width: 600px; | |
32 } | |
33 </style> | |
34 | |
35 <div id="parent"> | |
36 <div id="content1"> | |
37 <div id="child"> | |
38 <div id="content2"> | |
39 </div> | |
40 </div> | |
41 </div> | |
42 </div> | |
43 | |
44 <script> | |
45 | |
46 window.jsTestIsAsync = true; | |
47 | |
48 var parent = document.getElementById('parent'); | |
49 var child = document.getElementById('child'); | |
50 | |
51 function runTest() { | |
52 if (!window.chrome || !chrome.gpuBenchmarking) { | |
tdresser
2016/08/12 13:28:32
Should we output some kind of message that the tes
sahel
2016/08/12 15:45:29
Done.
| |
53 finishJSTest(); | |
54 } | |
55 var rect = child.getBoundingClientRect(); | |
56 chrome.gpuBenchmarking.smoothScrollBy(150, function() {}, | |
tdresser
2016/08/12 13:28:32
Can you pass null instead of an empty function?
I
sahel
2016/08/12 15:45:29
Done.
| |
57 rect.left, rect.right, | |
58 2, "down", 4000); | |
59 | |
60 debug("The child div scrolls till the end."); | |
61 shouldBecomeEqual("child.scrollTop", "100", | |
62 function () { | |
63 // Wait for 0.5s and then check if the parent has scrolled . | |
64 setTimeout(parentDivScrollCheck, 500); | |
tdresser
2016/08/12 13:28:32
You might not need this setTimeout if you move to
sahel
2016/08/12 15:45:29
Done.
| |
65 }); | |
66 } | |
67 | |
68 function parentDivScrollCheck() { | |
69 shouldBeZero("parent.scrollTop"); | |
70 finishJSTest(); | |
71 } | |
72 | |
73 window.onload = runTest(); | |
74 | |
75 </script> | |
OLD | NEW |