B2G/gecko/browser/components/thumbnails/test/browser_thumbnails_storage.js
/**
 * These tests ensure that the thumbnail storage is working as intended.
 * Newly captured thumbnails should be saved as files and they should as well
 * be removed when the user sanitizes their history.
 */
These tests ensure that the thumbnail storage is working as intended.
Newly captured thumbnails should be saved as files and they should as well
be removed when the user sanitizes their history.
These tests ensure that the thumbnail storage is working as intended . Newly captured thumbnails should be saved as files and they should as well be removed when the user sanitizes their history .
function runTests() {
  yield clearHistory();
  yield createThumbnail();
  PageThumbsStorage.copy(URL, URL_COPY);
  let copy = PageThumbsStorage.getFileForURL(URL_COPY);
  let mtime = copy.lastModifiedTime -= 60;
  PageThumbsStorage.copy(URL, URL_COPY);
  isnot(PageThumbsStorage.getFileForURL(URL_COPY).lastModifiedTime, mtime,
        "thumbnail file was updated");
  let file = PageThumbsStorage.getFileForURL(URL);
  let fileCopy = PageThumbsStorage.getFileForURL(URL_COPY);
  while (file.exists() || fileCopy.exists()) {
    yield clearHistory();
  }
  yield createThumbnail();
  yield clearHistory(true);
  while (file.exists()) {
    let time = Date.now() * 1000;
    let trans = Ci.nsINavHistoryService.TRANSITION_LINK;
    PlacesUtils.history.addVisit(makeURI(URL), time, null, trans, false, 0);
    yield clearHistory(true);
  }
}
function runTests ( ) { yield clearHistory ( ) ; yield createThumbnail ( ) ; PageThumbsStorage . copy ( URL , URL_COPY ) ; let copy = PageThumbsStorage . getFileForURL ( URL_COPY ) ; let mtime = copy . lastModifiedTime -= 60 ; PageThumbsStorage . copy ( URL , URL_COPY ) ; isnot ( PageThumbsStorage . getFileForURL ( URL_COPY ) . lastModifiedTime , mtime , "thumbnail file was updated" ) ; let file = PageThumbsStorage . getFileForURL ( URL ) ; let fileCopy = PageThumbsStorage . getFileForURL ( URL_COPY ) ; while ( file . exists ( ) || fileCopy . exists ( ) ) { yield clearHistory ( ) ; } yield createThumbnail ( ) ; yield clearHistory ( true ) ; while ( file . exists ( ) ) { let time = Date . now ( ) * 1000 ; let trans = Ci . nsINavHistoryService . TRANSITION_LINK ; PlacesUtils . history . addVisit ( makeURI ( URL ) , time , null , trans , false , 0 ) ; yield clearHistory ( true ) ; } }
These tests ensure that the thumbnail storage is working as intended.
These tests ensure that the thumbnail storage is working as intended .
// Make sure Storage.copy() updates an existing file. // Clear the browser history. Retry until the files are gone because Windows // locks them sometimes. // Clear the last 10 minutes of browsing history. // Retry until the file is gone because Windows locks it sometimes. // Re-add our URL to the history so that history observer's onDeleteURI() // is called again. // Try again...