toolkit/components/places/tests/favicons/test_getFaviconURLForPage.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 /**
     5  * This file tests getFaviconURLForPage.
     6  */
     8 ////////////////////////////////////////////////////////////////////////////////
     9 /// Tests
    11 function run_test()
    12 {
    13   run_next_test();
    14 }
    16 add_test(function test_normal()
    17 {
    18   let pageURI = NetUtil.newURI("http://example.com/normal");
    20   promiseAddVisits(pageURI).then(function () {
    21     PlacesUtils.favicons.setAndFetchFaviconForPage(
    22       pageURI, SMALLPNG_DATA_URI, true,
    23         PlacesUtils.favicons.FAVICON_LOAD_NON_PRIVATE,
    24         function () {
    25         PlacesUtils.favicons.getFaviconURLForPage(pageURI,
    26           function (aURI, aDataLen, aData, aMimeType) {
    27             do_check_true(aURI.equals(SMALLPNG_DATA_URI));
    29             // Check also the expected data types.
    30             do_check_true(aDataLen === 0);
    31             do_check_true(aData.length === 0);
    32             do_check_true(aMimeType === "");
    33             run_next_test();
    34           });
    35       });
    36   });
    37 });
    39 add_test(function test_missing()
    40 {
    41   let pageURI = NetUtil.newURI("http://example.com/missing");
    43   PlacesUtils.favicons.getFaviconURLForPage(pageURI,
    44     function (aURI, aDataLen, aData, aMimeType) {
    45       // Check also the expected data types.
    46       do_check_true(aURI === null);
    47       do_check_true(aDataLen === 0);
    48       do_check_true(aData.length === 0);
    49       do_check_true(aMimeType === "");
    50       run_next_test();
    51     });
    52 });

mercurial