[Bug 845828] Make code testable [r=crdlc]
Merge pull request #8419 from EverythingMe/testability

[Bug 845828] Make code testable [r=crdlc]