30 Components.utils.import(
"resource://app/jsmodules/ArrayConverter.jsm");
31 Components.utils.import(
"resource://app/jsmodules/sbProperties.jsm");
41 var list = library.createMediaList(
"simple");
46 var item = library.createMediaItem(
newURI(
"http://foo.example.com/"));
51 item = library.createMediaItem(
newURI(
"http://foo.example.com/"),
56 item = library.createMediaItem(
newURI(
"http://foo.example.com/"),
63 library.createMediaItemIfNotExist(
newURI(
"http://foo.example.com/"),
70 var urls = ArrayConverter.nsIArray([
newURI(
"http://foo.example.com/")]);
71 var items = library.batchCreateMediaItems(urls);
72 testItem(items.queryElementAt(0, Components.interfaces.nsISupports),
"audio");
76 items = library.batchCreateMediaItems(urls, props);
77 testItem(items.queryElementAt(0, Components.interfaces.nsISupports),
"moof");
81 onProgress:
function(){},
84 "batch create async returned failure code");
87 "missing or extra items via batch create async");
88 testItem(aItems.queryElementAt(0, Components.interfaces.nsISupports),
93 library.batchCreateMediaItemsAsync(listenerOne, urls);
98 onProgress:
function(){},
100 log(
"Second listener complete");
102 "batch create async returned failure code");
105 "missing or extra items via batch create async");
106 testItem(aItems.queryElementAt(0, Components.interfaces.nsISupports),
112 library.batchCreateMediaItemsAsync(listenerTwo, urls, props);
116 }
catch(e) { dump(e.stack +
"\n");
throw(e); }
121 function () aItem.getProperty(SBProperties.contentType));
122 if (aItem.library == aItem &&
null === aContentType) {
125 "library content type is \"" + contentType +
"\" instead of null");
128 assertEqual(aContentType, contentType,
"contentType not set on created item");
130 aItem.setProperty(SBProperties.contentType,
null);
131 assertEqual(
null, contentType,
"contentType not cleared on explicit setting");
135 var props =
Cc[
"@songbirdnest.com/Songbird/Properties/MutablePropertyArray;1"]
136 .createInstance(
Ci.sbIMutablePropertyArray);
137 props.appendProperty(SBProperties.contentType, aContentType);
function makeProperties(aContentType)
function assertTrue(aTest, aMessage)
function assertEqual(aExpected, aActual, aMessage)
function runTest()
Advanced DataRemote unit tests.
function createLibrary(databaseGuid, databaseLocation)
function newURI(aURLString)
function testItem(aItem, aContentType)
__defineGetter__("Application", function(){delete this.Application;return this.Application=Cc["@mozilla.org/fuel/application;1"].getService(Ci.fuelIApplication);})