toolkit/components/thumbnails/test/browser_thumbnails_bg_destroy_browser.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/toolkit/components/thumbnails/test/browser_thumbnails_bg_destroy_browser.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,29 @@
     1.4 +/* Any copyright is dedicated to the Public Domain.
     1.5 + * http://creativecommons.org/publicdomain/zero/1.0/ */
     1.6 +
     1.7 +function runTests() {
     1.8 +  let url1 = "http://example.com/1";
     1.9 +  ok(!thumbnailExists(url1), "First file should not exist yet.");
    1.10 +
    1.11 +  let url2 = "http://example.com/2";
    1.12 +  ok(!thumbnailExists(url2), "Second file should not exist yet.");
    1.13 +
    1.14 +  let defaultTimeout = BackgroundPageThumbs._destroyBrowserTimeout;
    1.15 +  BackgroundPageThumbs._destroyBrowserTimeout = 1000;
    1.16 +
    1.17 +  yield bgCapture(url1);
    1.18 +  ok(thumbnailExists(url1), "First file should exist after capture.");
    1.19 +  removeThumbnail(url1);
    1.20 +
    1.21 +  yield wait(2000);
    1.22 +  is(BackgroundPageThumbs._thumbBrowser, undefined,
    1.23 +     "Thumb browser should be destroyed after timeout.");
    1.24 +  BackgroundPageThumbs._destroyBrowserTimeout = defaultTimeout;
    1.25 +
    1.26 +  yield bgCapture(url2);
    1.27 +  ok(thumbnailExists(url2), "Second file should exist after capture.");
    1.28 +  removeThumbnail(url2);
    1.29 +
    1.30 +  isnot(BackgroundPageThumbs._thumbBrowser, undefined,
    1.31 +        "Thumb browser should exist immediately after capture.");
    1.32 +}

mercurial