B2G/gecko/testing/peptest/peptest/extension/chrome/content/init.js
/**
 * This is the entry point for peptest.
 * Gets called when the browser is first loaded.
 */
This is the entry point for peptest.
Gets called when the browser is first loaded.
This is the entry point for peptest . Gets called when the browser is first loaded .
function initialize() {
  window.removeEventListener("load", initialize, false);
  let cmd = cmdLineHandler.wrappedJSObject;
  if (cmd.firstRun) {
    cmd.firstRun = false;
    try {
      let manifest = cmd.manifest;
      let data = utils.readFile(manifest);
      let obj = JSON.parse(data.join(' '));
      broker.addObject(new MozmillMsgListener());
      APPCONTENT = document.getElementById('appcontent');
      function runTests() {
        APPCONTENT.removeEventListener('pageshow', runTests);
        suite = new TestSuite(obj.tests, obj.options);
        suite.run();
        goQuitApplication();
      };
      APPCONTENT.addEventListener('pageshow', runTests);
    } catch(e) {
      log.error(e.toString());
      log.debug('Traceback:');
      lines = e.stack.split('\n');
      for (let i = 0; i < lines.length - 1; ++i) {
        log.debug('\t' + lines[i]);
      }
      goQuitApplication();
    }
  }
}
function initialize ( ) { window . removeEventListener ( "load" , initialize , false ) ; let cmd = cmdLineHandler . wrappedJSObject ; if ( cmd . firstRun ) { cmd . firstRun = false ; try { let manifest = cmd . manifest ; let data = utils . readFile ( manifest ) ; let obj = JSON . parse ( data . join ( ' ' ) ) ; broker . addObject ( new MozmillMsgListener ( ) ) ; APPCONTENT = document . getElementById ( 'appcontent' ) ; function runTests ( ) { APPCONTENT . removeEventListener ( 'pageshow' , runTests ) ; suite = new TestSuite ( obj . tests , obj . options ) ; suite . run ( ) ; goQuitApplication ( ) ; } ; APPCONTENT . addEventListener ( 'pageshow' , runTests ) ; } catch ( e ) { log . error ( e . toString ( ) ) ; log . debug ( 'Traceback:' ) ; lines = e . stack . split ( '\n' ) ; for ( let i = 0 ; i < lines . length - 1 ; ++ i ) { log . debug ( '\t' + lines [ i ] ) ; } goQuitApplication ( ) ; } } }
This is the entry point for peptest.
This is the entry point for peptest .
// cmd.firstRun is used so the tests don't // get run again if a second window is opened // get json manifest object // register mozmill listener // set a load listener on the content and run the tests when loaded