function testDone(result) {
  if (!testIsDone) {
    testIsDone = true;
    if (currentTestCase) {
      var ok = true;
      ok = createExpect(
               currentTestCase.runAccessibilityAudit.bind(currentTestCase))
               .call(null) &&
          ok;
      ok = createExpect(currentTestCase.tearDown.bind(currentTestCase))
               .call(null) &&
          ok;

      if (!ok && result)
        result = [false, errorsToMessage(errors, result[1])];

      currentTestCase = null;
    }
    if (!result)
      result = testResult();

    if (hasWindow && window.webUiTest) {
      // For MojoWebUI tests.
      var testRunner = new webUiTest.mojom.TestRunnerPtr();
      Mojo.bindInterface(
          webUiTest.mojom.TestRunner.name, mojo.makeRequest(testRunner).handle);
      if (result[0])
        testRunner.testComplete();
      else
        testRunner.testComplete(result[1]);
    } else if (chrome.send) {
      // For WebUI and v8 unit tests.
      chrome.send('testResult', result);
    } else if (window.domAutomationController.send) {
      // For extension tests.
      valueResult = {'result': result[0], message: result[1]};
      window.domAutomationController.send(JSON.stringify(valueResult));
    }
    errors.splice(0, errors.length);
  } else {
    console.warn('testIsDone already');
  }
}
/**
 * Notifies the running browser test of the test results. Clears |errors|.
 * @param {Array<boolean, string>=} result When passed, this is used for the
 *     testResult message.
 */
Notifies the running browser test of the test results. Clears |errors|.
@param {Array=} result When passed, this is used for the
testResult message.
Notifies the running browser test of the test results . Clears |errors| . @param { Array = } result When passed this is used for the testResult message .
function testDone(result) {
  if (!testIsDone) {
    testIsDone = true;
    if (currentTestCase) {
      var ok = true;
      ok = createExpect(
               currentTestCase.runAccessibilityAudit.bind(currentTestCase))
               .call(null) &&
          ok;
      ok = createExpect(currentTestCase.tearDown.bind(currentTestCase))
               .call(null) &&
          ok;
      if (!ok && result)
        result = [false, errorsToMessage(errors, result[1])];
      currentTestCase = null;
    }
    if (!result)
      result = testResult();
    if (hasWindow && window.webUiTest) {
      var testRunner = new webUiTest.mojom.TestRunnerPtr();
      Mojo.bindInterface(
          webUiTest.mojom.TestRunner.name, mojo.makeRequest(testRunner).handle);
      if (result[0])
        testRunner.testComplete();
      else
        testRunner.testComplete(result[1]);
    } else if (chrome.send) {
      chrome.send('testResult', result);
    } else if (window.domAutomationController.send) {
      valueResult = {'result': result[0], message: result[1]};
      window.domAutomationController.send(JSON.stringify(valueResult));
    }
    errors.splice(0, errors.length);
  } else {
    console.warn('testIsDone already');
  }
}
function testDone ( result ) { if ( ! testIsDone ) { testIsDone = true ; if ( currentTestCase ) { var ok = true ; ok = createExpect ( currentTestCase . runAccessibilityAudit . bind ( currentTestCase ) ) . call ( null ) && ok ; ok = createExpect ( currentTestCase . tearDown . bind ( currentTestCase ) ) . call ( null ) && ok ; if ( ! ok && result ) result = [ false , errorsToMessage ( errors , result [ 1 ] ) ] ; currentTestCase = null ; } if ( ! result ) result = testResult ( ) ; if ( hasWindow && window . webUiTest ) { var testRunner = new webUiTest . mojom . TestRunnerPtr ( ) ; Mojo . bindInterface ( webUiTest . mojom . TestRunner . name , mojo . makeRequest ( testRunner ) . handle ) ; if ( result [ 0 ] ) testRunner . testComplete ( ) ; else testRunner . testComplete ( result [ 1 ] ) ; } else if ( chrome . send ) { chrome . send ( 'testResult' , result ) ; } else if ( window . domAutomationController . send ) { valueResult = { 'result' : result [ 0 ] , message : result [ 1 ] } ; window . domAutomationController . send ( JSON . stringify ( valueResult ) ) ; } errors . splice ( 0 , errors . length ) ; } else { console . warn ( 'testIsDone already' ) ; } }
Notifies the running browser test of the test results.
Notifies the running browser test of the test results .
// For MojoWebUI tests. // For WebUI and v8 unit tests. // For extension tests.