function testCopyFails(callback) {
  var fileSystem = createTestFileSystem('testVolume', {
    '/': DIRECTORY_SIZE,
    '/test.txt': 10
  });

  volumeManager = {
    /* Mocking volume manager. */
    getVolumeInfo: function() {
      // Return null to simulate that the volume info is not available.
      return null;
    }
  };
  fileOperationManager = new FileOperationManager();

  var eventLogger = new EventLogger(fileOperationManager);

  // Copy test.txt to /.
  fileOperationManager.paste([fileSystem.entries['/test.txt']],
      fileSystem.entries['/'],
      false);

  reportPromise(waitUntil(function() {
    return eventLogger.numberOfErrorEvents === 1;
  }).then(function() {
    // Since the task fails with an error, pending copy tasks should be empty.
    assertEquals(0,
        fileOperationManager.getPendingCopyTasksForTesting().length);

    // Check events.
    var events = eventLogger.events;
    assertEquals(2, events.length);
    assertEquals('BEGIN', events[0].reason);
    assertEquals('ERROR', events[1].reason);
    assertEquals(events[0].taskId, events[1].taskId);
  }), callback);
}
/**
 * Test case that a copy fails since destination volume is not available.
 */
Test case that a copy fails since destination volume is not available.
Test case that a copy fails since destination volume is not available .
function testCopyFails(callback) {
  var fileSystem = createTestFileSystem('testVolume', {
    '/': DIRECTORY_SIZE,
    '/test.txt': 10
  });
  volumeManager = {
    getVolumeInfo: function() {
      return null;
    }
  };
  fileOperationManager = new FileOperationManager();
  var eventLogger = new EventLogger(fileOperationManager);
  fileOperationManager.paste([fileSystem.entries['/test.txt']],
      fileSystem.entries['/'],
      false);
  reportPromise(waitUntil(function() {
    return eventLogger.numberOfErrorEvents === 1;
  }).then(function() {
    assertEquals(0,
        fileOperationManager.getPendingCopyTasksForTesting().length);
    var events = eventLogger.events;
    assertEquals(2, events.length);
    assertEquals('BEGIN', events[0].reason);
    assertEquals('ERROR', events[1].reason);
    assertEquals(events[0].taskId, events[1].taskId);
  }), callback);
}
function testCopyFails ( callback ) { var fileSystem = createTestFileSystem ( 'testVolume' , { '/' : DIRECTORY_SIZE , '/test.txt' : 10 } ) ; volumeManager = { getVolumeInfo : function ( ) { return null ; } } ; fileOperationManager = new FileOperationManager ( ) ; var eventLogger = new EventLogger ( fileOperationManager ) ; fileOperationManager . paste ( [ fileSystem . entries [ '/test.txt' ] ] , fileSystem . entries [ '/' ] , false ) ; reportPromise ( waitUntil ( function ( ) { return eventLogger . numberOfErrorEvents === 1 ; } ) . then ( function ( ) { assertEquals ( 0 , fileOperationManager . getPendingCopyTasksForTesting ( ) . length ) ; var events = eventLogger . events ; assertEquals ( 2 , events . length ) ; assertEquals ( 'BEGIN' , events [ 0 ] . reason ) ; assertEquals ( 'ERROR' , events [ 1 ] . reason ) ; assertEquals ( events [ 0 ] . taskId , events [ 1 ] . taskId ) ; } ) , callback ) ; }
Test case that a copy fails since destination volume is not available.
Test case that a copy fails since destination volume is not available .
/* Mocking volume manager. */ // Return null to simulate that the volume info is not available. // Copy test.txt to /. // Since the task fails with an error, pending copy tasks should be empty. // Check events.