toolkit/components/thumbnails/test/browser_thumbnails_bg_queueing.js

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

     1 /* Any copyright is dedicated to the Public Domain.
     2  * http://creativecommons.org/publicdomain/zero/1.0/ */
     4 function runTests() {
     5   let urls = [
     6     "http://www.example.com/0",
     7     "http://www.example.com/1",
     8     // an item that will timeout to ensure timeouts work and we resume.
     9     bgTestPageURL({ wait: 2002 }),
    10     "http://www.example.com/2",
    11   ];
    12   dontExpireThumbnailURLs(urls);
    13   urls.forEach(url => {
    14     ok(!thumbnailExists(url), "Thumbnail should not exist yet: " + url);
    15     let isTimeoutTest = url.indexOf("wait") >= 0;
    16     BackgroundPageThumbs.capture(url, {
    17       timeout: isTimeoutTest ? 100 : 30000,
    18       onDone: function onDone(capturedURL) {
    19         ok(urls.length > 0, "onDone called, so URLs should still remain");
    20         is(capturedURL, urls.shift(),
    21            "Captured URL should be currently expected URL (i.e., " +
    22            "capture() callbacks should be called in the correct order)");
    23         if (isTimeoutTest) {
    24           ok(!thumbnailExists(capturedURL),
    25              "Thumbnail shouldn't exist for timed out capture");
    26         } else {
    27           ok(thumbnailExists(capturedURL),
    28              "Thumbnail should be cached after capture");
    29           removeThumbnail(url);
    30         }
    31         if (!urls.length)
    32           // Test done.
    33           next();
    34       },
    35     });
    36   });
    37   yield true;
    38 }

mercurial