Automated test for begin and event events

The test harness now supports begin and end event expectations.

The test begin-end-events.html now uses the test harness.

Bug fix: We no longer issue an end event if the animation never
started, or has already ended.