Some further refinements to the tooltip code.

* Instead of using the BrowserID.Tooltip.shown variable for tests, add the BrowserID.Tooltip.visible() function.
* Everywhere that relied on BrowserID.Tooltip.shown directly has been converted to user testHelpers.testTooltipVisible()
* Add a test to check whether tooltip contents are escaped before being added to the DOM.
* In the tooltip code itself, turn the magic numbers into constants.

Thanks for the suggestions @_6a68!