Transition media element to HAVE_CURRENT_DATA upon underflow.

Previously underflow would cause a pause but did not change the
readyState to HAVE_CURRENT_DATA. This also meant that we did not emit
the "waiting" event upon underflow, meaning apps were not properly
informed when playback stalls. This CL fixes all of that.

This CL fixes a layout test that was meant to cover this scenario but
did not properly check the waiting event. The test has been refactored
to use the new testharness.js.

Still missing is support for transitioning to HAVE_FUTURE_DATA. Currently
we will transition immediately from HAVE_CURRENT to HAVE_ENOUGH, skipping
HAVE_FUTURE. This is less critical, but still nice to have, especially
for MediaSource.

BUG=144683,279213
TEST=fixed layout test

Review-Url: https://codereview.chromium.org/2115143002
Cr-Commit-Position: refs/heads/master@{#405656}
8 files changed