summaryrefslogtreecommitdiffstats
path: root/toolkit/components/places/tests/unit/test_asyncExecuteLegacyQueries.js
diff options
context:
space:
mode:
authorMatt A. Tobin <email@mattatobin.com>2020-02-25 15:07:00 -0500
committerwolfbeast <mcwerewolf@wolfbeast.com>2020-04-14 12:55:19 +0200
commiteb70e6e3d0bff11c25f14b1196025791bf2308fb (patch)
tree5ef4ce17db83c74d7b05ec12c8f59e095a6dd5bd /toolkit/components/places/tests/unit/test_asyncExecuteLegacyQueries.js
parent32ead795290b3399d56b4708fc75b77d296f6a1a (diff)
downloadUXP-eb70e6e3d0bff11c25f14b1196025791bf2308fb.tar
UXP-eb70e6e3d0bff11c25f14b1196025791bf2308fb.tar.gz
UXP-eb70e6e3d0bff11c25f14b1196025791bf2308fb.tar.lz
UXP-eb70e6e3d0bff11c25f14b1196025791bf2308fb.tar.xz
UXP-eb70e6e3d0bff11c25f14b1196025791bf2308fb.zip
Issue #439 - Remove tests from toolkit/
Diffstat (limited to 'toolkit/components/places/tests/unit/test_asyncExecuteLegacyQueries.js')
-rw-r--r--toolkit/components/places/tests/unit/test_asyncExecuteLegacyQueries.js95
1 files changed, 0 insertions, 95 deletions
diff --git a/toolkit/components/places/tests/unit/test_asyncExecuteLegacyQueries.js b/toolkit/components/places/tests/unit/test_asyncExecuteLegacyQueries.js
deleted file mode 100644
index 7296fe061..000000000
--- a/toolkit/components/places/tests/unit/test_asyncExecuteLegacyQueries.js
+++ /dev/null
@@ -1,95 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-
-// This is a test for asyncExecuteLegacyQueries API.
-
-var tests = [
-
-function test_history_query() {
- let uri = NetUtil.newURI("http://test.visit.mozilla.com/");
- let title = "Test visit";
- PlacesTestUtils.addVisits({ uri: uri, title: title }).then(function () {
- let options = PlacesUtils.history.getNewQueryOptions();
- options.sortingMode = Ci.nsINavHistoryQueryOptions.SORT_BY_DATE_DESCENDING;
- let query = PlacesUtils.history.getNewQuery();
-
- PlacesUtils.history.QueryInterface(Ci.nsPIPlacesDatabase)
- .asyncExecuteLegacyQueries([query], 1, options, {
- handleResult: function (aResultSet) {
- for (let row; (row = aResultSet.getNextRow());) {
- try {
- do_check_eq(row.getResultByIndex(1), uri.spec);
- do_check_eq(row.getResultByIndex(2), title);
- } catch (e) {
- do_throw("Error while fetching page data.");
- }
- }
- },
- handleError: function (aError) {
- do_throw("Async execution error (" + aError.result + "): " + aError.message);
- },
- handleCompletion: function (aReason) {
- run_next_test();
- },
- });
- });
-},
-
-function test_bookmarks_query() {
- let uri = NetUtil.newURI("http://test.bookmark.mozilla.com/");
- let title = "Test bookmark";
- bookmark(uri, title);
- let options = PlacesUtils.history.getNewQueryOptions();
- options.sortingMode = Ci.nsINavHistoryQueryOptions.SORT_BY_LASMODIFIED_DESCENDING;
- options.queryType = options.QUERY_TYPE_BOOKMARKS;
- let query = PlacesUtils.history.getNewQuery();
-
- PlacesUtils.history.QueryInterface(Ci.nsPIPlacesDatabase)
- .asyncExecuteLegacyQueries([query], 1, options, {
- handleResult: function (aResultSet) {
- for (let row; (row = aResultSet.getNextRow());) {
- try {
- do_check_eq(row.getResultByIndex(1), uri.spec);
- do_check_eq(row.getResultByIndex(2), title);
- } catch (e) {
- do_throw("Error while fetching page data.");
- }
- }
- },
- handleError: function (aError) {
- do_throw("Async execution error (" + aError.result + "): " + aError.message);
- },
- handleCompletion: function (aReason) {
- run_next_test();
- },
- });
-},
-
-];
-
-function bookmark(aURI, aTitle)
-{
- PlacesUtils.bookmarks.insertBookmark(PlacesUtils.unfiledBookmarksFolderId,
- aURI,
- PlacesUtils.bookmarks.DEFAULT_INDEX,
- aTitle);
-}
-
-function run_test()
-{
- do_test_pending();
- run_next_test();
-}
-
-function run_next_test() {
- if (tests.length == 0) {
- do_test_finished();
- return;
- }
-
- Promise.all([
- PlacesTestUtils.clearHistory(),
- PlacesUtils.bookmarks.eraseEverything()
- ]).then(tests.shift());
-}