function retainDirectory() {
  return new Promise(function(fulfill) {
    chrome.app.window.create('window.html', fulfill);
  }).then(function(appWindow) {
    return new Promise(function(fulfill, rejected) {
      appWindow.contentWindow.chrome.fileSystem.chooseEntry(
          {type: "openDirectory"},
          fulfill);
    });
  }).then(function(selected) {
    chrome.test.assertTrue(selected.isDirectory);
    var id = chrome.fileSystem.retainEntry(selected);
    chrome.test.assertTrue(!!id);
    return new Promise(function(fulfill, rejected) {
      chrome.fileSystem.isRestorable(id, fulfill);
    }).then(function(restorable) {
      chrome.test.assertTrue(restorable);
      return new Promise(function(fulfill, rejected) {
        chrome.storage.local.set({id: id}, fulfill);
      });
    });
  }).then(function() {
    chrome.runtime.reload();
  });
}
/**
 * Retains a test directory.
 * @return {Promise} Promise fulflled/rejected depending on the test result.
 */
Retains a test directory.
@return {Promise} Promise fulflled/rejected depending on the test result.
Retains a test directory . @return { Promise } Promise fulflled / rejected depending on the test result .
function retainDirectory() {
  return new Promise(function(fulfill) {
    chrome.app.window.create('window.html', fulfill);
  }).then(function(appWindow) {
    return new Promise(function(fulfill, rejected) {
      appWindow.contentWindow.chrome.fileSystem.chooseEntry(
          {type: "openDirectory"},
          fulfill);
    });
  }).then(function(selected) {
    chrome.test.assertTrue(selected.isDirectory);
    var id = chrome.fileSystem.retainEntry(selected);
    chrome.test.assertTrue(!!id);
    return new Promise(function(fulfill, rejected) {
      chrome.fileSystem.isRestorable(id, fulfill);
    }).then(function(restorable) {
      chrome.test.assertTrue(restorable);
      return new Promise(function(fulfill, rejected) {
        chrome.storage.local.set({id: id}, fulfill);
      });
    });
  }).then(function() {
    chrome.runtime.reload();
  });
}
function retainDirectory ( ) { return new Promise ( function ( fulfill ) { chrome . app . window . create ( 'window.html' , fulfill ) ; } ) . then ( function ( appWindow ) { return new Promise ( function ( fulfill , rejected ) { appWindow . contentWindow . chrome . fileSystem . chooseEntry ( { type : "openDirectory" } , fulfill ) ; } ) ; } ) . then ( function ( selected ) { chrome . test . assertTrue ( selected . isDirectory ) ; var id = chrome . fileSystem . retainEntry ( selected ) ; chrome . test . assertTrue ( ! ! id ) ; return new Promise ( function ( fulfill , rejected ) { chrome . fileSystem . isRestorable ( id , fulfill ) ; } ) . then ( function ( restorable ) { chrome . test . assertTrue ( restorable ) ; return new Promise ( function ( fulfill , rejected ) { chrome . storage . local . set ( { id : id } , fulfill ) ; } ) ; } ) ; } ) . then ( function ( ) { chrome . runtime . reload ( ) ; } ) ; }
Retains a test directory.
Retains a test directory .