[Mac] Implement DispatchPendingEvents

And fix some unit test issues