Chromium Code Reviews| 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> |
| 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 <script> | 8 <script> |
| 9 | 9 |
| 10 async_test(function (t) { | 10 async_test(function (t) { |
| 11 var observer = new PerformanceObserver( | 11 var observer = new PerformanceObserver( |
| 12 t.step_func(function (entryList) { | 12 t.step_func(function (entryList) { |
| 13 var entries = entryList.getEntries(); | 13 var entries = entryList.getEntries(); |
| 14 // Nothing contentful to be painted yet. | 14 // Nothing contentful to be painted yet. |
| 15 assert_equals(entries.length, 1, | 15 assert_equals(entries.length, 1, |
| 16 "There should be only first paint timing instance."); | 16 "There should be only first paint timing instance."); |
| 17 assert_equals(entries[0].entryType, "paint", | 17 assert_equals(entries[0].entryType, "paint", |
| 18 "Expected entryType to be: paint."); | 18 "Expected entryType to be: paint."); |
| 19 assert_equals(entries[0].name, "first-paint", | 19 assert_equals(entries[0].name, "first-paint", |
| 20 "Expected name to be: first-paint."); | 20 "Expected name to be: first-paint."); |
| 21 assert_equals(entries[0].duration, 0, | 21 assert_equals(entries[0].duration, 0, |
| 22 "Expected duration to be: 0."); | 22 "Expected duration to be: 0."); |
| 23 observer.disconnect(); | 23 observer.disconnect(); |
| 24 t.done(); | 24 t.done(); |
| 25 }) | 25 }) |
| 26 ); | 26 ); |
| 27 observer.observe({entryTypes: ["paint"]}); | 27 observer.observe({entryTypes: ["paint"]}); |
| 28 | 28 |
| 29 }, "Performance first paint timing entry is observable."); | 29 }, "Performance first paint timing entry is observable. No first contentful paint."); |
|
igrigorik
2017/05/08 20:37:04
Does it make sense to t.done() after onload?
panicker
2017/05/09 17:55:06
Good point, I added a step_timeout to wait for 1s
| |
| 30 </script> | 30 </script> |
| 31 | 31 |
| 32 <div style="background-color:black;color:white;padding:20px;"></div> | 32 <div style="background-color:black;color:white;padding:20px;"></div> |
| 33 </body> | 33 </body> |
| 34 </html> | 34 </html> |
| OLD | NEW |