Bug 886054 - Intermittent test_bookmarks_json.js | Test timed out. r=mak

This commit is contained in:
Raymond Lee 2014-01-28 17:26:14 -05:00
parent ed28ea600e
commit df39948ef0
2 changed files with 33 additions and 61 deletions

View File

@ -330,31 +330,21 @@ function checkItem(aExpected, aNode)
aExpected.lastModified);
break;
case "url":
yield function() {
let deferred = Promise.defer();
PlacesUtils.livemarks.getLivemark(
{ id: id },
function (aStatus, aLivemark) {
if (!Components.isSuccessCode(aStatus)) {
do_check_eq(aNode.uri, aExpected.url);
}
deferred.resolve();
}
);
return deferred.promise; }();
if (!("feedUrl" in aExpected))
do_check_eq(aNode.uri, aExpected.url)
break;
case "icon":
yield function() {
let deferred = Promise.defer();
let (deferred = Promise.defer(), data) {
PlacesUtils.favicons.getFaviconDataForPage(
NetUtil.newURI(aExpected.url),
function (aURI, aDataLen, aData, aMimeType) {
let base64Icon = "data:image/png;base64," +
base64EncodeString(String.fromCharCode.apply(String, aData));
do_check_true(base64Icon == aExpected.icon);
deferred.resolve();
});
return deferred.promise; }();
deferred.resolve(aData);
});
data = yield deferred.promise;
let base64Icon = "data:image/png;base64," +
base64EncodeString(String.fromCharCode.apply(String, data));
do_check_true(base64Icon == aExpected.icon);
}
break;
case "keyword":
break;
@ -373,18 +363,13 @@ function checkItem(aExpected, aNode)
do_check_eq((yield PlacesUtils.getCharsetForURI(testURI)), aExpected.charset);
break;
case "feedUrl":
yield function() {
let deferred = Promise.defer();
PlacesUtils.livemarks.getLivemark(
{ id: id },
function (aStatus, aLivemark) {
do_check_true(Components.isSuccessCode(aStatus));
do_check_eq(aLivemark.siteURI.spec, aExpected.url);
do_check_eq(aLivemark.feedURI.spec, aExpected.feedUrl);
deferred.resolve();
}
);
return deferred.promise; }();
yield PlacesUtils.livemarks.getLivemark(
{ id: id },
(aStatus, aLivemark) => {
do_check_true(Components.isSuccessCode(aStatus));
do_check_eq(aLivemark.siteURI.spec, aExpected.url);
do_check_eq(aLivemark.feedURI.spec, aExpected.feedUrl);
});
break;
case "children":
let folder = aNode.QueryInterface(Ci.nsINavHistoryContainerResultNode);

View File

@ -161,30 +161,21 @@ function checkItem(aExpected, aNode) {
aExpected.lastModified);
break;
case "url":
yield function() {
let deferred = Promise.defer();
PlacesUtils.livemarks.getLivemark(
{ id: id },
function (aStatus, aLivemark) {
if (!Components.isSuccessCode(aStatus)) {
do_check_eq(aNode.uri, aExpected.url);
}
deferred.resolve();
});
return deferred.promise; }();
if (!("feedUrl" in aExpected))
do_check_eq(aNode.uri, aExpected.url);
break;
case "icon":
yield function() {
let deferred = Promise.defer();
let (deferred = Promise.defer(), data) {
PlacesUtils.favicons.getFaviconDataForPage(
NetUtil.newURI(aExpected.url),
function (aURI, aDataLen, aData, aMimeType) {
let base64Icon = "data:image/png;base64," +
base64EncodeString(String.fromCharCode.apply(String, aData));
do_check_true(base64Icon == aExpected.icon);
deferred.resolve();
deferred.resolve(aData);
});
return deferred.promise; }();
data = yield deferred.promise;
let base64Icon = "data:image/png;base64," +
base64EncodeString(String.fromCharCode.apply(String, data));
do_check_true(base64Icon == aExpected.icon);
}
break;
case "keyword":
break;
@ -201,17 +192,13 @@ function checkItem(aExpected, aNode) {
do_check_eq((yield PlacesUtils.getCharsetForURI(testURI)), aExpected.charset);
break;
case "feedUrl":
yield function() {
let deferred = Promise.defer();
PlacesUtils.livemarks.getLivemark(
{ id: id },
function (aStatus, aLivemark) {
do_check_true(Components.isSuccessCode(aStatus));
do_check_eq(aLivemark.siteURI.spec, aExpected.url);
do_check_eq(aLivemark.feedURI.spec, aExpected.feedUrl);
deferred.resolve();
});
return deferred.promise; }();
yield PlacesUtils.livemarks.getLivemark(
{ id: id },
(aStatus, aLivemark) => {
do_check_true(Components.isSuccessCode(aStatus));
do_check_eq(aLivemark.siteURI.spec, aExpected.url);
do_check_eq(aLivemark.feedURI.spec, aExpected.feedUrl);
});
break;
case "children":
let folder = aNode.QueryInterface(Ci.nsINavHistoryContainerResultNode);