aboutsummaryrefslogtreecommitdiff
path: root/tests/mockpulse.c
diff options
context:
space:
mode:
authorRobert Collins <robertc@robertcollins.net>2010-03-09 14:37:03 +1100
committerRobert Collins <robertc@robertcollins.net>2010-03-09 14:37:03 +1100
commit69049dd2d6011e9ab96f4f439d00e1de98178449 (patch)
tree07ad629ac1da1d36af68c59afa90966cad0908ce /tests/mockpulse.c
parent6c2b978f17d48fe212cccb15c23bb1e278ba600f (diff)
downloadayatana-indicator-sound-69049dd2d6011e9ab96f4f439d00e1de98178449.tar.gz
ayatana-indicator-sound-69049dd2d6011e9ab96f4f439d00e1de98178449.tar.bz2
ayatana-indicator-sound-69049dd2d6011e9ab96f4f439d00e1de98178449.zip
Fleshed out mocking needs missing symbols from the service linked in to work now.
Diffstat (limited to 'tests/mockpulse.c')
-rw-r--r--tests/mockpulse.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/mockpulse.c b/tests/mockpulse.c
index eec2c03..a41de30 100644
--- a/tests/mockpulse.c
+++ b/tests/mockpulse.c
@@ -20,6 +20,9 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
#include <pulse/glib-mainloop.h>
#include <pulse/context.h>
+#include <pulse/operation.h>
+#include <pulse/introspect.h>
+#include "mockpulse.h"
struct pa_context {
int refcount;
@@ -65,3 +68,32 @@ pa_context_get_state(pa_context *c)
{
return c->state;
}
+
+struct pa_operation {
+ int refcount;
+};
+
+/* Can be made into a list if we need multiple callbacks */
+static pa_sink_info *next_sink_info;
+
+void
+set_pa_context_get_sink_info(pa_sink_info *info) {
+ next_sink_info = info;
+}
+
+pa_operation *
+pa_context_get_sink_info_by_index(pa_context *c, uint32_t idx, pa_sink_info_cb_t cb, void * userdata)
+{
+ pa_operation *result = g_new(pa_operation, 1);
+ result->refcount = 1;
+ cb(c, next_sink_info, 0, userdata);
+ return result;
+}
+
+void
+pa_operation_unref(pa_operation * foo)
+{
+ foo->refcount--;
+ if (!foo->refcount)
+ g_free(foo);
+}