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 // Tests a zero frecency is correctly updated when inserting new valid visits.
6 function run_test()
7 {
8 run_next_test()
9 }
11 add_task(function ()
12 {
13 const TEST_URI = NetUtil.newURI("http://example.com/");
14 let id = PlacesUtils.bookmarks.insertBookmark(PlacesUtils.unfiledBookmarksFolderId,
15 TEST_URI,
16 PlacesUtils.bookmarks.DEFAULT_INDEX,
17 "A title");
18 yield promiseAsyncUpdates();
19 do_check_true(frecencyForUrl(TEST_URI) > 0);
21 // Removing the bookmark should leave an orphan page with zero frecency.
22 // Note this would usually be expired later by expiration.
23 PlacesUtils.bookmarks.removeItem(id);
24 yield promiseAsyncUpdates();
25 do_check_eq(frecencyForUrl(TEST_URI), 0);
27 // Now add a valid visit to the page, frecency should increase.
28 yield promiseAddVisits({ uri: TEST_URI });
29 do_check_true(frecencyForUrl(TEST_URI) > 0);
30 });