base: Don't do delayed work after quitting in Mac message pump

This patch fixes a problem in the Mac message pump where we kept calling
Delegate::DoDelayedWork even if a previous call to Delegate::DoWork caused the
runloop to quit. This matches the behavior outlined in message_pump.h[1] as
well as that of the other platform-specific pumps.

We also introduce a message pump unit test that verifies behavior across all
message pump types.

Bug: 891670

[1] https://cs.chromium.org/chromium/src/base/message_loop/message_pump.h?rcl=a28a6097182e739c4a8c600b538fcc07681fc7a3&l=58

Change-Id: I00ccb5c55ac8551259a2febd343ec64fdd55630d
Reviewed-on: https://chromium-review.googlesource.com/c/1370367
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Sami Kyöstilä <skyostil@chromium.org>
Cr-Commit-Position: refs/heads/master@{#615528}
5 files changed