Refactor modules and tests for Browser window UI

This PR is part of the issue #18 for using ui modules.

@ahal and @chmanchester can you please have a look at this? Lets me know if something looks strange to you.
The thing is that the test should not know how the window switching is implemented. So what you want in your callback is a reference to the window to test the condition for. It also simplifies the amount of code so you can spend writing `self.windows.current` and simply referencing to `window`.