mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
76ac38c278
r=dietrich
88 lines
2.8 KiB
XML
88 lines
2.8 KiB
XML
<?xml version="1.0"?>
|
|
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
|
<?xml-stylesheet
|
|
href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
|
|
<window title="Update Livemark SiteURI"
|
|
xmlns:html="http://www.w3.org/1999/xhtml"
|
|
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
|
onload="runTest()">
|
|
<script type="application/javascript"
|
|
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
|
|
|
<body xmlns="http://www.w3.org/1999/xhtml" />
|
|
|
|
<script type="application/javascript">
|
|
<![CDATA[
|
|
/*
|
|
Test updating livemark siteURI to the value from the feed
|
|
*/
|
|
SimpleTest.waitForExplicitFinish();
|
|
|
|
const Cc = Components.classes;
|
|
const Ci = Components.interfaces;
|
|
const Cr = Components.results;
|
|
|
|
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
|
|
Components.utils.import("resource://gre/modules/NetUtil.jsm");
|
|
Components.utils.import("resource://gre/modules/PlacesUtils.jsm");
|
|
|
|
function runTest() {
|
|
const FEEDSPEC = "http://mochi.test:8888/tests/toolkit/components/places/tests/chrome/sample_feed.atom";
|
|
const INITIALSITESPEC = "http://mochi.test:8888/";
|
|
const FEEDSITESPEC = "http://example.org/";
|
|
|
|
PlacesUtils.livemarks.addLivemark(
|
|
{ title: "foo"
|
|
, parentId: PlacesUtils.toolbarFolderId
|
|
, index: PlacesUtils.bookmarks.DEFAULT_INDEX
|
|
, feedURI: NetUtil.newURI(FEEDSPEC)
|
|
, siteURI: NetUtil.newURI(INITIALSITESPEC)
|
|
},
|
|
function (aStatus, aLivemark) {
|
|
ok(Components.isSuccessCode(aStatus), "Get livemark");
|
|
is(aLivemark.siteURI.spec, INITIALSITESPEC,
|
|
"Has correct initial livemark site URI");
|
|
|
|
waitForLivemarkLoad(aLivemark, function (aLivemark) {
|
|
is(aLivemark.siteURI.spec, FEEDSITESPEC,
|
|
"livemark site URI set to value in feed");
|
|
|
|
PlacesUtils.bookmarks.removeItem(aLivemark.id);
|
|
SimpleTest.finish();
|
|
});
|
|
}
|
|
);
|
|
}
|
|
|
|
function waitForLivemarkLoad(aLivemark, aCallback) {
|
|
// Don't need a real node here.
|
|
let node = {};
|
|
let resultObserver = {
|
|
nodeInserted: function() {},
|
|
nodeRemoved: function() {},
|
|
nodeAnnotationChanged: function() {},
|
|
nodeTitleChanged: function() {},
|
|
nodeHistoryDetailsChanged: function() {},
|
|
nodeReplaced: function() {},
|
|
nodeMoved: function() {},
|
|
ontainerStateChanged: function () {},
|
|
sortingChanged: function() {},
|
|
batching: function() {},
|
|
invalidateContainer: function(node) {
|
|
isnot(aLivemark.status, Ci.mozILivemark.STATUS_FAILED,
|
|
"Loading livemark should success");
|
|
if (aLivemark.status == Ci.mozILivemark.STATUS_READY) {
|
|
aLivemark.unregisterForUpdates(node, resultObserver);
|
|
aCallback(aLivemark);
|
|
}
|
|
}
|
|
};
|
|
aLivemark.registerForUpdates(node, resultObserver);
|
|
aLivemark.reload();
|
|
}
|
|
|
|
]]>
|
|
</script>
|
|
|
|
</window>
|