Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(76)

Side by Side Diff: third_party/WebKit/LayoutTests/fast/performance/longtasktiming.html

Issue 2610063006: Create TaskAttributionTiming PerformanceEntry for attribution in PerformanceLongTaskTiming. Move cu… (Closed)
Patch Set: update copyright year Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <script src="../../resources/testharness.js"></script> 2 <script src="../../resources/testharness.js"></script>
3 <script src="../../resources/testharnessreport.js"></script> 3 <script src="../../resources/testharnessreport.js"></script>
4 <script> 4 <script>
5 5
6 async_test(function (t) { 6 async_test(function (t) {
7 var observer = new PerformanceObserver( 7 var observer = new PerformanceObserver(
8 t.step_func(function (entryList) { 8 t.step_func(function (entryList) {
9 var entries = entryList.getEntries(); 9 var entries = entryList.getEntries();
10 /* TODO(panicker): Update after fixing http://crbug.com/651461 */ 10 assert_equals(entries.length, 1,
11 for (var i = 0; i < entries.length; i++) { 11 "Exactly one entry is expected.");
12 assert_equals(entries[i].entryType, "longtask", 12 var longtask = entries[0];
13 "entryType expected to be: longtask"); 13 assert_equals(longtask.entryType, "longtask",
14 assert_equals(entries[i].name, "same-origin-self", 14 "entryType expected to be: longtask");
15 "name expected to be: same-origin-self"); 15 assert_equals(longtask.name, "same-origin-self",
16 assert_greater_than(entries[i].duration, 50, 16 "name expected to be: same-origin-self");
17 "duration expected to be greater than 50ms threshold"); 17 assert_greater_than(longtask.duration, 50,
18 assert_equals(entries[i].startTime, Math.floor(entries[i].startT ime), 18 "duration expected to be greater than 50ms threshold");
19 "startTime expected to have 1 miilisecond granularity"); 19 assert_equals(longtask.startTime, Math.floor(longtask.startTime),
20 } 20 "startTime expected to have 1 miilisecond granularity");
tdresser 2017/01/05 13:34:14 millisecond
panicker 2017/01/05 20:56:49 Done.
21
22 // Assert the TaskAttributionTiming entry in attribution
tdresser 2017/01/05 13:34:14 Nit: I think comments are supposed to always end i
panicker 2017/01/05 20:56:49 Done.
23 assert_equals(longtask.attribution.length, 1,
24 "Exactly one attribution entry is expected");
25 var attribution = longtask.attribution[0];
26 assert_equals(attribution.entryType, "taskattribution");
27 assert_equals(attribution.name, "frame");
28 assert_equals(attribution.duration, 0);
29 assert_equals(attribution.startTime, 0);
30
21 observer.disconnect(); 31 observer.disconnect();
22 t.done(); 32 t.done();
23 }) 33 })
24 ); 34 );
25 observer.observe({entryTypes: ["longtask"]}); 35 observer.observe({entryTypes: ["longtask"]});
26 36
27 /* Generate a slow task */ 37 /* Generate a slow task */
28 var begin = window.performance.now(); 38 var begin = window.performance.now();
29 while (window.performance.now() < begin + 51); 39 while (window.performance.now() < begin + 51);
30 40
31 }, "Performance longtask entries are observable"); 41 }, "Performance longtask entries are observable");
32 42
33 </script> 43 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698