<commit_before><!DOCTYPE html>
<html>
<!--
Copyright (c) 2014 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>Trace-Viewer Tests: loading...</title>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">

  <link rel="shortcut icon" href="data:image/x-icon;base64," type="image/x-icon">

  <script src="/components/platform/platform.js"></script>

  <link rel="import" href="/components/polymer/polymer.html">
  <link rel="import" href="/base/base.html">
  <link rel="import" href="/base/unittest.html">
  <link rel="import" href="/base/unittest/interactive_test_runner.html">
  <style>
    html, body {
      box-sizing: border-box;
      width: 100%;
      height: 100%;
      overflow: hidden;
      margin: 0px;
    }
    body > x-base-interactive-test-runner {
      height: 100%;
      width: 100%;
    }

  </style>
</head>
<body>
  <script>
    'use strict';

    // The test runner no-ops pushState so keep it around.
    var realWindowHistoryPushState = window.history.pushState.bind(
        window.history);

    function stateToSearchString(defaultState, state) {
      var parts = [];
      for (var k in state) {
        if (state[k] === defaultState[k])
          continue;
        var v = state[k];
        var kv;
        if (v === true) {
          kv = k;
        } else if (v === false) {
          kv = k + '=false';
        } else if (v === '') {
          continue;
        } else {
          kv = k + '=' + v;
        }
        parts.push(kv);
      }
      return parts.join('&');
    }

    function stateFromSearchString(string) {
      var state = {};
      string.split('&').forEach(function(part) {
        if (part == '')
          return;
        var kv = part.split('=');
        var k, v;
        if (kv.length == 1) {
          k = kv[0];
          v = true;
        } else {
          k = kv[0];
          if (kv[1] == 'false')
            v = false;
          else
            v = kv[1];
        }
        state[k] = v;
      });
      return state;
    }

    function loadAndRunTests() {
      var state = stateFromSearchString(
          window.location.search.substring(1));
      updateTitle(state);

      var suiteNamesToLoad;
      if (state.testSuiteName) {
        suiteNamesToLoad = [];
        suiteNamesToLoad.push(state.testSuiteName);
      }

      var loader = new tv.b.unittest.SuiteLoader(suiteNamesToLoad);
      return loader.allSuitesLoadedPromise.then(
        function() {
          Polymer.whenReady(function() {
            runTests(loader, state);
          });
        },
        function(err) {
          tv.showPanic('Module loading failure', err);
          throw err;
        });
    }

    function updateTitle(state) {
      var testFilterString = state.testFilterString || '';
      var testSuiteName = state.testSuiteName || '';

      var title;<commit_msg>Indicate when tests are loading to address #791<commit_after><!DOCTYPE html>
<html>
<!--
Copyright (c) 2014 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>Trace-Viewer Tests: loading...</title>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">

  <link rel="shortcut icon" href="data:image/x-icon;base64," type="image/x-icon">

  <script src="/components/platform/platform.js"></script>

  <link rel="import" href="/components/polymer/polymer.html">
  <link rel="import" href="/base/base.html">
  <link rel="import" href="/base/unittest.html">
  <link rel="import" href="/base/unittest/interactive_test_runner.html">
  <style>
    html, body {
      box-sizing: border-box;
      width: 100%;
      height: 100%;
      overflow: hidden;
      margin: 0px;
    }
    body > x-base-interactive-test-runner {
      height: 100%;
      width: 100%;
    }

  </style>
</head>
<body>
  <script>
    'use strict';

    // The test runner no-ops pushState so keep it around.
    var realWindowHistoryPushState = window.history.pushState.bind(
        window.history);

    function stateToSearchString(defaultState, state) {
      var parts = [];
      for (var k in state) {
        if (state[k] === defaultState[k])
          continue;
        var v = state[k];
        var kv;
        if (v === true) {
          kv = k;
        } else if (v === false) {
          kv = k + '=false';
        } else if (v === '') {
          continue;
        } else {
          kv = k + '=' + v;
        }
        parts.push(kv);
      }
      return parts.join('&');
    }

    function stateFromSearchString(string) {
      var state = {};
      string.split('&').forEach(function(part) {
        if (part == '')
          return;
        var kv = part.split('=');
        var k, v;
        if (kv.length == 1) {
          k = kv[0];
          v = true;
        } else {
          k = kv[0];
          if (kv[1] == 'false')
            v = false;
          else
            v = kv[1];
        }
        state[k] = v;
      });
      return state;
    }

    function loadAndRunTests() {
      var state = stateFromSearchString(
          window.location.search.substring(1));
      updateTitle(state);

      var suiteNamesToLoad;
      if (state.testSuiteName) {
        suiteNamesToLoad = [];
        suiteNamesToLoad.push(state.testSuiteName);
      }

      showLoadingOverlay();
      var loader = new tv.b.unittest.SuiteLoader(suiteNamesToLoad);
      return loader.allSuitesLoadedPromise.then(
        function() {
          hideLoadingOverlay();
          Polymer.whenReady(function() {
            runTests(loader, state);
          });
        },
        function(err) {
          hideLoadingOverlay();
          tv.showPanic('Module loading failure', err);
          throw err;
        });
    }

    function showLoadingOverlay() {
      var overlay = document.createElement('div');
      overlay.id = 'tests-loading-overlay';
      overlay.style.backgroundColor = 'white';
      overlay.style.boxSizing = 'border-box';
      overlay.style.color = 'black';
      overlay.style.display = '-webkit-flex';
      overlay.style.height = '100%';
      overlay.style.left = 0;
      overlay.style.padding = '8px';
      overlay.style.position = 'fixed';
      overlay.style.top = 0;
      overlay.style.webkitFlexDirection = 'column';
      overlay.style.width = '100%';

      var element = document.createElement('div');
      element.style.webkitFlex = '1 1 auto';
      element.style.overflow = 'auto';
      overlay.appendChild(element);

      element.textContent = 'Loading tests...';
      document.body.appendChild(overlay);
    }
    function hideLoadingOverlay() {
      var overlay = document.body.querySelector('#tests-loading-overlay');
      document.body.removeChild(overlay);
    }

    function updateTitle(state) {
      var testFilterString = state.testFilterString || '';
      var testSuiteName = state.testSuiteName || '';

      var title;
{'fraction_non_alphanumeric': 0.1426948743433196, 'fraction_numerical': 0.009371006673292631, 'mean_word_length': 2.094903339191564, 'pattern_counts': {'":': 0, '<': 41, '<?xml version=': 0, '>': 43, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1527583', 'n_tokens_mistral': 2195, 'n_tokens_neox': 2097, 'n_words': 486}