function testGetFileTasksShouldNotBeCalledMultipleTimes(callback) {
  setupFileManagerPrivate();
  var selectionHandler = new MockFileSelectionHandler();
  var fileSystem = new MockFileSystem('volumeId');
  selectionHandler.updateSelection(
      [new MockFileEntry(fileSystem, '/test.png', {})], ['image/png']);

  var controller = createTaskController(selectionHandler);

  assert(window.chrome.fileManagerPrivate.getFileTaskCalledCount_ === 0);
  controller.getFileTasks()
      .then(function(tasks) {
        assert(window.chrome.fileManagerPrivate.getFileTaskCalledCount_ === 1);
        assert(util.isSameEntries(
            tasks.entries, selectionHandler.selection.entries));
        // Make oldSelection.entries !== newSelection.entries
        selectionHandler.updateSelection(
            [new MockFileEntry(fileSystem, '/test.png', {})], ['image/png']);
        return controller.getFileTasks();
      })
      .then(function(tasks) {
        assert(window.chrome.fileManagerPrivate.getFileTaskCalledCount_ === 1);
        assert(util.isSameEntries(
            tasks.entries, selectionHandler.selection.entries));
        callback();
      })
      .catch(function(error) {
        assertNotReached(error);
        callback();
      });
}
// multiple times when the selected entries are not changed.
multiple times when the selected entries are not changed.
multiple times when the selected entries are not changed .
function testGetFileTasksShouldNotBeCalledMultipleTimes(callback) {
  setupFileManagerPrivate();
  var selectionHandler = new MockFileSelectionHandler();
  var fileSystem = new MockFileSystem('volumeId');
  selectionHandler.updateSelection(
      [new MockFileEntry(fileSystem, '/test.png', {})], ['image/png']);
  var controller = createTaskController(selectionHandler);
  assert(window.chrome.fileManagerPrivate.getFileTaskCalledCount_ === 0);
  controller.getFileTasks()
      .then(function(tasks) {
        assert(window.chrome.fileManagerPrivate.getFileTaskCalledCount_ === 1);
        assert(util.isSameEntries(
            tasks.entries, selectionHandler.selection.entries));
        selectionHandler.updateSelection(
            [new MockFileEntry(fileSystem, '/test.png', {})], ['image/png']);
        return controller.getFileTasks();
      })
      .then(function(tasks) {
        assert(window.chrome.fileManagerPrivate.getFileTaskCalledCount_ === 1);
        assert(util.isSameEntries(
            tasks.entries, selectionHandler.selection.entries));
        callback();
      })
      .catch(function(error) {
        assertNotReached(error);
        callback();
      });
}
function testGetFileTasksShouldNotBeCalledMultipleTimes ( callback ) { setupFileManagerPrivate ( ) ; var selectionHandler = new MockFileSelectionHandler ( ) ; var fileSystem = new MockFileSystem ( 'volumeId' ) ; selectionHandler . updateSelection ( [ new MockFileEntry ( fileSystem , '/test.png' , { } ) ] , [ 'image/png' ] ) ; var controller = createTaskController ( selectionHandler ) ; assert ( window . chrome . fileManagerPrivate . getFileTaskCalledCount_ === 0 ) ; controller . getFileTasks ( ) . then ( function ( tasks ) { assert ( window . chrome . fileManagerPrivate . getFileTaskCalledCount_ === 1 ) ; assert ( util . isSameEntries ( tasks . entries , selectionHandler . selection . entries ) ) ; selectionHandler . updateSelection ( [ new MockFileEntry ( fileSystem , '/test.png' , { } ) ] , [ 'image/png' ] ) ; return controller . getFileTasks ( ) ; } ) . then ( function ( tasks ) { assert ( window . chrome . fileManagerPrivate . getFileTaskCalledCount_ === 1 ) ; assert ( util . isSameEntries ( tasks . entries , selectionHandler . selection . entries ) ) ; callback ( ) ; } ) . catch ( function ( error ) { assertNotReached ( error ) ; callback ( ) ; } ) ; }
multiple times when the selected entries are not changed.
multiple times when the selected entries are not changed .
// Make oldSelection.entries !== newSelection.entries