OLD | NEW |
---|---|
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <head> | 2 <head> |
3 <title>Performance Paint Timing Test</title> | 3 <title>Performance Paint Timing Test</title> |
tdresser
2017/06/08 14:34:33
Should these titles be more descriptive?
panicker
2017/06/08 22:47:04
Done.
| |
4 </head> | 4 </head> |
5 <body> | 5 <body> |
6 <script src="../../resources/testharness.js"></script> | 6 <script src="../../resources/testharness.js"></script> |
7 <script src="../../resources/testharnessreport.js"></script> | 7 <script src="../../resources/testharnessreport.js"></script> |
8 <div id="svg"></div> | |
9 | |
8 <script> | 10 <script> |
9 async_test(function (t) { | 11 async_test(function (t) { |
10 var observer = new PerformanceObserver( | 12 var img = document.createElement("IMG"); |
11 t.step_func(function (entryList) { | 13 img.src = "resources/circle.svg"; |
12 var entries = entryList.getEntries(); | 14 document.getElementById('svg').appendChild(img); |
tdresser
2017/06/08 14:34:32
Would this be clearer in html vs js?
panicker
2017/06/08 22:47:04
the reason to do stuff in JS is to control timing
tdresser
2017/06/09 14:26:27
In this example, what would the difference in timi
panicker
2017/06/09 20:29:48
I think in this case it's fine because I moved the
| |
13 assert_equals(entries.length, 2, | 15 testRunner.capturePixelsAsyncThen(t.step_func_done(function() { |
14 "There should be two paint timing instances."); | 16 bufferedEntries = performance.getEntriesByType('paint'); |
15 assert_equals(entries[0].entryType, "paint", | 17 assert_equals(bufferedEntries.length, 2, "There should be two paint timing instances."); |
16 "Expected entryType to be: paint."); | 18 assert_equals(bufferedEntries[0].entryType, "paint"); |
17 assert_equals(entries[0].duration, 0, | 19 assert_equals(bufferedEntries[0].name, "first-paint"); |
18 "Expected duration to be: 0."); | 20 assert_equals(bufferedEntries[1].entryType, "paint"); |
19 | 21 assert_equals(bufferedEntries[1].name, "first-contentful-paint"); |
20 assert_equals(entries[1].entryType, "paint", | 22 })); |
21 "Expected entryType to be: paint."); | |
22 assert_equals(entries[1].duration, 0, | |
23 "Expected duration to be: 0."); | |
24 observer.disconnect(); | |
25 t.done(); | |
26 }) | |
27 ); | |
28 observer.observe({entryTypes: ["paint"]}); | |
29 | |
30 }, "First contentful paint fires due to svg."); | 23 }, "First contentful paint fires due to svg."); |
31 </script> | 24 </script> |
32 | |
33 <script> | |
34 window.onload = function() { | |
35 var img = document.createElement("IMG"); | |
36 img.src = "resources/circle.svg"; | |
37 document.getElementById('svg').appendChild(img); | |
38 } | |
39 </script> | |
40 | |
41 <div id="svg"></div> | |
42 </body> | 25 </body> |
43 </html> | 26 </html> |
OLD | NEW |