Add test for restartAppIfNecessary
Fix bad merge.