Add separate clear_browser function which can be used in tests too.
Improve mail host mocking: use also a teardown.