tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

measures.html (2628B)


      1 <!DOCTYPE html>
      2 <html>
      3 <head>
      4 <meta charset="utf-8" />
      5 <title>functionality test of window.performance.measure</title>
      6 <link rel="author" title="Intel" href="http://www.intel.com/" />
      7 <link rel="help" href="http://www.w3.org/TR/user-timing/#extensions-performance-interface"/>
      8 <script src="/resources/testharness.js"></script>
      9 <script src="/resources/testharnessreport.js"></script>
     10 <script src="/common/performance-timeline-utils.js"></script>
     11 <script src="resources/webperftestharness.js"></script>
     12 <script src="resources/webperftestharnessextension.js"></script>
     13 <script>
     14 setup({ explicit_done: true });
     15 
     16 function onload_test()
     17 {
     18    const context = new PerformanceContext(window.performance);
     19    const entrylist_checker = new performance_entrylist_checker('measure');
     20    const measure_names = measures.map(function(x) {return x[0];});
     21 
     22    test_equals(context.getEntriesByType('measure').length, 0, 'There should be ' + 0 + ' entries returned.');
     23 
     24    mark_names.forEach(function(name) {
     25        context.mark(name);
     26    });
     27    measures.forEach(context.initialMeasures, context);
     28 
     29    let measure_entrylist = context.getEntriesByType('measure');
     30    entrylist_checker.entrylist_check(measure_entrylist, measures.length, measure_names,
     31        'Checking all entries.');
     32 
     33    for (let i = 0; i < measure_entrylist.length; ++i)
     34    {
     35        const measure_entrylist_by_name = context.getEntriesByName(measure_entrylist[i].name, 'measure');
     36        entrylist_checker.entrylist_check(measure_entrylist_by_name, 1, measure_names,
     37            'First loop: checking entry of name "' + measure_entrylist[i].name + '".');
     38    }
     39 
     40    // Following cases test for scenarios that measure names are tied for two times
     41    mark_names.forEach(function(name) {
     42        context.mark(name);
     43    });
     44    measures.forEach(context.initialMeasures, context);
     45 
     46    measure_entrylist = context.getEntriesByType('measure');
     47    entrylist_checker.entrylist_check(measure_entrylist, measures.length * 2, measure_names,
     48        'Checking all doubly measured entries.');
     49 
     50    for (let i = 0; i < measure_entrylist.length; ++i)
     51    {
     52        const measure_entrylist_by_name = context.getEntriesByName(measure_entrylist[i].name, 'measure');
     53        entrylist_checker.entrylist_check(measure_entrylist_by_name, 2, measure_names,
     54            'Second loop step ' + i + ': checking entry of name "' + measure_entrylist[i].name + '".');
     55    }
     56 
     57    done();
     58 }
     59 </script>
     60 </head>
     61 <body onload=onload_test()>
     62    <h1>Description</h1>
     63    <p>This test validates functionality of the interface window.performance.measure.</p>
     64    <div id="log"></div>
     65 </body>
     66 </html>