This routine already exists as checkCanvasRect in WebGLTestUtils. Could you refactor the test to use the preexisting code?