buffer-full-set-to-current-buffer.html (1583B)
1 <!DOCTYPE HTML> 2 <html> 3 <head> 4 <meta charset="utf-8"> 5 <title>This test validates that setResourceTimingBufferFull behaves appropriately when set to the current buffer level.</title> 6 <link rel="author" title="Google" href="http://www.google.com/" /> 7 <link rel="help" href="https://www.w3.org/TR/resource-timing-2/#dom-performance-onresourcetimingbufferfull"> 8 <script src="/resources/testharness.js"></script> 9 <script src="/resources/testharnessreport.js"></script> 10 <script src="resources/resource-loaders.js"></script> 11 <script src="resources/buffer-full-utilities.js"></script> 12 </head> 13 <body> 14 <script> 15 promise_test(async () => { 16 let result = ''; 17 performance.addEventListener('resourcetimingbufferfull', () => { 18 result += 'Event Fired with ' + 19 performance.getEntriesByType('resource').length + ' entries.'; 20 performance.clearResourceTimings(); 21 }); 22 result += 'Before adding entries. '; 23 await fillUpTheBufferWithTwoResources(); 24 result += 'After adding entries. '; 25 load.script(scriptResources[2]); 26 await bufferFullFirePromise; 27 assert_equals(result, 'Before adding entries. After adding entries. Event Fired with 2 entries.'); 28 const entries = performance.getEntriesByType('resource'); 29 assert_equals(entries.length, 1, 30 'Number of entries in resource timing buffer is unexpected'); 31 assert_true(entries[0].name.includes(scriptResources[2]), 32 'The entry must correspond to the last resource loaded.') 33 }, "Test that adding entries and firing the buffer full event happen in the right order."); 34 </script>