Closed Bug 1403486 Opened 7 years ago Closed 7 years ago

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

Categories

(Toolkit :: Places, enhancement, P1)

enhancement

Tracking

()

RESOLVED FIXED
mozilla58
Tracking Status
firefox58 --- fixed

People

(Reporter: standard8, Assigned: standard8)

References

Details

(Whiteboard: [fxsearch])

Attachments

(1 file)

As part of the ongoing conversion to the newer async APIs, I would like to land some of the changes required for bug 1094910. There's still more to do in the bookmarks/ sub-directory, but they need separate bugs / waiting on other things.
Whiteboard: [fxsearch]
Comment on attachment 8913063 [details]
Bug 1403486 - Convert some xpcshell-tests in toolkit/components/places/tests/bookmarks to Bookmarks.jsm API.

https://reviewboard.mozilla.org/r/184470/#review189718

r=me with the test_bookmarks.js changes reverted per the below comment.

::: toolkit/components/places/tests/bookmarks/test_bmindex.js:19
(Diff revision 1)
> -function check_contiguous_indexes(aBookmarks) {
>    var indexes = [];
> -  aBookmarks.forEach(function(aBookmarkId) {
> -    let bmIndex = bs.getItemIndex(aBookmarkId);
> -    dump("Index: " + bmIndex + "\n");
> +  for (let bm of bookmarks) {
> +    let bmIndex = (await PlacesUtils.bookmarks.fetch(bm.guid)).index;
> +    dump(`Index: ${bmIndex}\n`);
>      dump("Checking duplicates\n");

in general in xpcshell-tests we use do_print instead of plain dumps

::: toolkit/components/places/tests/bookmarks/test_bookmarks.js:109
(Diff revision 1)
>    do_check_eq(bs.getFolderIdForItem(bs.toolbarFolder), bs.placesRoot);
>    do_check_eq(bs.getFolderIdForItem(bs.unfiledBookmarksFolder), bs.placesRoot);
>  
>    // create a folder to hold all the tests
>    // this makes the tests more tolerant of changes to default_places.html
> -  let testRoot = bs.createFolder(root, "places bookmarks xpcshell tests",
> +  let testRoot = await bs.insert({

I'm not sure I understand the scope of this change, looks like we decided to consider this a legacy API test (and it should likely be moved to the legacy/ folder) and indeed you are not converting most of the calls here... but this one.

Though, the tests checking history result views are  something we miss for the new API... so probably this test should be split into 2, one part just checking the API should move to legacy/, the other part involving queries should move to queries/ and be converted to the new API.

For now you could even just move this to legacy unchanged, and file a separate bug for splitting out the queries checks.
Attachment #8913063 - Flags: review?(mak77) → review+
Comment on attachment 8913063 [details]
Bug 1403486 - Convert some xpcshell-tests in toolkit/components/places/tests/bookmarks to Bookmarks.jsm API.

https://reviewboard.mozilla.org/r/184470/#review189718

> I'm not sure I understand the scope of this change, looks like we decided to consider this a legacy API test (and it should likely be moved to the legacy/ folder) and indeed you are not converting most of the calls here... but this one.
> 
> Though, the tests checking history result views are  something we miss for the new API... so probably this test should be split into 2, one part just checking the API should move to legacy/, the other part involving queries should move to queries/ and be converted to the new API.
> 
> For now you could even just move this to legacy unchanged, and file a separate bug for splitting out the queries checks.

Ah yes, I forgot to revert these. I've already got bug 1403487 filed, so I think I'll just revert and do the work there.
Pushed by mbanner@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/90960f0aa023
Convert some xpcshell-tests in toolkit/components/places/tests/bookmarks to Bookmarks.jsm API. r=mak
https://hg.mozilla.org/mozilla-central/rev/90960f0aa023
Status: ASSIGNED → RESOLVED
Closed: 7 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: