function runTests() {
  chrome.test.runTests([
    // Test if providers are notified that no thumbnail is requested when normal
    // metadata is requested.
    function notRequestedAndNotProvidedThumbnailSuccess() {
      test_util.fileSystem.root.getFile(
          TESTING_WITH_VALID_THUMBNAIL_FILE.name,
          {create: false},
          chrome.test.callbackPass(),
          function(error) {
            chrome.test.fail(error.name);
          });
    },

    // If providers return a thumbnail data despite not being requested for
    // that, then the operation must fail.
    function notRequestedButProvidedThumbnailError() {
      test_util.fileSystem.root.getFile(
          TESTING_ALWAYS_WITH_THUMBNAIL_FILE.name,
          {create: false},
          function(fileEntry) {
            chrome.test.fail(
                'Thumbnail returned when not requested should result in an ' +
                'error, but the operation succeeded.');
          }, chrome.test.callbackPass(function(error) {
            chrome.test.assertEq('InvalidStateError', error.name);
          }));
    },

    // Thumbnails should be returned when available for private API request.
    function getEntryPropertiesWithThumbnailSuccess() {
      test_util.fileSystem.root.getFile(
          TESTING_WITH_VALID_THUMBNAIL_FILE.name,
          {create: false},
          chrome.test.callbackPass(function(fileEntry) {
            chrome.fileManagerPrivate.getEntryProperties(
                [fileEntry],
                ['thumbnailUrl', 'size', 'modificationTime'],
                chrome.test.callbackPass(function(fileProperties) {
                  chrome.test.assertEq(1, fileProperties.length);
                  chrome.test.assertEq(
                      TESTING_WITH_VALID_THUMBNAIL_FILE.thumbnail,
                      fileProperties[0].thumbnailUrl);
                  chrome.test.assertEq(
                      TESTING_WITH_VALID_THUMBNAIL_FILE.size,
                      fileProperties[0].size);
                  chrome.test.assertEq(
                      TESTING_WITH_VALID_THUMBNAIL_FILE.modificationTime,
                      new Date(fileProperties[0].modificationTime));
                }));
            }),
            function(error) {
              chrome.test.fail(error.name);
            });
    },

    // Confirm that extensions are not able to pass an invalid thumbnail url,
    // including evil urls.
    function getEntryPropertiesWithInvalidThumbnail() {
      test_util.fileSystem.root.getFile(
          TESTING_WITH_INVALID_THUMBNAIL_FILE.name,
          {create: false},
          chrome.test.callbackPass(function(fileEntry) {
            chrome.fileManagerPrivate.getEntryProperties(
                [fileEntry],
                ['thumbnailUrl'],
                chrome.test.callbackPass(function(fileProperties) {
                  chrome.test.assertEq(1, fileProperties.length);
                  // The results for an entry is an empty dictionary in
                  // case of an error.
                  chrome.test.assertEq(
                      0, Object.keys(fileProperties[0]).length);
                }));
            }),
            function(error) {
              chrome.test.fail(error.name);
            });
    },

    // Confirm that the thumbnail is not requested when not needed.
    function getEntryPropertiesWithoutThumbnail() {
      test_util.fileSystem.root.getFile(
          TESTING_WITH_VALID_THUMBNAIL_FILE.name,
          {create: false},
          chrome.test.callbackPass(function(fileEntry) {
            chrome.fileManagerPrivate.getEntryProperties(
                [fileEntry],
                ['size'],
                chrome.test.callbackPass(function(fileProperties) {
                  chrome.test.assertEq(1, fileProperties.length);
                  chrome.test.assertFalse(
                      'thumbnailUrl' in fileProperties[0]);
                  chrome.test.assertEq(
                      TESTING_WITH_VALID_THUMBNAIL_FILE.size,
                      fileProperties[0].size);
                }));
            }),
            function(error) {
              chrome.test.fail(error.name);
            });
    }
  ]);
}
/**
 * Runs all of the test cases, one by one.
 */
Runs all of the test cases, one by one.
Runs all of the test cases one by one .
function runTests() {
  chrome.test.runTests([
    function notRequestedAndNotProvidedThumbnailSuccess() {
      test_util.fileSystem.root.getFile(
          TESTING_WITH_VALID_THUMBNAIL_FILE.name,
          {create: false},
          chrome.test.callbackPass(),
          function(error) {
            chrome.test.fail(error.name);
          });
    },
    function notRequestedButProvidedThumbnailError() {
      test_util.fileSystem.root.getFile(
          TESTING_ALWAYS_WITH_THUMBNAIL_FILE.name,
          {create: false},
          function(fileEntry) {
            chrome.test.fail(
                'Thumbnail returned when not requested should result in an ' +
                'error, but the operation succeeded.');
          }, chrome.test.callbackPass(function(error) {
            chrome.test.assertEq('InvalidStateError', error.name);
          }));
    },
    function getEntryPropertiesWithThumbnailSuccess() {
      test_util.fileSystem.root.getFile(
          TESTING_WITH_VALID_THUMBNAIL_FILE.name,
          {create: false},
          chrome.test.callbackPass(function(fileEntry) {
            chrome.fileManagerPrivate.getEntryProperties(
                [fileEntry],
                ['thumbnailUrl', 'size', 'modificationTime'],
                chrome.test.callbackPass(function(fileProperties) {
                  chrome.test.assertEq(1, fileProperties.length);
                  chrome.test.assertEq(
                      TESTING_WITH_VALID_THUMBNAIL_FILE.thumbnail,
                      fileProperties[0].thumbnailUrl);
                  chrome.test.assertEq(
                      TESTING_WITH_VALID_THUMBNAIL_FILE.size,
                      fileProperties[0].size);
                  chrome.test.assertEq(
                      TESTING_WITH_VALID_THUMBNAIL_FILE.modificationTime,
                      new Date(fileProperties[0].modificationTime));
                }));
            }),
            function(error) {
              chrome.test.fail(error.name);
            });
    },
    function getEntryPropertiesWithInvalidThumbnail() {
      test_util.fileSystem.root.getFile(
          TESTING_WITH_INVALID_THUMBNAIL_FILE.name,
          {create: false},
          chrome.test.callbackPass(function(fileEntry) {
            chrome.fileManagerPrivate.getEntryProperties(
                [fileEntry],
                ['thumbnailUrl'],
                chrome.test.callbackPass(function(fileProperties) {
                  chrome.test.assertEq(1, fileProperties.length);
                  chrome.test.assertEq(
                      0, Object.keys(fileProperties[0]).length);
                }));
            }),
            function(error) {
              chrome.test.fail(error.name);
            });
    },
    function getEntryPropertiesWithoutThumbnail() {
      test_util.fileSystem.root.getFile(
          TESTING_WITH_VALID_THUMBNAIL_FILE.name,
          {create: false},
          chrome.test.callbackPass(function(fileEntry) {
            chrome.fileManagerPrivate.getEntryProperties(
                [fileEntry],
                ['size'],
                chrome.test.callbackPass(function(fileProperties) {
                  chrome.test.assertEq(1, fileProperties.length);
                  chrome.test.assertFalse(
                      'thumbnailUrl' in fileProperties[0]);
                  chrome.test.assertEq(
                      TESTING_WITH_VALID_THUMBNAIL_FILE.size,
                      fileProperties[0].size);
                }));
            }),
            function(error) {
              chrome.test.fail(error.name);
            });
    }
  ]);
}
function runTests ( ) { chrome . test . runTests ( [ function notRequestedAndNotProvidedThumbnailSuccess ( ) { test_util . fileSystem . root . getFile ( TESTING_WITH_VALID_THUMBNAIL_FILE . name , { create : false } , chrome . test . callbackPass ( ) , function ( error ) { chrome . test . fail ( error . name ) ; } ) ; } , function notRequestedButProvidedThumbnailError ( ) { test_util . fileSystem . root . getFile ( TESTING_ALWAYS_WITH_THUMBNAIL_FILE . name , { create : false } , function ( fileEntry ) { chrome . test . fail ( 'Thumbnail returned when not requested should result in an ' + 'error, but the operation succeeded.' ) ; } , chrome . test . callbackPass ( function ( error ) { chrome . test . assertEq ( 'InvalidStateError' , error . name ) ; } ) ) ; } , function getEntryPropertiesWithThumbnailSuccess ( ) { test_util . fileSystem . root . getFile ( TESTING_WITH_VALID_THUMBNAIL_FILE . name , { create : false } , chrome . test . callbackPass ( function ( fileEntry ) { chrome . fileManagerPrivate . getEntryProperties ( [ fileEntry ] , [ 'thumbnailUrl' , 'size' , 'modificationTime' ] , chrome . test . callbackPass ( function ( fileProperties ) { chrome . test . assertEq ( 1 , fileProperties . length ) ; chrome . test . assertEq ( TESTING_WITH_VALID_THUMBNAIL_FILE . thumbnail , fileProperties [ 0 ] . thumbnailUrl ) ; chrome . test . assertEq ( TESTING_WITH_VALID_THUMBNAIL_FILE . size , fileProperties [ 0 ] . size ) ; chrome . test . assertEq ( TESTING_WITH_VALID_THUMBNAIL_FILE . modificationTime , new Date ( fileProperties [ 0 ] . modificationTime ) ) ; } ) ) ; } ) , function ( error ) { chrome . test . fail ( error . name ) ; } ) ; } , function getEntryPropertiesWithInvalidThumbnail ( ) { test_util . fileSystem . root . getFile ( TESTING_WITH_INVALID_THUMBNAIL_FILE . name , { create : false } , chrome . test . callbackPass ( function ( fileEntry ) { chrome . fileManagerPrivate . getEntryProperties ( [ fileEntry ] , [ 'thumbnailUrl' ] , chrome . test . callbackPass ( function ( fileProperties ) { chrome . test . assertEq ( 1 , fileProperties . length ) ; chrome . test . assertEq ( 0 , Object . keys ( fileProperties [ 0 ] ) . length ) ; } ) ) ; } ) , function ( error ) { chrome . test . fail ( error . name ) ; } ) ; } , function getEntryPropertiesWithoutThumbnail ( ) { test_util . fileSystem . root . getFile ( TESTING_WITH_VALID_THUMBNAIL_FILE . name , { create : false } , chrome . test . callbackPass ( function ( fileEntry ) { chrome . fileManagerPrivate . getEntryProperties ( [ fileEntry ] , [ 'size' ] , chrome . test . callbackPass ( function ( fileProperties ) { chrome . test . assertEq ( 1 , fileProperties . length ) ; chrome . test . assertFalse ( 'thumbnailUrl' in fileProperties [ 0 ] ) ; chrome . test . assertEq ( TESTING_WITH_VALID_THUMBNAIL_FILE . size , fileProperties [ 0 ] . size ) ; } ) ) ; } ) , function ( error ) { chrome . test . fail ( error . name ) ; } ) ; } ] ) ; }
Runs all of the test cases, one by one.
Runs all of the test cases one by one .
// Test if providers are notified that no thumbnail is requested when normal // metadata is requested. // If providers return a thumbnail data despite not being requested for // that, then the operation must fail. // Thumbnails should be returned when available for private API request. // Confirm that extensions are not able to pass an invalid thumbnail url, // including evil urls. // The results for an entry is an empty dictionary in // case of an error. // Confirm that the thumbnail is not requested when not needed.