31 var
SB_NS =
"http://songbirdnest.com/data/1.0#";
35 var
ios =
Cc[
"@mozilla.org/network/io-service;1"].getService(
Ci.nsIIOService);
37 var item1URI = ios.newURI(
"file:///alpha.mp3",
null,
null);
39 { artistName:
"A", albumName:
"Alpha", trackName:
"Track Alpha", trackNumber:
"1",
year:
"2000"};
41 var item2URI = ios.newURI(
"file:///ecto.mp3",
null,
null);
43 { artistName:
"E", albumName:
"Ecto", trackName:
"Track Ecto", trackNumber:
"2",
year:
"2004"};
45 var item3URI = ios.newURI(
"file:///beta.mp3",
null,
null);
47 { artistName:
"B", albumName:
"Beta", trackName:
"Track Beta", trackNumber:
"2",
year:
"2001"};
49 var sourceDBGUID =
"test_library_copy_source";
50 var destinationDBGUID =
"test_library_copy_destination";
57 var item1 = sourceLibrary.createMediaItem(item1URI,
62 var item2 = sourceLibrary.createMediaItem(item2URI,
67 var item3 = sourceLibrary.createMediaItem(item3URI,
70 var sourceCopyListener = {
72 items: [item1, item2, item3, item1, item2, item3],
73 onItemCopied:
function _onItemCopied(aSourceItem, aDestinationItem) {
74 dump(aSourceItem +
" should be equal to " + this.items[this.current] +
"\n\n");
81 var localDatabaseLibrary =
82 sourceLibrary.QueryInterface(
Ci.sbILocalDatabaseLibrary);
83 localDatabaseLibrary.addCopyListener(sourceCopyListener);
85 destinationLibrary.add(item1);
86 destinationLibrary.add(item2);
87 destinationLibrary.add(item3);
89 destinationLibrary.clear();
91 localDatabaseLibrary.removeCopyListener(sourceCopyListener);
93 var itemsArray =
Cc[
"@songbirdnest.com/moz/xpcom/threadsafe-array;1"]
94 .createInstance(
Ci.nsIMutableArray);
96 itemsArray.appendElement(item1,
false);
97 itemsArray.appendElement(item2,
false);
98 itemsArray.appendElement(item3,
false);
100 localDatabaseLibrary.addCopyListener(sourceCopyListener);
102 destinationLibrary.addSome(itemsArray.enumerate());
104 localDatabaseLibrary.removeCopyListener(sourceCopyListener);
106 destinationLibrary.clear();
112 return Cc[
"@songbirdnest.com/Songbird/Properties/MutablePropertyArray;1"]
113 .createInstance(
Ci.sbIMutablePropertyArray);
function assertNotEqual(aExpected, aActual, aMessage)
function appendPropertiesToArray(aProperties, aPropertyArray)
function runTest()
Advanced DataRemote unit tests.
function assertEqual(aExpected, aActual, aMessage)
function createPropertyArray()
function createLibrary(databaseGuid, databaseLocation)