Bug 916497 - PageThumbs no longer expires thumbnails being tested to fix intermittent oranges. r=adw, a=test-only
authorMark Hammond <mhammond@skippinet.com.au>
Wed, 14 May 2014 11:09:31 +1000
changeset 192288 c5f7b330dd3a
parent 192287 3f803365277a
child 192289 c3bcd563e6ce
push id3557
push userryanvm@gmail.com
push date2014-05-14 16:23 +0000
treeherdermozilla-beta@c3bcd563e6ce [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersadw, test-only
bugs916497
milestone30.0
Bug 916497 - PageThumbs no longer expires thumbnails being tested to fix intermittent oranges. r=adw, a=test-only
toolkit/components/thumbnails/test/browser_thumbnails_bg_queueing.js
toolkit/components/thumbnails/test/browser_thumbnails_redirect.js
toolkit/components/thumbnails/test/browser_thumbnails_storage.js
toolkit/components/thumbnails/test/head.js
--- a/toolkit/components/thumbnails/test/browser_thumbnails_bg_queueing.js
+++ b/toolkit/components/thumbnails/test/browser_thumbnails_bg_queueing.js
@@ -4,16 +4,17 @@
 function runTests() {
   let urls = [
     "http://www.example.com/0",
     "http://www.example.com/1",
     // an item that will timeout to ensure timeouts work and we resume.
     bgTestPageURL({ wait: 2002 }),
     "http://www.example.com/2",
   ];
+  dontExpireThumbnailURLs(urls);
   urls.forEach(url => {
     ok(!thumbnailExists(url), "Thumbnail should not exist yet: " + url);
     let isTimeoutTest = url.indexOf("wait") >= 0;
     BackgroundPageThumbs.capture(url, {
       timeout: isTimeoutTest ? 100 : 30000,
       onDone: function onDone(capturedURL) {
         ok(urls.length > 0, "onDone called, so URLs should still remain");
         is(capturedURL, urls.shift(),
--- a/toolkit/components/thumbnails/test/browser_thumbnails_redirect.js
+++ b/toolkit/components/thumbnails/test/browser_thumbnails_redirect.js
@@ -1,18 +1,23 @@
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 const URL = "http://mochi.test:8888/browser/toolkit/components/thumbnails/" +
             "test/background_red_redirect.sjs";
+// loading URL will redirect us to...
+const FINAL_URL = "http://mochi.test:8888/browser/toolkit/components/" +
+                  "thumbnails/test/background_red.html";
 
 /**
  * These tests ensure that we save and provide thumbnails for redirecting sites.
  */
 function runTests() {
+  dontExpireThumbnailURLs([URL, FINAL_URL]);
+
   // Kick off history by loading a tab first or the test fails in single mode.
   yield addTab(URL);
   gBrowser.removeTab(gBrowser.selectedTab);
 
   // Create a tab, redirecting to a page with a red background.
   yield addTab(URL);
   yield captureAndCheckColor(255, 0, 0, "we have a red thumbnail");
 
--- a/toolkit/components/thumbnails/test/browser_thumbnails_storage.js
+++ b/toolkit/components/thumbnails/test/browser_thumbnails_storage.js
@@ -13,16 +13,18 @@ XPCOMUtils.defineLazyGetter(this, "Sanit
 });
 
 /**
  * These tests ensure that the thumbnail storage is working as intended.
  * Newly captured thumbnails should be saved as files and they should as well
  * be removed when the user sanitizes their history.
  */
 function runTests() {
+  dontExpireThumbnailURLs([URL, URL_COPY]);
+
   yield clearHistory();
   yield addVisitsAndRepopulateNewTabLinks(URL, next);
   yield createThumbnail();
 
   // Make sure Storage.copy() updates an existing file.
   yield PageThumbsStorage.copy(URL, URL_COPY);
   let copy = new FileUtils.File(PageThumbsStorage.getFilePathForURL(URL_COPY));
   let mtime = copy.lastModifiedTime -= 60;
--- a/toolkit/components/thumbnails/test/head.js
+++ b/toolkit/components/thumbnails/test/head.js
@@ -116,16 +116,19 @@ function whenLoaded(aElement, aCallback 
  * retrieves it from the cache and compares pixel color values.
  * @param aRed The red component's intensity.
  * @param aGreen The green component's intensity.
  * @param aBlue The blue component's intensity.
  * @param aMessage The info message to print when comparing the pixel color.
  */
 function captureAndCheckColor(aRed, aGreen, aBlue, aMessage) {
   let browser = gBrowser.selectedBrowser;
+  // We'll get oranges if the expiration filter removes the file during the
+  // test.
+  dontExpireThumbnailURLs([browser.currentURI.spec]);
 
   // Capture the screenshot.
   PageThumbs.captureAndStore(browser, function () {
     retrieveImageDataForURL(browser.currentURI.spec, function ([r, g, b]) {
       is("" + [r,g,b], "" + [aRed, aGreen, aBlue], aMessage);
       next();
     });
   });
@@ -320,16 +323,19 @@ function bgCapture(aURL, aOptions) {
   bgCaptureWithMethod("capture", aURL, aOptions);
 }
 
 function bgCaptureIfMissing(aURL, aOptions) {
   bgCaptureWithMethod("captureIfMissing", aURL, aOptions);
 }
 
 function bgCaptureWithMethod(aMethodName, aURL, aOptions = {}) {
+  // We'll get oranges if the expiration filter removes the file during the
+  // test.
+  dontExpireThumbnailURLs([aURL]);
   if (!aOptions.onDone)
     aOptions.onDone = next;
   BackgroundPageThumbs[aMethodName](aURL, aOptions);
 }
 
 function bgTestPageURL(aOpts = {}) {
   let TEST_PAGE_URL = "http://mochi.test:8888/browser/toolkit/components/thumbnails/test/thumbnails_background.sjs";
   return TEST_PAGE_URL + "?" + encodeURIComponent(JSON.stringify(aOpts));