Fix QUnit issues, such as an incorrect use of assert.ok.

Move setup code that does not vary between tests.  See
bug 49032.

Change-Id: Ic9d955038df800748e1c1e6bdb7de89c1eef0aea
Merge "Fix QUnit issues, such as an incorrect use of assert.ok."