michael@0: /* Any copyright is dedicated to the Public Domain. michael@0: * http://creativecommons.org/publicdomain/zero/1.0/ */ michael@0: michael@0: function runTests() { michael@0: let crashObserver = bgAddCrashObserver(); michael@0: michael@0: // make a good capture first - this ensures we have the michael@0: let goodUrl = bgTestPageURL(); michael@0: yield bgCapture(goodUrl); michael@0: ok(thumbnailExists(goodUrl), "Thumbnail should be cached after capture"); michael@0: removeThumbnail(goodUrl); michael@0: michael@0: // inject our content script. michael@0: let mm = bgInjectCrashContentScript(); michael@0: michael@0: // queue up 2 captures - the first has a wait, so this is the one that michael@0: // will die. The second one should immediately capture after the crash. michael@0: let waitUrl = bgTestPageURL({ wait: 30000 }); michael@0: let sawWaitUrlCapture = false; michael@0: bgCapture(waitUrl, { onDone: () => { michael@0: sawWaitUrlCapture = true; michael@0: ok(!thumbnailExists(waitUrl), "Thumbnail should not have been saved due to the crash"); michael@0: }}); michael@0: bgCapture(goodUrl, { onDone: () => { michael@0: ok(sawWaitUrlCapture, "waitUrl capture should have finished first"); michael@0: ok(thumbnailExists(goodUrl), "We should have recovered and completed the 2nd capture after the crash"); michael@0: removeThumbnail(goodUrl); michael@0: // Test done. michael@0: ok(crashObserver.crashed, "Saw a crash from this test"); michael@0: next(); michael@0: }}); michael@0: michael@0: info("Crashing the thumbnail content process."); michael@0: mm.sendAsyncMessage("thumbnails-test:crash"); michael@0: yield true; michael@0: }