<commit_before><!DOCTYPE html>
<html>
<!--
Copyright (c) 2013 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>tvcm/module_test_case_backend.html</title>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  <script src="/platform.min.js"></script>
  <script src="/polymer.min.js"></script>
  <link rel="import" href="/tvcm/unittest.html">
  <link rel="import" href="/tvcm/unittest/text_test_results.html">
  <link rel="import" href="/tvcm/unittest/suite_loader.html">
  <link rel="import" href="/tvcm/unittest/test_runner.html">
</head>
<body>
  <h1 id="status">
  </h1>
  <script>
    'use strict';
    /**
     * Polled by tvcm.module_test_case
     */
    window.__readyToRun = false;

    var statusEl = document.querySelector('#status');
    function discoverTestsInModules(testModuleNames) {
      statusEl.textContent = 'Discovering tests...';
      var loader = new tvcm.unittest.SuiteLoader(testModuleNames);
      return loader.allSuitesLoadedPromise.then(function() {
        return loader.getAllTests().filter(function(test) {
          return test.testType == tvcm.unittest.TestTypes.UNITTEST;
        }).map(function(test) {
          statusEl.textContent = 'Idle';
          return test.fullyQualifiedName;
        });
      });
    }

    function runTestNamed(fullyQualifiedTestName) {
      statusEl.textContent = 'Running ' + fullyQualifiedTestName;
      function cleanup() {
        statusEl.textContent = '';
      }
      return _runTestNamedImpl(fullyQualifiedTestName).then(
        cleanup, cleanup);
    }

    function _runTestNamedImpl(fullyQualifiedTestName) {
      var p = tvcm.unittest.TestCase.parseFullyQualifiedName(
          fullyQualifiedTestName);
      var suiteNameToLoad = p.suiteName;
      var testCaseNameToRun = p.testCaseName;

      var runTestResolver;
      var runTestPromise = new Promise(function(resolve, reject) {
        runTestResolver = {
          resolve: resolve,
          reject: reject
        };
      });

      var loader = new tvcm.unittest.SuiteLoader([suiteNameToLoad]);
      loader.allSuitesLoadedPromise.then(
        beginRunningTestCase,
        loadSuiteFailed);

      var results = new tvcm.unittest.TextTestResults();
      function loadSuiteFailed(e) {
        var normalizedException = tvcm.normalizeException(e);
        runTestResolver.reject(e);
      }

      function beginRunningTestCase() {
        var testCase = loader.findTestWithFullyQualifiedName(
            fullyQualifiedTestName);
        var runner = new tvcm.unittest.TestRunner(results, [testCase]);
        runner.beginRunning();
        return runner.runCompletedPromise.then(
          runTestCaseComplete,
          runTestCaseComplete);
      }

      function runTestCaseComplete() {
        if (results.numTestsThatFailed === 0) {
          runTestResolver.fulfill();
          return;
        }

        runTestResolver.reject(results.buffer);
      }
      return runTestPromise;
    }

    window.addEventListener('load', function() {
      window.__readyToRun = true;
    });
  </script>
</body>
</html><commit_msg>Fix lingering fulfill call left over from promises conversion<commit_after><!DOCTYPE html>
<html>
<!--
Copyright (c) 2013 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>tvcm/module_test_case_backend.html</title>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  <script src="/platform.min.js"></script>
  <script src="/polymer.min.js"></script>
  <link rel="import" href="/tvcm/unittest.html">
  <link rel="import" href="/tvcm/unittest/text_test_results.html">
  <link rel="import" href="/tvcm/unittest/suite_loader.html">
  <link rel="import" href="/tvcm/unittest/test_runner.html">
</head>
<body>
  <h1 id="status">
  </h1>
  <script>
    'use strict';
    /**
     * Polled by tvcm.module_test_case
     */
    window.__readyToRun = false;

    var statusEl = document.querySelector('#status');
    function discoverTestsInModules(testModuleNames) {
      statusEl.textContent = 'Discovering tests...';
      var loader = new tvcm.unittest.SuiteLoader(testModuleNames);
      return loader.allSuitesLoadedPromise.then(function() {
        return loader.getAllTests().filter(function(test) {
          return test.testType == tvcm.unittest.TestTypes.UNITTEST;
        }).map(function(test) {
          statusEl.textContent = 'Idle';
          return test.fullyQualifiedName;
        });
      });
    }

    function runTestNamed(fullyQualifiedTestName) {
      statusEl.textContent = 'Running ' + fullyQualifiedTestName;
      function cleanup() {
        statusEl.textContent = '';
      }
      return _runTestNamedImpl(fullyQualifiedTestName).then(
        cleanup, cleanup);
    }

    function _runTestNamedImpl(fullyQualifiedTestName) {
      var p = tvcm.unittest.TestCase.parseFullyQualifiedName(
          fullyQualifiedTestName);
      var suiteNameToLoad = p.suiteName;
      var testCaseNameToRun = p.testCaseName;

      var runTestResolver;
      var runTestPromise = new Promise(function(resolve, reject) {
        runTestResolver = {
          resolve: resolve,
          reject: reject
        };
      });

      var loader = new tvcm.unittest.SuiteLoader([suiteNameToLoad]);
      loader.allSuitesLoadedPromise.then(
        beginRunningTestCase,
        loadSuiteFailed);

      var results = new tvcm.unittest.TextTestResults();
      function loadSuiteFailed(e) {
        var normalizedException = tvcm.normalizeException(e);
        runTestResolver.reject(e);
      }

      function beginRunningTestCase() {
        var testCase = loader.findTestWithFullyQualifiedName(
            fullyQualifiedTestName);
        var runner = new tvcm.unittest.TestRunner(results, [testCase]);
        runner.beginRunning();
        return runner.runCompletedPromise.then(
          runTestCaseComplete,
          runTestCaseComplete);
      }

      function runTestCaseComplete() {
        if (results.numTestsThatFailed === 0) {
          runTestResolver.resolve();
          return;
        }

        runTestResolver.reject(results.buffer);
      }
      return runTestPromise;
    }

    window.addEventListener('load', function() {
      window.__readyToRun = true;
    });
  </script>
</body>
</html>
{'fraction_non_alphanumeric': 0.11602722772277228, 'fraction_numerical': 0.0024752475247524753, 'mean_word_length': 2.915808600847971, 'pattern_counts': {'":': 0, '<': 49, '<?xml version=': 0, '>': 49, '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': '4229537', 'n_tokens_mistral': 1884, 'n_tokens_neox': 1850, 'n_words': 359}