Bug 841422 - Move unit tests for shared code out of gallery

https://bugzilla.mozilla.org/show_bug.cgi?id=841422