OLD | NEW |
1 <!DOCTYPE HTML> | 1 <!DOCTYPE HTML> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <meta charset="utf-8" /> | 4 <meta charset="utf-8" /> |
5 <title>read and clear resource timing entry in onresourcetimingbufferful
l callback</title> | 5 <title>This test validates the behavior of read and clear operation in o
nresourcetimingbufferfull callback of resource timing.</title> |
6 <script src="/w3c/webperf/resources/webperftestharnessextension.js"></sc
ript> | 6 <script src="/w3c/webperf/resources/webperftestharnessextension.js"></sc
ript> |
7 <script> | 7 <script> |
8 var context = new PerformanceContext(performance); | 8 var context = new PerformanceContext(performance); |
9 var resource_timing_buffer_size = 1; | 9 var resource_timing_buffer_size = 1; |
10 var global_buffer = []; | 10 var global_buffer = []; |
11 function store_and_clear() | 11 function store_and_clear() |
12 { | 12 { |
13 var entry_list = context.getEntriesByType('resource'); | 13 var entry_list = context.getEntriesByType('resource'); |
14 for (var i = 0; i < entry_list.length; ++i) | 14 for (var i = 0; i < entry_list.length; ++i) |
15 global_buffer.push(entry_list[i]); | 15 global_buffer.push(entry_list[i]); |
(...skipping 11 matching lines...) Expand all Loading... |
27 setup({ explicit_done: true }); | 27 setup({ explicit_done: true }); |
28 function onload_test() | 28 function onload_test() |
29 { | 29 { |
30 test_equals(context.getEntriesByType('resource').length, 0, "No
entry should be stored in resource timing buffer since it's cleared once an item
arrived!"); | 30 test_equals(context.getEntriesByType('resource').length, 0, "No
entry should be stored in resource timing buffer since it's cleared once an item
arrived!"); |
31 test_equals(global_buffer.length, 4, "4 resource timing entries
should be moved to global buffer!"); | 31 test_equals(global_buffer.length, 4, "4 resource timing entries
should be moved to global buffer!"); |
32 done(); | 32 done(); |
33 } | 33 } |
34 </script> | 34 </script> |
35 </head> | 35 </head> |
36 <body onload=onload_test()> | 36 <body onload=onload_test()> |
37 <h1>Description</h1> | |
38 <p>This test validates the behavior of read and clear operation in onres
ourcetimingbufferfull callback of resource timing.</p> | |
39 </body> | 37 </body> |
40 </html> | 38 </html> |
OLD | NEW |