11cb0ef41Sopenharmony_ciasync_test(t => {
21cb0ef41Sopenharmony_ci  // First observer creates second in callback to ensure the entry has been dispatched by the time
31cb0ef41Sopenharmony_ci  // the second observer begins observing.
41cb0ef41Sopenharmony_ci  new PerformanceObserver(() => {
51cb0ef41Sopenharmony_ci    // Second observer requires 'buffered: true' to see an entry.
61cb0ef41Sopenharmony_ci    new PerformanceObserver(t.step_func_done(list => {
71cb0ef41Sopenharmony_ci      const entries = list.getEntries();
81cb0ef41Sopenharmony_ci      assert_equals(entries.length, 1, 'There should be 1 mark entry.');
91cb0ef41Sopenharmony_ci      assert_equals(entries[0].entryType, 'mark');
101cb0ef41Sopenharmony_ci    })).observe({type: 'mark', buffered: true});
111cb0ef41Sopenharmony_ci  }).observe({entryTypes: ['mark']});
121cb0ef41Sopenharmony_ci  performance.mark('foo');
131cb0ef41Sopenharmony_ci}, 'PerformanceObserver with buffered flag sees previous marks');
141cb0ef41Sopenharmony_ci
151cb0ef41Sopenharmony_ciasync_test(t => {
161cb0ef41Sopenharmony_ci  // First observer creates second in callback to ensure the entry has been dispatched by the time
171cb0ef41Sopenharmony_ci  // the second observer begins observing.
181cb0ef41Sopenharmony_ci  new PerformanceObserver(() => {
191cb0ef41Sopenharmony_ci    // Second observer requires 'buffered: true' to see an entry.
201cb0ef41Sopenharmony_ci    new PerformanceObserver(t.step_func_done(list => {
211cb0ef41Sopenharmony_ci      const entries = list.getEntries();
221cb0ef41Sopenharmony_ci      assert_equals(entries.length, 1, 'There should be 1 measure entry.');
231cb0ef41Sopenharmony_ci      assert_equals(entries[0].entryType, 'measure');
241cb0ef41Sopenharmony_ci    })).observe({type: 'measure', buffered: true});
251cb0ef41Sopenharmony_ci  }).observe({entryTypes: ['measure']});
261cb0ef41Sopenharmony_ci  performance.measure('bar');
271cb0ef41Sopenharmony_ci}, 'PerformanceObserver with buffered flag sees previous measures');
28