tests: Manually iterate main context on tear_down in Dummy tests

The code under test in these cases doesn’t (yet) correctly ensure there
are no pending events before returning. To avoid assertion failure,
manually iterate the global default main context until all pending
events have been handled, then continue to tear_down.

In future, it would be better to fix the tests and backends themselves
to not leak main context events after unprepare() has been called.
See https://bugzilla.gnome.org/show_bug.cgi?id=727700.

https://bugzilla.gnome.org/show_bug.cgi?id=726973