11cb0ef41Sopenharmony_ci// META: script=resources/user-timing-helper.js 21cb0ef41Sopenharmony_ci 31cb0ef41Sopenharmony_ciasync_test(function (t) { 41cb0ef41Sopenharmony_ci let mark_entries = []; 51cb0ef41Sopenharmony_ci const expected_entries = 61cb0ef41Sopenharmony_ci [{ entryType: "mark", name: "mark1", detail: null}, 71cb0ef41Sopenharmony_ci { entryType: "mark", name: "mark2", detail: null}, 81cb0ef41Sopenharmony_ci { entryType: "mark", name: "mark3", detail: null}, 91cb0ef41Sopenharmony_ci { entryType: "mark", name: "mark4", detail: null}, 101cb0ef41Sopenharmony_ci { entryType: "mark", name: "mark5", detail: null}, 111cb0ef41Sopenharmony_ci { entryType: "mark", name: "mark6", detail: {}}, 121cb0ef41Sopenharmony_ci { entryType: "mark", name: "mark7", detail: {info: 'abc'}}, 131cb0ef41Sopenharmony_ci { entryType: "mark", name: "mark8", detail: null, startTime: 234.56}, 141cb0ef41Sopenharmony_ci { entryType: "mark", name: "mark9", detail: {count: 3}, startTime: 345.67}]; 151cb0ef41Sopenharmony_ci const observer = new PerformanceObserver( 161cb0ef41Sopenharmony_ci t.step_func(function (entryList, obs) { 171cb0ef41Sopenharmony_ci mark_entries = 181cb0ef41Sopenharmony_ci mark_entries.concat(entryList.getEntries()); 191cb0ef41Sopenharmony_ci if (mark_entries.length >= expected_entries.length) { 201cb0ef41Sopenharmony_ci checkEntries(mark_entries, expected_entries); 211cb0ef41Sopenharmony_ci observer.disconnect(); 221cb0ef41Sopenharmony_ci t.done(); 231cb0ef41Sopenharmony_ci } 241cb0ef41Sopenharmony_ci }) 251cb0ef41Sopenharmony_ci ); 261cb0ef41Sopenharmony_ci self.performance.clearMarks(); 271cb0ef41Sopenharmony_ci observer.observe({entryTypes: ["mark"]}); 281cb0ef41Sopenharmony_ci const returned_entries = []; 291cb0ef41Sopenharmony_ci returned_entries.push(self.performance.mark("mark1")); 301cb0ef41Sopenharmony_ci returned_entries.push(self.performance.mark("mark2", undefined)); 311cb0ef41Sopenharmony_ci returned_entries.push(self.performance.mark("mark3", null)); 321cb0ef41Sopenharmony_ci returned_entries.push(self.performance.mark("mark4", {})); 331cb0ef41Sopenharmony_ci returned_entries.push(self.performance.mark("mark5", {detail: null})); 341cb0ef41Sopenharmony_ci returned_entries.push(self.performance.mark("mark6", {detail: {}})); 351cb0ef41Sopenharmony_ci returned_entries.push(self.performance.mark("mark7", {detail: {info: 'abc'}})); 361cb0ef41Sopenharmony_ci returned_entries.push(self.performance.mark("mark8", {startTime: 234.56})); 371cb0ef41Sopenharmony_ci returned_entries.push(self.performance.mark("mark9", {detail: {count: 3}, startTime: 345.67})); 381cb0ef41Sopenharmony_ci checkEntries(returned_entries, expected_entries); 391cb0ef41Sopenharmony_ci}, "mark entries' detail and startTime are customizable."); 40