impl_->PluginInit(argc, argv);
traceEnd(TTRACE_TAG_APPLICATION_MANAGER);
- GLib::IdleAdd(
- [](gpointer data) -> gboolean {
- AppCoreBase* base = reinterpret_cast<AppCoreBase*>(data);
- base->impl_->InitSuspend();
- return G_SOURCE_REMOVE;
- },
- this);
-
+ impl_->InitSuspend();
traceBegin(TTRACE_TAG_APPLICATION_MANAGER, "APPCORE:SET_SYSTEM_EVENT");
if (!impl_->dirty_) {
impl_->dirty_ = true;
void SuspendEvent::GAsyncReadyCb(GObject* source_object, GAsyncResult* res,
gpointer user_data) {
auto* event = static_cast<SuspendEvent*>(user_data);
- g_object_unref(event->cancellable_);
- event->cancellable_ = nullptr;
-
GError* error = nullptr;
event->conn_ = g_bus_get_finish(res, &error);
if (event->conn_ == nullptr) {
* limitations under the License.
*/
-#include <gmock/gmock.h>
-
-//#define LOG_INTERNAL
-
-#ifdef LOG_INTERNAL
#include <dlog.h>
+#include <gmock/gmock.h>
-extern "C" int __dlog_print(log_id_t log_id, int prio, const char *tag, const char *fmt, ...) {
+extern "C" int __dlog_print(log_id_t log_id, int prio, const char* tag,
+ const char* fmt, ...) {
printf("%s:", tag);
va_list ap;
va_start(ap, fmt);
vprintf(fmt, ap);
va_end(ap);
printf("\n");
-
return 0;
}
-#endif
int main(int argc, char* argv[]) {
int ret = 0;
conn_ = reinterpret_cast<GDBusConnection*>(&dummy);
ON_CALL(*this, g_bus_get_sync(_, _, _)).WillByDefault(Return(conn_));
+ ON_CALL(*this, g_bus_get(_, _, _, _))
+ .WillByDefault(Invoke(
+ [&](GBusType, GCancellable*, GAsyncReadyCallback, gpointer) {}));
+ ON_CALL(*this,
+ g_dbus_connection_signal_subscribe(_, _, _, _, _, _, _, _, _, _))
+ .WillByDefault(Return(1));
+ ON_CALL(*this, g_dbus_connection_signal_unsubscribe(_, _))
+ .WillByDefault(Invoke([&](GDBusConnection*, guint) {}));
+ ON_CALL(*this, g_bus_get_finish(_, _)).WillByDefault(Return(conn_));
+ ON_CALL(*this, g_cancellable_new())
+ .WillByDefault(Return(reinterpret_cast<GCancellable*>(&dummy)));
+ ON_CALL(*this, g_cancellable_cancel(_))
+ .WillByDefault(Invoke([&](GCancellable*) {}));
+ ON_CALL(*this, g_object_unref(_)).WillByDefault(Invoke([&](gpointer) {}));
}
MOCK_METHOD3(g_bus_get_sync,