Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
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 });