33 var
SB_NS =
"http://songbirdnest.com/data/1.0#";
34 var
ios =
Cc[
"@mozilla.org/network/io-service;1"].getService(
Ci.nsIIOService);
36 var databaseGUID =
"test_batchcreateasync";
39 var toAdd =
Cc[
"@songbirdnest.com/moz/xpcom/threadsafe-array;1"].createInstance(
Ci.nsIMutableArray);
40 var propertyArray =
Cc[
"@songbirdnest.com/moz/xpcom/threadsafe-array;1"].createInstance(
Ci.nsIMutableArray);
41 for (var
i = 0;
i < 100;
i++) {
42 toAdd.appendElement(
newURI(
"file:///foo/" +
i +
".mp3"),
false);
43 var props =
Cc[
"@songbirdnest.com/Songbird/Properties/MutablePropertyArray;1"]
44 .createInstance(
Ci.sbIMutablePropertyArray);
45 props.appendProperty(SB_NS +
"contentLength",
i);
46 props.appendProperty(SB_NS +
"trackNumber",
i + 1);
47 propertyArray.appendElement(props,
false);
51 onProgress:
function(index) {
55 for (var
i = 0;
i <
array.length;
i++) {
56 var item =
array.queryElementAt(
i,
Ci.sbIMediaItem);
58 assertEqual(item.getProperty(SB_NS +
"contentLength"),
i);
59 assertEqual(item.getProperty(SB_NS +
"trackNumber"),
i + 1);
65 library.batchCreateMediaItemsAsync(listener, toAdd, propertyArray,
true);
function assertTrue(aTest, aMessage)
function assertEqual(aExpected, aActual, aMessage)
function createLibrary(databaseGuid, databaseLocation)
function newURI(aURLString)
function runTest()
Test file.
_getSelectedPageStyle s i