~charlesk/indicator-datetime/lp-1376513-remove-alarm-volume-from-gschema

« back to all changes in this revision

Viewing changes to tests/test-notification.cpp

  • Committer: Charles Kerr
  • Date: 2016-02-11 02:49:07 UTC
  • Revision ID: charles.kerr@canonical.com-20160211024907-b280ovx351jiixuf
in test-notifications we do need one wait() wart after all, because the Snap is building its impl proxies asynchronously and hasn't any public way of notifying when they're built

Show diffs side-by-side

added added

removed removed

Lines of Context:
38
38
    g_main_loop_quit(static_cast<GMainLoop*>(gloop));
39
39
    return G_SOURCE_REMOVE;
40
40
  }
41
 
 
42
 
  void on_dbus_signal(GDBusConnection* /*connection*/,
43
 
                      const gchar* /*sender_name*/,
44
 
                      const gchar* /*object_path*/,
45
 
                      const gchar* /*interface_name*/,
46
 
                      const gchar* /*signal_name*/,
47
 
                      GVariant* /*parameters*/,
48
 
                      gpointer gloop)
49
 
  {
50
 
    g_main_loop_quit(static_cast<GMainLoop*>(gloop));
51
 
  }
52
41
}
53
42
 
54
43
/***
147
136
 
148
137
    // set test case properties: other-vibrations flag
149
138
    // (and wait for the PropertiesChanged signal so we know the dbusmock got it)
150
 
    ASSERT_NAME_OWNED_EVENTUALLY(system_bus, AS_BUSNAME);
151
 
    const auto subscription_id = g_dbus_connection_signal_subscribe(system_bus,
152
 
                                                                    AS_BUSNAME,
153
 
                                                                    "org.freedesktop.DBus.Properties",
154
 
                                                                    "PropertiesChanged",
155
 
                                                                    nullptr, /* object_path */
156
 
                                                                    "com.ubuntu.touch.AccountsService.Sound",
157
 
                                                                    G_DBUS_SIGNAL_FLAGS_NONE,
158
 
                                                                    on_dbus_signal,
159
 
                                                                    loop,
160
 
                                                                    nullptr /*user_data_free_func*/);
161
139
    dbus_test_dbus_mock_object_update_property(as_mock,
162
140
                                               as_obj,
163
141
                                               PROP_OTHER_VIBRATIONS,
164
142
                                               g_variant_new_boolean(test_vibes.other_vibrations),
165
143
                                               &error);
166
144
    g_assert_no_error(error);
167
 
    g_main_loop_run(loop);
168
 
    g_dbus_connection_signal_unsubscribe(system_bus, subscription_id);
 
145
    wait_msec(100);
169
146
 
170
147
    // run the test
171
148
    (*snap)(test_appt.appt, appt.alarms.front(), func, func);