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 assert_equals(entries.length, 2, | 14 assert_equals(entries.length, 2, |
| 15 "There should be two paint timing instances."); | 15 "There should be two paint timing instances."); |
| 16 assert_equals(entries[0].entryType, "paint", | 16 assert_equals(entries[0].entryType, "paint", |
| 17 "Expected entryType to be: paint."); | 17 "Expected entryType to be: paint."); |
| 18 assert_equals(entries[0].name, "first-paint", | |
| 19 "Expected entryType to be: paint."); | |
| 18 assert_equals(entries[0].duration, 0, | 20 assert_equals(entries[0].duration, 0, |
| 19 "Expected duration to be: 0."); | 21 "Expected duration to be: 0."); |
| 20 | 22 |
| 21 assert_equals(entries[1].entryType, "paint", | 23 assert_equals(entries[1].entryType, "paint", |
| 22 "Expected entryType to be: paint."); | 24 "Expected entryType to be: paint."); |
| 25 assert_equals(entries[1].name, "first-contentful-paint", | |
| 26 "Expected entryType to be: paint."); | |
| 23 assert_equals(entries[1].duration, 0, | 27 assert_equals(entries[1].duration, 0, |
| 24 "Expected duration to be: 0."); | 28 "Expected duration to be: 0."); |
| 25 observer.disconnect(); | 29 observer.disconnect(); |
| 30 | |
| 31 // Check buffer | |
|
tdresser
2017/05/23 17:33:57
I think we try for tailing "."'s in JS too, don't
panicker
2017/05/23 17:44:11
Is this in the style guide somewhere?
tdresser
2017/05/23 18:11:14
JS style guide says follow C++ guide for comments
panicker
2017/05/23 22:57:17
not sure "proper punctuation" entails a period for
| |
| 32 bufferedEntries = performance.getEntriesByType('paint'); | |
| 33 assert_equals(bufferedEntries.length, 2, | |
| 34 "There should be two paint timing instances."); | |
| 35 assert_equals(bufferedEntries[0].entryType, "paint", | |
| 36 "Expected entryType to be: paint."); | |
| 37 assert_equals(bufferedEntries[0].name, "first-paint", | |
| 38 "Expected entryType to be: paint."); | |
| 39 assert_equals(bufferedEntries[1].entryType, "paint", | |
| 40 "Expected entryType to be: paint."); | |
| 41 assert_equals(bufferedEntries[1].name, "first-contentful-paint", | |
| 42 "Expected entryType to be: paint."); | |
| 43 | |
| 26 t.done(); | 44 t.done(); |
| 27 }) | 45 }) |
| 28 ); | 46 ); |
| 29 observer.observe({entryTypes: ["paint"]}); | 47 observer.observe({entryTypes: ["paint"]}); |
| 30 | 48 |
| 31 }, "Both first-paint-timing and first-contentful-paint timing entry are obse rvable."); | 49 }, "Both first-paint-timing and first-contentful-paint timing entry are obse rvable."); |
| 32 | 50 |
| 33 </script> | 51 </script> |
| 34 <div style="background-color:black;color:white;padding:20px;">...test...</di v> | 52 <div style="background-color:black;color:white;padding:20px;">...test...</di v> |
| 35 </body> | 53 </body> |
| 36 </html> | 54 </html> |
| OLD | NEW |