33 Components.utils.import(
"resource://app/jsmodules/sbProperties.jsm");
35 var
SB_NS =
"http://songbirdnest.com/data/1.0#";
37 var databaseGUID =
"test_bulkproperties";
41 library.addListener(listener,
false);
43 var
uri =
"http://floo.com/";
44 var item = library.createMediaItem(
newURI(uri));
48 item.setProperty(SB_NS +
"trackName",
"Test item");
50 var props = item.getProperties(
null);
52 var originalPropCount = props.length;
56 props = item.getProperties(SBProperties.createArray([
57 [SBProperties.contentURL, uri],
58 [SBProperties.hidden,
"0"]
63 assertEqual(props.getPropertyValue(SB_NS +
"hidden"),
"0");
65 var a = SBProperties.createArray([
66 [SBProperties.albumName,
"album name"],
67 [SBProperties.artistName,
"artist name"]
71 item.setProperties(a);
73 props = item.getProperties(
null);
76 assertEqual(props.getPropertyValue(SB_NS +
"albumName"),
"album name");
77 assertEqual(props.getPropertyValue(SB_NS +
"artistName"),
"artist name");
79 var changedProps = listener.updatedProperties;
84 a = SBProperties.createArray([
85 [SBProperties.albumName,
"album name2"],
86 [SBProperties.artistName,
"artist name2"]
90 item.setProperties(a);
92 props = item.getProperties(
null);
95 assertEqual(props.getPropertyValue(SB_NS +
"albumName"),
"album name2");
96 assertEqual(props.getPropertyValue(SB_NS +
"artistName"),
"artist name2");
98 changedProps = listener.updatedProperties;
100 assertEqual(changedProps.getPropertyValue(SB_NS +
"albumName"),
"album name");
101 assertEqual(changedProps.getPropertyValue(SB_NS +
"artistName"),
"artist name");
106 a = SBProperties.createArray([
107 [SBProperties.trackNumber,
"invalid"]
110 item.setProperties(a);
111 fail(
"Exception not thrown");
117 library.removeListener(listener);
function assertTrue(aTest, aMessage)
function assertEqual(aExpected, aActual, aMessage)
function runTest()
Test file.
function createLibrary(databaseGuid, databaseLocation)
function newURI(aURLString)
function TestMediaListListener()