[HTML Imports] Fixed test flakiness

These tests relies on async thing as if beinc sync.
This change add guards to ensure these async conditions are ready.

R=dominicc,dglazkov
BUG=none
TEST=none

Review URL: https://chromiumcodereview.appspot.com/21124013

git-svn-id: svn://svn.chromium.org/blink/trunk@155306 bbb929c8-8fbe-4397-9dbb-9b2b20218538