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     'unittest_test.html',
     13     'overlay_test.html',
     14     'timeline_async_slice_group_test.html',
     15     'timeline_find_control_test.html',
     16     'timeline_slice_group_test.html',
     17     'timeline_stream_importer_test.html',
     18     'timeline_thread_test.html',
     19     'timeline_process_test.html',
     20     'timeline_category_filter_dialog_test.html',
     21     'timeline_counter_test.html',
     22     'timeline_cpu_test.html',
     23     'timeline_filter_test.html',
     24     'timeline_model_test.html',
     25     'linux_perf_importer_test.html',
     26     'linux_perf_android_parser_test.html',
     27     'linux_perf_bus_parser_test.html',
     28     'linux_perf_clock_parser_test.html',
     29     'linux_perf_cpufreq_parser_test.html',
     30     'linux_perf_drm_parser_test.html',
     31     'linux_perf_exynos_parser_test.html',
     32     'linux_perf_gesture_parser_test.html',
     33     'linux_perf_i915_parser_test.html',
     34     'linux_perf_mali_parser_test.html',
     35     'linux_perf_power_parser_test.html',
     36     'linux_perf_sched_parser_test.html',
     37     'linux_perf_workqueue_parser_test.html',
     38     'trace_event_importer_test.html',
     39     'profiling_view_test.html',
     40     'timeline_selection_test.html',
     41     'timeline_test.html',
     42     'timeline_view_test.html',
     43     'timeline_viewport_test.html',
     44     'timeline_analysis_test.html',
     45     'ui_test.html',
     46     'settings_test.html',
     47     'tracks/timeline_async_slice_group_track_test.html',
     48     'tracks/timeline_cpu_track_test.html',
     49     'tracks/timeline_counter_track_test.html',
     50     'tracks/timeline_slice_group_track_test.html',
     51     'tracks/timeline_slice_track_test.html',
     52     'tracks/timeline_thread_track_test.html',
     53     'tracks/timeline_viewport_track_test.html',
     54   ];
     55 </script>
     56 <style>
     57   h1 {
     58       font-family: sans-serif;
     59       font-size: 18pt;
     60   }
     61 </style>
     62 <script src="base.js"></script>
     63 <script>
     64   base.require('unittest');
     65 </script>
     66 </head>
     67 <body>
     68   <h1>Trace-Viewer Tests</h3>
     69 
     70   <div class="unittest">Interactive tests: <a href="interactive_tests.html" class="unittest-error-link">Run manually</a></div>
     71   <br>
     72 
     73   <script>
     74   function runTest(runner, testCaseEl, test) {
     75     testCaseEl.status = 'RUNNING'
     76 
     77     var iframe = document.createElement('iframe');
     78     iframe.src = test;
     79     iframe.style.position = 'fixed';
     80     iframe.style.visibility = 'hidden';
     81     document.body.appendChild(iframe);
     82     iframe.contentWindow.addEventListener('error', function(msg, url, lineNumber) {
     83       if (iframe.contentWindow.G_testRunner)
     84         return false;
     85 
     86       if (iframe.contentWindow.errorsCaughtByTestHarness)
     87         return false;
     88 
     89       iframe.contentWindow.errorsCaughtByTestHarness = [
     90           {msg: msg, url: url, lineNumber: lineNumber}];
     91       return false;
     92     });
     93 
     94     function checkForDone() {
     95       if (!iframe.contentWindow) {
     96         setTimeout(checkForDone, 100);
     97         return;
     98       }
     99 
    100       if (iframe.contentWindow.errorsCaughtByTestHarness &&
    101         iframe.contentWindow.errorsCaughtByTestHarness.length) {
    102         testCaseEl.status = 'FAILED'
    103         return;
    104       }
    105 
    106       if (!iframe.contentWindow.G_testRunner) {
    107         setTimeout(checkForDone, 100);
    108         return;
    109       }
    110 
    111       var runner = iframe.contentWindow.G_testRunner;
    112       if (!runner.done) {
    113         setTimeout(checkForDone, 100);
    114         return;
    115       }
    116 
    117       var stats = runner.computeResultStats();
    118       if (stats.numTestsRun && !stats.numTestsWithErrors)
    119         testCaseEl.status = 'PASSED'
    120       else
    121         testCaseEl.status = 'FAILED'
    122     }
    123     setTimeout(checkForDone, 0);
    124   }
    125 
    126   function run() {
    127     var resultsEl = document.createElement('div');
    128     resultsEl.className = 'unittest';
    129     document.body.appendChild(resultsEl);
    130 
    131     var numPassed = 0;
    132     var numFailures = 0;
    133     var runner = {
    134       addFailedTest: function() {
    135         numFailures++;
    136       },
    137       addPassedTest: function() {
    138         numPassed++;
    139       }
    140     };
    141     function begin() {
    142       for (var i = 0; i < tests.length; i++) {
    143         (function() {
    144           var testCaseEl = unittest.createTestCaseDiv_(tests[i], tests[i], true);
    145           resultsEl.appendChild(testCaseEl);
    146           runTest(runner, testCaseEl, tests[i]);
    147         })();
    148       }
    149     }
    150     begin();
    151   }
    152   document.addEventListener('DOMContentLoaded', run);
    153   </script>
    154 </body>
    155 </html>
    156