Bug 840495 - [keyboard] Fix & restore unit tests r=djf

This is a patch from mike@bocoup.com