Closed Bug 1094903 Opened 11 years ago Closed 8 years ago

Convert xpcshell-tests in toolkit/components/places/tests/unit to Bookmarks.jsm API

Categories

(Toolkit :: Places, defect, P2)

defect
Points:
13

Tracking

()

RESOLVED FIXED
mozilla58
Tracking Status
firefox58 --- fixed

People

(Reporter: mak, Assigned: standard8)

References

Details

Attachments

(1 file, 1 obsolete file)

This is A LOT of tests. We should also avoding to convert tests that are duped by the new API tests.
Flags: qe-verify-
Flags: firefox-backlog+
Priority: -- → P2
search dxr with `nsINavBookmarksService`, the effected files are toolkit/components/places/tests/bookmarks/test_384228.js toolkit/components/places/tests/bookmarks/test_385829.js toolkit/components/places/tests/bookmarks/test_388695.js toolkit/components/places/tests/bookmarks/test_395101.js toolkit/components/places/tests/bookmarks/test_395593.js toolkit/components/places/tests/bookmarks/test_bmindex.js toolkit/components/places/tests/bookmarks/test_changeBookmarkURI.js
Do the WIP of quick bookmarks and history api replacement, will check if there's a dup by the new API tests or new syntax.
Comment on attachment 8748473 [details] MozReview Request: Bug 1094903 - Convert xpcshell-tests in toolkit/components/places/tests/unit to Bookmarks.jsm API; Review request updated; see interdiff: https://reviewboard.mozilla.org/r/50311/diff/1-2/
Assignee: nobody → gasolin
Comment on attachment 8748473 [details] MozReview Request: Bug 1094903 - Convert xpcshell-tests in toolkit/components/places/tests/unit to Bookmarks.jsm API; The patch did: 1. convert nsiBookmark & nsiHistory to PlaceUtils 2. wrap tests in add_task 3. replace do_assert_eq with Assert.equal and similar syntax Would like to do: 1. rename test_xxxxx to more meaningful name (ex test_384228.js to test_search_bookmark_in_folder.js, which is used in new add_task function name) Can do in separate patch: 2. convert `bm.insertBookmark` to `yield bm.insert` syntax The problem I found is I can't get guid from bookmarks.createFolder. Should I change all createFolder to use `yield bm.insert` syntax as well? https://dxr.mozilla.org/mozilla-central/source/browser/components/places/tests/browser/browser_0_library_left_pane_migration.js#40
Attachment #8748473 - Flags: feedback?(mak77)
(In reply to Fred Lin [:gasolin] from comment #5) > The problem I found is I can't get guid from bookmarks.createFolder. Should > I change all createFolder to use `yield bm.insert` syntax as well? absolutely, createFolder is part of the old API. Anything in nsINavBookmarksService should be converted.
Note that I think you are making confusion between this bug and bug 1094910. The patch you posted here looks for bug 1094910, not this one.
https://reviewboard.mozilla.org/r/50311/#review47725 ::: toolkit/components/places/tests/bookmarks/test_384228.js:36 (Diff revision 2) > - var b3 = bmsvc.insertBookmark(testFolder2, uri("http://foo.tld/"), > - bmsvc.DEFAULT_INDEX, "title b3 (folder 2)"); > - do_check_eq(bmsvc.getItemIndex(b3), 0); > - var b4 = bmsvc.insertBookmark(testFolder3, uri("http://foo.tld/"), > - bmsvc.DEFAULT_INDEX, "title b4 (folder 3)"); > - do_check_eq(bmsvc.getItemIndex(b4), 0); > + var b3 = bm.insertBookmark(testFolder2, uri("http://foo.tld/"), > + bm.DEFAULT_INDEX, "title b3 (folder 2)"); > + Assert.equal(bm.getItemIndex(b3), 0); > + var b4 = bm.insertBookmark(testFolder3, uri("http://foo.tld/"), > + bm.DEFAULT_INDEX, "title b4 (folder 3)"); > + Assert.equal(bm.getItemIndex(b4), 0); OK I think there's a bit of confusion of what should be done in these bugs. It is not enough to move from nsINavBookmarksService to PlacesUtils.bookmarks, we are completely changing the bookmarking API. The following methods/properties must be replaced with their async counter-part (that is in Bookmarks.jsm and accessibile from PlacesUtils.bookmarks). Everywhere one of these appers, the test should be changed to instead use the Bookmarks.jsm async API. placesRoot bookmarksMenuFolder; tagsFolder unfiledBookmarksFolder; toolbarFolder; insertBookmark removeItem createFolder removeFolderChildren moveItem insertSeparator getIdForItemAt setItemTitle getItemTitle setItemDateAdded getItemDateAdded setItemLastModified getItemLastModified getBookmarkURI getItemIndex setItemIndex getItemType isBookmarked getBookmarkedURIFor changeBookmarkURI getBookmarkIdsForURI runInBatchMode;
Attachment #8748473 - Flags: feedback?(mak77)
thanks for feedback, will try bug 1094910 first
Assignee: gasolin → nobody
Attachment #8748473 - Attachment is obsolete: true
I'm going to take a stab at this over the weekend.
Assignee: nobody → standard8
Depends on: 1376232
Depends on: 1376234
Depends on: 1379630
Comment on attachment 8912388 [details] Bug 1094903 - Convert xpcshell-tests in toolkit/components/places/tests/unit to Bookmarks.jsm (async) API. https://reviewboard.mozilla.org/r/183712/#review189104 ::: toolkit/components/places/tests/legacy/xpcshell.ini:7 (Diff revision 1) > +# until we remove the APIs themselves. > + > +[DEFAULT] > +head = head_legacy.js > +firefox-appdir = browser > +skip-if = toolkit == 'android' we should not really need this, since android should not define MOZ_PLACES and thus it won't even build Places. ::: toolkit/components/places/tests/unit/test_autocomplete_stopSearch_no_throw.js:21 (Diff revision 1) > try { > ac.stopSearch(); > } catch (e) { > do_throw("we should not have caught anything!"); > } > -} > +}); Looks like this test should be moved to the unifiedcomplete/ folder
Attachment #8912388 - Flags: review?(mak77) → review+
Blocks: 1403502
Comment on attachment 8912388 [details] Bug 1094903 - Convert xpcshell-tests in toolkit/components/places/tests/unit to Bookmarks.jsm (async) API. https://reviewboard.mozilla.org/r/183712/#review189104 > Looks like this test should be moved to the unifiedcomplete/ folder I split this out to bug 1403502.
Pushed by mbanner@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/e81bc5a17a4f Convert xpcshell-tests in toolkit/components/places/tests/unit to Bookmarks.jsm (async) API. r=mak
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla58
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: