This should be abstracted by util::RunLoop
It is going to be used by another test that needs to emulate asynchronous requests.