michael@0: var t = async_test(document.title); michael@0: michael@0: var frameLoadsPending = 2; michael@0: michael@0: var callMasterFrame = true; michael@0: var testDone = false; michael@0: michael@0: var masterFrameOrigin = ""; michael@0: var slaveFrameOrigin = ""; michael@0: michael@0: var failureRegExp = new RegExp("^FAILURE"); michael@0: michael@0: const framePath = "/tests/dom/tests/mochitest/localstorage/"; michael@0: michael@0: window.addEventListener("message", onMessageReceived, false); michael@0: michael@0: function onMessageReceived(event) michael@0: { michael@0: switch (event.data) michael@0: { michael@0: // Indication of the frame onload event michael@0: case "frame loaded": michael@0: if (--frameLoadsPending) michael@0: break; michael@0: michael@0: // Just fall through... michael@0: michael@0: // Indication of successfully finished step of a test michael@0: case "perf": michael@0: if (callMasterFrame) michael@0: masterFrame.postMessage("step", masterFrameOrigin); michael@0: else michael@0: slaveFrame.postMessage("step", slaveFrameOrigin); michael@0: callMasterFrame = !callMasterFrame; michael@0: break; michael@0: michael@0: // Indication of all test parts finish (from any of the frames) michael@0: case "done": michael@0: if (testDone) michael@0: break; michael@0: michael@0: testDone = true; michael@0: t.done(); michael@0: break; michael@0: michael@0: // Any other message indicates error, succes or todo message of a test michael@0: default: michael@0: t.step(function() { michael@0: assert_true(!event.data.match(failureRegExp), event.data); michael@0: }); michael@0: break; michael@0: } michael@0: }