It looks like most (all?) tests that use testInIFrame access the frame's content document. Why not move that into testInIFrame, pass the document as a parameter, and make each test case one line simpler?