chromium/third_party/blink/web_tests/harness-tests/escape-bad-characters.html

<!DOCTYPE html>
<title>Harness Test: No unescaped characters that break tools in test output.</title>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<script>

// Run child test in an iframe so that we can validate the output
// generated by testharnessreport.js.
var childTest = document.createElement('iframe');
childTest.src = './resources/escape-bad-characters-input.html';

window.onload = function() {
  document.body.appendChild(childTest);
};

var crTest =
    async_test('No unescaped carriage returns in testharnessreport.js output.');
var nullTest =
    async_test('No unescaped null characters in testharnessreport.js output.');

// Receive output from child test and make sure it has no problematic characters.
window.addEventListener('message', function(event) {
  if (event.data.type === 'child_test_done') {
    document.body.removeChild(childTest);

    crTest.step(function() {
      assert_equals(event.data.result.indexOf('\r'), -1);
    });
    crTest.done();

    nullTest.step(function() {
      assert_equals(event.data.result.indexOf('\0'), -1);
    });
    nullTest.done();
  }
});

</script>