function onExecuteListener(id, details) {
  if (testPreRunStatus.done)
    return;

  var fileEntries = details.entries;
  if (!fileEntries || fileEntries.length != 1) {
    onError('Unexpected file entries size.');
    return;
  }

  if ((id == 'ReadOnly' && testPreRunStatus.gotReadOnlyAction) ||
      (id == 'ReadWrite' && testPreRunStatus.gotReadWriteAction)) {
    onError('Action \'' + id + '\' executed more than once.');
    return;
  }

  if (id == 'ReadOnly') {
    var entry = fileEntries[0];

    // Add tests for read-only handler.
    handlerTests.push(function readReadOnly() { readTest(entry, true); });
    handlerTests.push(
        function getSiblingReadOnly() { getSiblingTest(entry); });
    handlerTests.push(function writeReadOnly() { writeTest(entry, false); });

    testPreRunStatus.gotReadOnlyAction = true;
  } else if (id == 'ReadWrite') {
    var entry = fileEntries[0];

    // Add tests for read-write handler.
    handlerTests.push(function readReadWrite() { readTest(entry, true); });
    handlerTests.push(
        function getSilblingReadWrite() { getSiblingTest(entry); });
    handlerTests.push(function writeReadWrite() { writeTest(entry, true); });

    testPreRunStatus.gotReadWriteAction = true;
  } else {
    onError('Unexpected action id: ' + id);
    return;
  }

  if (testPreRunStatus.gotReadOnlyAction &&
      testPreRunStatus.gotReadWriteAction) {
    testPreRunStatus.done = true;
    chrome.test.runTests(handlerTests);
  }
}
/**
 * Listens for onExecute events, and runs tests once all expected events are
 * received.
 */
Listens for onExecute events, and runs tests once all expected events are
received.
Listens for onExecute events and runs tests once all expected events are received .
function onExecuteListener(id, details) {
  if (testPreRunStatus.done)
    return;
  var fileEntries = details.entries;
  if (!fileEntries || fileEntries.length != 1) {
    onError('Unexpected file entries size.');
    return;
  }
  if ((id == 'ReadOnly' && testPreRunStatus.gotReadOnlyAction) ||
      (id == 'ReadWrite' && testPreRunStatus.gotReadWriteAction)) {
    onError('Action \'' + id + '\' executed more than once.');
    return;
  }
  if (id == 'ReadOnly') {
    var entry = fileEntries[0];
    handlerTests.push(function readReadOnly() { readTest(entry, true); });
    handlerTests.push(
        function getSiblingReadOnly() { getSiblingTest(entry); });
    handlerTests.push(function writeReadOnly() { writeTest(entry, false); });
    testPreRunStatus.gotReadOnlyAction = true;
  } else if (id == 'ReadWrite') {
    var entry = fileEntries[0];
    handlerTests.push(function readReadWrite() { readTest(entry, true); });
    handlerTests.push(
        function getSilblingReadWrite() { getSiblingTest(entry); });
    handlerTests.push(function writeReadWrite() { writeTest(entry, true); });
    testPreRunStatus.gotReadWriteAction = true;
  } else {
    onError('Unexpected action id: ' + id);
    return;
  }
  if (testPreRunStatus.gotReadOnlyAction &&
      testPreRunStatus.gotReadWriteAction) {
    testPreRunStatus.done = true;
    chrome.test.runTests(handlerTests);
  }
}
function onExecuteListener ( id , details ) { if ( testPreRunStatus . done ) return ; var fileEntries = details . entries ; if ( ! fileEntries || fileEntries . length != 1 ) { onError ( 'Unexpected file entries size.' ) ; return ; } if ( ( id == 'ReadOnly' && testPreRunStatus . gotReadOnlyAction ) || ( id == 'ReadWrite' && testPreRunStatus . gotReadWriteAction ) ) { onError ( 'Action \'' + id + '\' executed more than once.' ) ; return ; } if ( id == 'ReadOnly' ) { var entry = fileEntries [ 0 ] ; handlerTests . push ( function readReadOnly ( ) { readTest ( entry , true ) ; } ) ; handlerTests . push ( function getSiblingReadOnly ( ) { getSiblingTest ( entry ) ; } ) ; handlerTests . push ( function writeReadOnly ( ) { writeTest ( entry , false ) ; } ) ; testPreRunStatus . gotReadOnlyAction = true ; } else if ( id == 'ReadWrite' ) { var entry = fileEntries [ 0 ] ; handlerTests . push ( function readReadWrite ( ) { readTest ( entry , true ) ; } ) ; handlerTests . push ( function getSilblingReadWrite ( ) { getSiblingTest ( entry ) ; } ) ; handlerTests . push ( function writeReadWrite ( ) { writeTest ( entry , true ) ; } ) ; testPreRunStatus . gotReadWriteAction = true ; } else { onError ( 'Unexpected action id: ' + id ) ; return ; } if ( testPreRunStatus . gotReadOnlyAction && testPreRunStatus . gotReadWriteAction ) { testPreRunStatus . done = true ; chrome . test . runTests ( handlerTests ) ; } }
Listens for onExecute events, and runs tests once all expected events are
 received.
Listens for onExecute events and runs tests once all expected events are received .
// Add tests for read-only handler. // Add tests for read-write handler.