Fix passing xhr explicitly, moved HttpRequestMock to tests