Avoid race between UI events and their listeners in UI integration tests
Avoid race between UI events and their listeners in UI integration tests

UI events can get in a race with the tests trying to listen to them.
This change creates all the listeners for the UI events first,
before invoking the behavior that should fire them.

Fixes b/131313069
Fixes b/131311532

Change-Id: I43bbeb4d1c6cebe90d92563bec5c62fd84ff259f

tvoli/shaka-player,shaka-project/shaka-player,shaka-project/shaka-player,shaka-project/shaka-player,tvoli/shaka-player,shaka-project/shaka-player,tvoli/shaka-player,tvoli/shaka-player