Home | History | Annotate | Download | only in src
      1 <!DOCTYPE html>
      2 <html>
      3 <!--
      4 Copyright (c) 2012 The Chromium Authors. All rights reserved.
      5 Use of this source code is governed by a BSD-style license that can be
      6 found in the LICENSE file.
      7 -->
      8 <head>
      9 <title>All Tracing Tests</title>
     10 <script>
     11   tests = [
     12     'category_filter_dialog_test.html',
     13     'filter_test.html',
     14     'find_control_test.html',
     15     'overlay_test.html',
     16     'profiling_view_test.html',
     17     'range_test.html',
     18     'selection_test.html',
     19     'settings_test.html',
     20     'timeline_analysis_view_test.html',
     21     'timeline_test.html',
     22     'timeline_view_test.html',
     23     'timeline_viewport_test.html',
     24     'ui_test.html',
     25     'unittest_test.html',
     26 
     27     'model_test.html',
     28     'model/async_slice_group_test.html',
     29     'model/counter_test.html',
     30     'model/cpu_test.html',
     31     'model/process_base_test.html',
     32     'model/process_test.html',
     33     'model/slice_group_test.html',
     34     'model/thread_test.html',
     35 
     36     'importer/linux_perf_importer_test.html',
     37     'importer/linux_perf/android_parser_test.html',
     38     'importer/linux_perf/bus_parser_test.html',
     39     'importer/linux_perf/clock_parser_test.html',
     40     'importer/linux_perf/cpufreq_parser_test.html',
     41     'importer/linux_perf/disk_parser_test.html',
     42     'importer/linux_perf/drm_parser_test.html',
     43     'importer/linux_perf/exynos_parser_test.html',
     44     'importer/linux_perf/gesture_parser_test.html',
     45     'importer/linux_perf/i915_parser_test.html',
     46     'importer/linux_perf/kfunc_parser_test.html',
     47     'importer/linux_perf/mali_parser_test.html',
     48     'importer/linux_perf/power_parser_test.html',
     49     'importer/linux_perf/sched_parser_test.html',
     50     'importer/linux_perf/workqueue_parser_test.html',
     51     'importer/timeline_stream_importer_test.html',
     52     'importer/trace_event_importer_test.html',
     53     'importer/v8_log_importer_test.html',
     54 
     55     'tracks/async_slice_group_track_test.html',
     56     'tracks/cpu_track_test.html',
     57     'tracks/counter_track_test.html',
     58     'tracks/slice_group_track_test.html',
     59     'tracks/slice_track_test.html',
     60     'tracks/thread_track_test.html',
     61     'tracks/ruler_track_test.html',
     62 
     63     'analysis/counter_selection_analysis_test.html',
     64     'analysis/selection_analysis_test.html',
     65     'analysis/slice_selection_analysis_test.html',
     66     'analysis/slice_group_selection_analysis_test.html',
     67     'analysis/single_counter_selection_analysis_test.html',
     68     'analysis/single_slice_selection_analysis_test.html',
     69   ];
     70 </script>
     71 <style>
     72   h1 {
     73       font-family: sans-serif;
     74       font-size: 18pt;
     75   }
     76 </style>
     77 <script src="base.js"></script>
     78 <script>
     79   base.require('unittest');
     80 </script>
     81 </head>
     82 <body>
     83   <h1>Trace-Viewer Tests</h3>
     84 
     85   <div class="unittest">Interactive tests: <a href="interactive_tests.html" class="unittest-error-link">Run manually</a></div>
     86   <br>
     87 
     88   <script>
     89   function runTest(runner, testCaseEl, test) {
     90     testCaseEl.status = 'RUNNING'
     91 
     92     var iframe = document.createElement('iframe');
     93     iframe.src = test;
     94     iframe.style.position = 'fixed';
     95     iframe.style.visibility = 'hidden';
     96     document.body.appendChild(iframe);
     97     iframe.contentWindow.addEventListener('error', function(msg, url, lineNumber) {
     98       if (iframe.contentWindow.G_testRunner)
     99         return false;
    100 
    101       if (iframe.contentWindow.errorsCaughtByTestHarness)
    102         return false;
    103 
    104       iframe.contentWindow.errorsCaughtByTestHarness = [
    105           {msg: msg, url: url, lineNumber: lineNumber}];
    106       return false;
    107     });
    108 
    109     function checkForDone() {
    110       if (!iframe.contentWindow) {
    111         setTimeout(checkForDone, 100);
    112         return;
    113       }
    114 
    115       if (iframe.contentWindow.errorsCaughtByTestHarness &&
    116         iframe.contentWindow.errorsCaughtByTestHarness.length) {
    117         testCaseEl.status = 'FAILED'
    118         return;
    119       }
    120 
    121       if (!iframe.contentWindow.G_testRunner) {
    122         setTimeout(checkForDone, 100);
    123         return;
    124       }
    125 
    126       var runner = iframe.contentWindow.G_testRunner;
    127       if (!runner.done) {
    128         setTimeout(checkForDone, 100);
    129         return;
    130       }
    131 
    132       var stats = runner.computeResultStats();
    133       if (stats.numTestsRun && !stats.numTestsWithErrors)
    134         testCaseEl.status = 'PASSED'
    135       else
    136         testCaseEl.status = 'FAILED'
    137     }
    138     setTimeout(checkForDone, 0);
    139   }
    140 
    141   function run() {
    142     var resultsEl = document.createElement('div');
    143     resultsEl.className = 'unittest';
    144     document.body.appendChild(resultsEl);
    145 
    146     var numPassed = 0;
    147     var numFailures = 0;
    148     var runner = {
    149       addFailedTest: function() {
    150         numFailures++;
    151       },
    152       addPassedTest: function() {
    153         numPassed++;
    154       }
    155     };
    156     function begin() {
    157       for (var i = 0; i < tests.length; i++) {
    158         (function() {
    159           var testCaseEl = unittest.createTestCaseDiv_(tests[i], tests[i], true);
    160           resultsEl.appendChild(testCaseEl);
    161           runTest(runner, testCaseEl, tests[i]);
    162         })();
    163       }
    164     }
    165     begin();
    166   }
    167   document.addEventListener('DOMContentLoaded', run);
    168   </script>
    169 </body>
    170 </html>
    171