Added tests for WebGLState and OffscreenSurface.

Also moved contextPool variable up in scope within tests to
avoid creating too many contexts.