OLD | NEW |
1 <!doctype html> | 1 <!doctype html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <meta name="viewport" content="user-scalable:no"> | 4 <meta name="viewport" content="user-scalable:no"> |
5 <style type="text/css"> | 5 <style type="text/css"> |
6 body { height: 1500px; } | 6 body { height: 1500px; } |
7 #center { | 7 #center { |
8 position: fixed; | 8 position: fixed; |
9 left: 40%;; | 9 left: 40%;; |
10 width: 50%; | 10 width: 50%; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 console.timeEnd('Interaction.DrawerAnimation/is_smooth'); | 43 console.timeEnd('Interaction.DrawerAnimation/is_smooth'); |
44 window.animationDone = true; | 44 window.animationDone = true; |
45 }); | 45 }); |
46 }); | 46 }); |
47 } | 47 } |
48 </script> | 48 </script> |
49 | 49 |
50 <script> | 50 <script> |
51 'use strict'; | 51 'use strict'; |
52 var jankMs = 100; | 52 var jankMs = 100; |
| 53 var slowMs = 200; |
53 window.jankScriptDone = false; | 54 window.jankScriptDone = false; |
| 55 window.slowScriptDone = false; |
| 56 function waitMs(ms) { |
| 57 var startTime = window.performance.now(); |
| 58 var currTime = startTime; |
| 59 while (currTime - startTime < ms) { |
| 60 var currTime = window.performance.now(); |
| 61 } |
| 62 } |
54 function makeJank() { | 63 function makeJank() { |
55 console.time('Interaction.JankThreadJSRun/is_responsive'); | 64 console.time('Interaction.JankThreadJSRun/is_responsive'); |
56 var startTime = window.performance.now(); | 65 waitMs(jankMs); |
57 var currTime = startTime; | |
58 while (currTime - startTime < jankMs) { | |
59 var currTime = window.performance.now(); | |
60 } | |
61 console.timeEnd('Interaction.JankThreadJSRun/is_responsive'); | 66 console.timeEnd('Interaction.JankThreadJSRun/is_responsive'); |
62 window.jankScriptDone = true; | 67 window.jankScriptDone = true; |
63 } | 68 } |
| 69 function makeSlow() { |
| 70 console.time('Interaction.SlowThreadJsRun/is_fast'); |
| 71 waitMs(slowMs); |
| 72 console.timeEnd('Interaction.SlowThreadJsRun/is_fast'); |
| 73 window.slowScriptDone = true; |
| 74 } |
64 </script> | 75 </script> |
65 | 76 |
66 </head> | 77 </head> |
67 <body> | 78 <body> |
68 <div id="center"> | 79 <div id="center"> |
69 This is something in the middle. | 80 This is something in the middle. |
70 </div> | 81 </div> |
71 <div id="drawer"> | 82 <div id="drawer"> |
72 This is a drawer. | 83 This is a drawer. |
73 </div> | 84 </div> |
74 <button type="button" id="animating-button" onclick="makeAnimation()"> | 85 <button type="button" id="animating-button" onclick="makeAnimation()"> |
75 Click or tap this to trigger an animation. | 86 Click or tap this to trigger an animation. |
76 </div> | 87 </div> |
77 <button type="button" id="jank-button" onclick="makeJank()"> | 88 <button type="button" id="jank-button" onclick="makeJank()"> |
78 Click or tap this to make jank of 100ms (approximately). | 89 Click or tap this to make jank of 100ms (approximately). |
79 </div> | 90 </div> |
| 91 <button type="button" id="slow-button" onclick="makeSlow()"> |
| 92 Click or tap this to make wait 200ms (approximately). |
| 93 </div> |
80 | 94 |
81 </body> | 95 </body> |
82 </html> | 96 </html> |
OLD | NEW |