Clean up some of the setTimeout() in the tests.

Some should be replaced with waitForComposite,
some should be replaced with requestAnimFrame,
some should use the timeout 0 instead of a positive value.
Merge pull request #731 from zhenyao/timeout

Clean up some of the setTimeout() in the tests.