OLD | NEW |
---|---|
(Empty) | |
1 <!DOCTYPE html> | |
2 <head> | |
3 <title>Performance Paint Timing Test</title> | |
4 </head> | |
5 <body> | |
6 <script src="../../resources/testharness.js"></script> | |
7 <script src="../../resources/testharnessreport.js"></script> | |
8 <div id="main"></div> | |
9 | |
10 <script> | |
11 async_test(function(t) { | |
12 testRunner.capturePixelsAsyncThen(t.step_func(function() { | |
13 bufferedEntries = performance.getEntriesByType('paint'); | |
14 assert_equals(bufferedEntries.length, 0, "No paint entries yet"); | |
15 | |
16 var div = document.createElement("div"); | |
tdresser
2017/06/09 14:26:27
Should we use const/let in tests at this point?
panicker
2017/06/09 20:29:48
Done.
| |
17 div.style.width = "100px"; | |
18 div.style.height = "100px"; | |
19 div.style.backgroundColor = "red"; | |
20 div.style.color = "blue"; | |
21 div.innerHTML = "test" | |
22 document.getElementById("main").appendChild(div); | |
23 | |
24 testRunner.capturePixelsAsyncThen(t.step_func_done(function() { | |
25 bufferedEntries = performance.getEntriesByType('paint'); | |
26 assert_equals(bufferedEntries.length, 2, "FP and FCP."); | |
27 assert_equals(bufferedEntries[0].entryType, "paint"); | |
28 assert_equals(bufferedEntries[0].name, "first-paint"); | |
29 assert_equals(bufferedEntries[1].entryType, "paint"); | |
30 assert_equals(bufferedEntries[1].name, "first-contentful-paint") ; | |
31 })); | |
32 })); | |
33 }, "Basic test to check existence of FP and FCP."); | |
34 </script> | |
35 </body> | |
36 </html> | |
OLD | NEW |