function createTestManager() {
  var agent = new Messaging.Agent('test_manager');
  var messageHandler = Messaging.GetHandler();

  // Handles the repsonse from test agents which have finished their test.
  agent.addTask(TEST_ENDED, function(message, portFrom) {
    // Early return if test failed.
    if (message.result === TEST_FAILED) {
      chrome.test.failed();
      return;
    }
    switch (message.source) {
      case 'first_test':
        console.log('First test ended.');
        requestTestStart('second_test');
        break;
      case 'second_test':
        console.log('Second test ended.');
        requestTestStart('third_test');
        break;
      case 'third_test':
        console.log('Third test ended.');
        chrome.test.succeed();
        break;
    }
  });

  messageHandler.addAgent(agent);
}
// Creates an agent which manages the tests.
Creates an agent which manages the tests.
Creates an agent which manages the tests .
function createTestManager() {
  var agent = new Messaging.Agent('test_manager');
  var messageHandler = Messaging.GetHandler();
  agent.addTask(TEST_ENDED, function(message, portFrom) {
    if (message.result === TEST_FAILED) {
      chrome.test.failed();
      return;
    }
    switch (message.source) {
      case 'first_test':
        console.log('First test ended.');
        requestTestStart('second_test');
        break;
      case 'second_test':
        console.log('Second test ended.');
        requestTestStart('third_test');
        break;
      case 'third_test':
        console.log('Third test ended.');
        chrome.test.succeed();
        break;
    }
  });
  messageHandler.addAgent(agent);
}
function createTestManager ( ) { var agent = new Messaging . Agent ( 'test_manager' ) ; var messageHandler = Messaging . GetHandler ( ) ; agent . addTask ( TEST_ENDED , function ( message , portFrom ) { if ( message . result === TEST_FAILED ) { chrome . test . failed ( ) ; return ; } switch ( message . source ) { case 'first_test' : console . log ( 'First test ended.' ) ; requestTestStart ( 'second_test' ) ; break ; case 'second_test' : console . log ( 'Second test ended.' ) ; requestTestStart ( 'third_test' ) ; break ; case 'third_test' : console . log ( 'Third test ended.' ) ; chrome . test . succeed ( ) ; break ; } } ) ; messageHandler . addAgent ( agent ) ; }
Creates an agent which manages the tests.
Creates an agent which manages the tests .
// Handles the repsonse from test agents which have finished their test. // Early return if test failed.