зеркало из https://github.com/mozilla/pjs.git
Re-enabling tests for bug 398914 (r=sspitzer)
This commit is contained in:
Родитель
cdff8a91a7
Коммит
ddb050e933
|
@ -48,8 +48,6 @@ const testFolderId = PlacesUtils.bookmarksMenuFolderId;
|
|||
|
||||
// main
|
||||
function run_test() {
|
||||
return;
|
||||
|
||||
var testURI = uri("http://foo.com");
|
||||
|
||||
/*
|
||||
|
@ -90,6 +88,15 @@ function run_test() {
|
|||
bmsvc.setKeywordForBookmark(bm2, "foo");
|
||||
PlacesUtils.setPostDataForBookmark(bm2, "pdata2");
|
||||
|
||||
var bm1da = bmsvc.getItemDateAdded(bm1);
|
||||
var bm1lm = bmsvc.getItemLastModified(bm1);
|
||||
LOG("bm1 dateAdded: " + bm1da + ", lastModified: " + bm1lm);
|
||||
var bm2da = bmsvc.getItemDateAdded(bm2);
|
||||
var bm2lm = bmsvc.getItemLastModified(bm2);
|
||||
LOG("bm2 dateAdded: " + bm2da + ", lastModified: " + bm2lm);
|
||||
do_check_true(bm1da <= bm2da);
|
||||
do_check_true(bm1lm <= bm2lm);
|
||||
|
||||
[url, postdata] = PlacesUtils.getURLAndPostDataForKeyword("foo");
|
||||
do_check_eq(testURI.spec, url);
|
||||
do_check_eq(postdata, "pdata2");
|
||||
|
@ -120,4 +127,42 @@ function run_test() {
|
|||
// cleanup
|
||||
bmsvc.removeItem(bm1);
|
||||
bmsvc.removeItem(bm2);
|
||||
|
||||
/*
|
||||
Test that id breaks ties:
|
||||
1. Create two bookmarks with the same URI and keyword, dateAdded and lastModified.
|
||||
2. Confirm that the most recently created one is returned for that keyword.
|
||||
*/
|
||||
var testDate = Date.now() * 1000;
|
||||
var bm1 = bmsvc.insertBookmark(testFolderId, testURI, -1, "blah");
|
||||
bmsvc.setKeywordForBookmark(bm1, "foo");
|
||||
PlacesUtils.setPostDataForBookmark(bm1, "pdata1");
|
||||
bmsvc.setItemDateAdded(bm1, testDate);
|
||||
bmsvc.setItemLastModified(bm1, testDate);
|
||||
|
||||
var bm2 = bmsvc.insertBookmark(testFolderId, testURI, -1, "blah");
|
||||
bmsvc.setKeywordForBookmark(bm2, "foo");
|
||||
PlacesUtils.setPostDataForBookmark(bm2, "pdata2");
|
||||
bmsvc.setItemDateAdded(bm2, testDate);
|
||||
bmsvc.setItemLastModified(bm2, testDate);
|
||||
|
||||
var bm1da = bmsvc.getItemDateAdded(bm1, testDate);
|
||||
var bm1lm = bmsvc.getItemLastModified(bm1);
|
||||
LOG("bm1 dateAdded: " + bm1da + ", lastModified: " + bm1lm);
|
||||
var bm2da = bmsvc.getItemDateAdded(bm2);
|
||||
var bm2lm = bmsvc.getItemLastModified(bm2);
|
||||
LOG("bm2 dateAdded: " + bm2da + ", lastModified: " + bm2lm);
|
||||
do_check_true(bm1da <= bm2da);
|
||||
do_check_true(bm1lm <= bm2lm);
|
||||
|
||||
var ids = bmsvc.getBookmarkIdsForURI(testURI, {});
|
||||
do_check_eq(ids[0], bm2);
|
||||
|
||||
[url, postdata] = PlacesUtils.getURLAndPostDataForKeyword("foo");
|
||||
do_check_eq(testURI.spec, url);
|
||||
do_check_eq(postdata, "pdata2");
|
||||
|
||||
// cleanup
|
||||
bmsvc.removeItem(bm1);
|
||||
bmsvc.removeItem(bm2);
|
||||
}
|
||||
|
|
|
@ -145,7 +145,7 @@ nsNavBookmarks::Init()
|
|||
"SELECT a.id "
|
||||
"FROM moz_bookmarks a, moz_places h "
|
||||
"WHERE h.url = ?1 AND a.fk = h.id and a.type = ?2 "
|
||||
"ORDER BY MAX(COALESCE(a.lastModified, 0), a.dateAdded) DESC"),
|
||||
"ORDER BY MAX(COALESCE(a.lastModified, 0), a.dateAdded) DESC, a.id DESC"),
|
||||
getter_AddRefs(mDBFindURIBookmarks));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче