<!DOCTYPE html>
<html>
<!--
Copyright (c) 2012 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<head>
<title>All Tracing Tests</title>
<script>
  tests = [
    'unittest_test.html',
    'overlay_test.html',
    'timeline_async_slice_group_test.html',
    'timeline_find_control_test.html',
    'timeline_slice_group_test.html',
    'timeline_stream_importer_test.html',
    'timeline_thread_test.html',
    'timeline_process_test.html',
    'timeline_category_filter_dialog_test.html',
    'timeline_counter_test.html',
    'timeline_cpu_test.html',
    'timeline_filter_test.html',
    'timeline_model_test.html',
    'linux_perf_importer_test.html',
    'linux_perf_android_parser_test.html',
    'linux_perf_bus_parser_test.html',
    'linux_perf_clock_parser_test.html',
    'linux_perf_cpufreq_parser_test.html',
    'linux_perf_drm_parser_test.html',
    'linux_perf_exynos_parser_test.html',
    'linux_perf_gesture_parser_test.html',
    'linux_perf_i915_parser_test.html',
    'linux_perf_mali_parser_test.html',
    'linux_perf_power_parser_test.html',
    'linux_perf_sched_parser_test.html',
    'linux_perf_workqueue_parser_test.html',
    'trace_event_importer_test.html',
    'profiling_view_test.html',
    'timeline_selection_test.html',
    'timeline_test.html',
    'timeline_view_test.html',
    'timeline_viewport_test.html',
    'timeline_analysis_test.html',
    'ui_test.html',
    'settings_test.html',
    'tracks/timeline_async_slice_group_track_test.html',
    'tracks/timeline_cpu_track_test.html',
    'tracks/timeline_counter_track_test.html',
    'tracks/timeline_slice_group_track_test.html',
    'tracks/timeline_slice_track_test.html',
    'tracks/timeline_thread_track_test.html',
    'tracks/timeline_viewport_track_test.html',
  ];
</script>
<style>
  h1 {
      font-family: sans-serif;
      font-size: 18pt;
  }
</style>
<script src="base.js"></script>
<script>
  base.require('unittest');
</script>
</head>
<body>
  <h1>Trace-Viewer Tests</h3>

  <div class="unittest">Interactive tests: <a href="interactive_tests.html" class="unittest-error-link">Run manually</a></div>
  <br>

  <script>
  function runTest(runner, testCaseEl, test) {
    testCaseEl.status = 'RUNNING'

    var iframe = document.createElement('iframe');
    iframe.src = test;
    iframe.style.position = 'fixed';
    iframe.style.visibility = 'hidden';
    document.body.appendChild(iframe);
    iframe.contentWindow.addEventListener('error', function(msg, url, lineNumber) {
      if (iframe.contentWindow.G_testRunner)
        return false;

      if (iframe.contentWindow.errorsCaughtByTestHarness)
        return false;

      iframe.contentWindow.errorsCaughtByTestHarness = [
          {msg: msg, url: url, lineNumber: lineNumber}];
      return false;
    });

    function checkForDone() {
      if (!iframe.contentWindow) {
        setTimeout(checkForDone, 100);
        return;
      }

      if (iframe.contentWindow.errorsCaughtByTestHarness &&
        iframe.contentWindow.errorsCaughtByTestHarness.length) {
        testCaseEl.status = 'FAILED'
        return;
      }

      if (!iframe.contentWindow.G_testRunner) {
        setTimeout(checkForDone, 100);
        return;
      }

      var runner = iframe.contentWindow.G_testRunner;
      if (!runner.done) {
        setTimeout(checkForDone, 100);
        return;
      }

      var stats = runner.computeResultStats();
      if (stats.numTestsRun && !stats.numTestsWithErrors)
        testCaseEl.status = 'PASSED'
      else
        testCaseEl.status = 'FAILED'
    }
    setTimeout(checkForDone, 0);
  }

  function run() {
    var resultsEl = document.createElement('div');
    resultsEl.className = 'unittest';
    document.body.appendChild(resultsEl);

    var numPassed = 0;
    var numFailures = 0;
    var runner = {
      addFailedTest: function() {
        numFailures++;
      },
      addPassedTest: function() {
        numPassed++;
      }
    };
    function begin() {
      for (var i = 0; i < tests.length; i++) {
        (function() {
          var testCaseEl = unittest.createTestCaseDiv_(tests[i], tests[i], true);
          resultsEl.appendChild(testCaseEl);
          runTest(runner, testCaseEl, tests[i]);
        })();
      }
    }
    begin();
  }
  document.addEventListener('DOMContentLoaded', run);
  </script>
</body>
</html>
