Add basic tests for WebView

This PR contains four commits. Three are cleanup/small fixes and one commit adding tests.