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 url = "http://example.com/"; michael@0: let file = thumbnailFile(url); michael@0: ok(!file.exists(), "Thumbnail file should not already exist."); michael@0: michael@0: let capturedURL = yield bgCaptureIfMissing(url); michael@0: is(capturedURL, url, "Captured URL should be URL passed to capture"); michael@0: ok(file.exists(url), "Thumbnail should be cached after capture"); michael@0: michael@0: let past = Date.now() - 1000000000; michael@0: let pastFudge = past + 30000; michael@0: file.lastModifiedTime = past; michael@0: ok(file.lastModifiedTime < pastFudge, "Last modified time should stick!"); michael@0: capturedURL = yield bgCaptureIfMissing(url); michael@0: is(capturedURL, url, "Captured URL should be URL passed to second capture"); michael@0: ok(file.exists(), "Thumbnail should remain cached after second capture"); michael@0: ok(file.lastModifiedTime < pastFudge, michael@0: "File should not have been overwritten"); michael@0: michael@0: file.remove(false); michael@0: }