Register a tab visit only after 500ms without timers.

Continuation of #1249.

Instead of using timers, this switches to calculating the difference in time between each call of the `chrome.tabs.onActivated`/`chrome.tabs.onRemoved` listeners. This has a couple of advantages:

* we're not relying on `setTimeout`, which is notorious for being inconsistent with how long it actually takes to fire.
* the code path is more linear, since everything is done as part of a callback from one of `chrome.tabs.onActivated`/`onRemoved`/`onReplaced`.

This also changes how we test it:
* we have to modify `TabRecency.lastVisitedTime` after each `TabRecency.add` to ensure enough time has elapsed. (Although I guess we could stub the `Date` constructor?)
* we can now (though I haven't) add tests checking that tabs not visited for enough time are not registered, something that wasn't possible before.
It just felt more natural to me that you would count tabs that
* the browser opened on
* have been redirected while under focus (eg. via a link click)

count as visited, even if the user quickly moves off them. I can get rid of it if you think it's unnecessary.