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