function runAllTests(loadSuccess, responseCallback) {
  var response = { type: 'processTestResults',
                   testResults: {error: 0} };
  if (loadSuccess) {
    try {
      var messageListener = function(message) {
        // Get the test result.
        nacl_module.removeEventListener('message', messageListener, false);
        response.testResults.testResult = message.data;

        // Send the test result back to the main html page to check.
        // The main page will make sure the nexe loaded and that the
        // TestSimple test passed.
        responseCallback(response);
      };

      // Kick off the test.  The test will respond via post message.
      nacl_module.addEventListener("message", messageListener, false);
      nacl_module.postMessage("TestSimple");
    } catch (err) {
      // Trying to kick off the test failed, and threw a Javascript
      // exception.  Send the exception back to the main page so it can be
      // displayed.
      response.testResults.error = err.toString();
      responseCallback(response);
    }
  } else {
    // Notify the main page the nexe did not load.
    response.testResults.error = 'NaCl module failed to load';
    responseCallback(response);
  }
}
/**
 * Once the NaCl module is loaded, run some tests on it by attempting to
 * access a property and by calling a method.  Once these results are
 * obtained, send a message back to the embedding page with the results
 * via an RPC.  This function is provided as the callback to
 * waitForNaClModule().
 * @param {bool} loadSuccess Indicates whether the NaCl module was
 *     loaded.
 */
Once the NaCl module is loaded, run some tests on it by attempting to
access a property and by calling a method.  Once these results are
obtained, send a message back to the embedding page with the results
via an RPC.  This function is provided as the callback to
waitForNaClModule().
@param {bool} loadSuccess Indicates whether the NaCl module was
loaded.
Once the NaCl module is loaded run some tests on it by attempting to access a property and by calling a method . Once these results are obtained send a message back to the embedding page with the results via an RPC . This function is provided as the callback to waitForNaClModule () . @param { bool } loadSuccess Indicates whether the NaCl module was loaded .
function runAllTests(loadSuccess, responseCallback) {
  var response = { type: 'processTestResults',
                   testResults: {error: 0} };
  if (loadSuccess) {
    try {
      var messageListener = function(message) {
        nacl_module.removeEventListener('message', messageListener, false);
        response.testResults.testResult = message.data;
        responseCallback(response);
      };
      nacl_module.addEventListener("message", messageListener, false);
      nacl_module.postMessage("TestSimple");
    } catch (err) {
      response.testResults.error = err.toString();
      responseCallback(response);
    }
  } else {
    response.testResults.error = 'NaCl module failed to load';
    responseCallback(response);
  }
}
function runAllTests ( loadSuccess , responseCallback ) { var response = { type : 'processTestResults' , testResults : { error : 0 } } ; if ( loadSuccess ) { try { var messageListener = function ( message ) { nacl_module . removeEventListener ( 'message' , messageListener , false ) ; response . testResults . testResult = message . data ; responseCallback ( response ) ; } ; nacl_module . addEventListener ( "message" , messageListener , false ) ; nacl_module . postMessage ( "TestSimple" ) ; } catch ( err ) { response . testResults . error = err . toString ( ) ; responseCallback ( response ) ; } } else { response . testResults . error = 'NaCl module failed to load' ; responseCallback ( response ) ; } }
Once the NaCl module is loaded, run some tests on it by attempting to
 access a property and by calling a method.
Once the NaCl module is loaded run some tests on it by attempting to access a property and by calling a method .
// Get the test result. // Send the test result back to the main html page to check. // The main page will make sure the nexe loaded and that the // TestSimple test passed. // Kick off the test.  The test will respond via post message. // Trying to kick off the test failed, and threw a Javascript // exception.  Send the exception back to the main page so it can be // displayed. // Notify the main page the nexe did not load.