31 Components.utils.import(
"resource://gre/modules/XPCOMUtils.jsm");
32 Components.utils.import(
"resource://app/jsmodules/ArrayConverter.jsm");
33 Components.utils.import(
"resource://app/jsmodules/sbProperties.jsm");
34 Components.utils.import(
"resource://app/jsmodules/sbLibraryUtils.jsm");
37 this.wrappedJSObject =
this;
44 onMediacoreEvent:
function(
event) {
46 if (this.onEnd &&
event.type ==
Ci.sbIMediacoreEvent.STREAM_END) {
53 function dummyCore() {
54 this.wrappedJSObject =
this;
57 dummyCore.prototype = {
61 var eventIDs = [
Ci.sbIMediacoreEvent.METADATA_CHANGE,
62 Ci.sbIMediacoreEvent.URI_CHANGE,
63 Ci.sbIMediacoreEvent.DURATION_CHANGE,
64 Ci.sbIMediacoreEvent.VOLUME_CHANGE,
65 Ci.sbIMediacoreEvent.MUTE_CHANGE,
66 Ci.sbIMediacoreEvent.STREAM_FOUND,
67 Ci.sbIMediacoreEvent.BUFFERING,
68 Ci.sbIMediacoreEvent.BUFFER_UNDERRUN,
69 Ci.sbIMediacoreEvent.STREAM_START,
70 Ci.sbIMediacoreEvent.STREAM_PAUSE,
71 Ci.sbIMediacoreEvent.STREAM_END];
74 return Cc[
"@songbirdnest.com/mediacore/sbTestDummyMediacoreManager;1"]
75 .createInstance(
Ci.sbIMediacoreEventTarget);
79 var creator =
Cc[
"@songbirdnest.com/Songbird/Mediacore/Manager;1"]
80 .getService(
Ci.sbIMediacoreManager);
81 return creator.createEvent(type,
new dummyCore(), error,
data);
91 log(
"Asynchronous\n");
114 eventTarget.addListener(listener);
116 for (index = 0; index < eventIDs.length; ++index) {
118 eventTarget.dispatchEvent(
event, async);
120 var testValues =
function() {
121 assertEqual(listener.log.length, eventIDs.length,
"event received count not equal to events sent");
122 for (index = 0; index < eventIDs.length; ++index) {
123 assertEqual(listener.log[index].type, eventIDs[index],
"Event type doesn't match event ID sent");
127 listener.onEnd = testValues;
132 eventTarget.removeListener(listener);
sbOSDControlService prototype QueryInterface
function assertEqual(aExpected, aActual, aMessage)