Bug 1034192, Bug 1034185 - fix app tests

Supersedes #2821 with minor fixes as discussed there.