diff options
author | Ted Gould <ted@gould.cx> | 2013-11-15 22:23:02 -0600 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2013-11-15 22:23:02 -0600 |
commit | 7a5f01039d308695e4f5faf347912c443d5ca26c (patch) | |
tree | 5611c3fe5f8b38a8015c243afc79b1a3981b4e70 /tests/name-watch-test.cc | |
parent | fc3c64800be186946252921639c79cd712c6a4f5 (diff) | |
download | ayatana-indicator-sound-7a5f01039d308695e4f5faf347912c443d5ca26c.tar.gz ayatana-indicator-sound-7a5f01039d308695e4f5faf347912c443d5ca26c.tar.bz2 ayatana-indicator-sound-7a5f01039d308695e4f5faf347912c443d5ca26c.zip |
Test for a couple of names we shouldn't expect to see.
Diffstat (limited to 'tests/name-watch-test.cc')
-rw-r--r-- | tests/name-watch-test.cc | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/tests/name-watch-test.cc b/tests/name-watch-test.cc index 66daadc..737915e 100644 --- a/tests/name-watch-test.cc +++ b/tests/name-watch-test.cc @@ -84,3 +84,45 @@ TEST_F(NameWatchTest, BaseWatch) bus_unwatch_namespace(ns_watch); } + +TEST_F(NameWatchTest, NonMatches) +{ + callback_count_t callback_count = {0}; + + guint ns_watch = bus_watch_namespace(G_BUS_TYPE_SESSION, + "com.foo", + appeared_simple_cb, + vanished_simple_cb, + &callback_count, + NULL); + + guint name1 = g_bus_own_name(G_BUS_TYPE_SESSION, + "com.foobar.bar", + G_BUS_NAME_OWNER_FLAGS_NONE, + NULL, NULL, NULL, NULL, NULL); + guint name2 = g_bus_own_name(G_BUS_TYPE_SESSION, + "com.bar.com.foo", + G_BUS_NAME_OWNER_FLAGS_NONE, + NULL, NULL, NULL, NULL, NULL); + + g_usleep(100000); + while (g_main_pending()) + g_main_iteration(TRUE); + g_usleep(100000); + while (g_main_pending()) + g_main_iteration(TRUE); + + + ASSERT_EQ(callback_count.appeared, 0); + + g_bus_unown_name(name1); + g_bus_unown_name(name2); + + g_usleep(100000); + while (g_main_pending()) + g_main_iteration(TRUE); + + ASSERT_EQ(callback_count.vanished, 0); + + bus_unwatch_namespace(ns_watch); +} |