use promise for running a microtask

BUG=

Review URL: https://codereview.appspot.com/155340043