Bug 1257581 - Fix and re-enable downloads misc tests. r=kmag
authorAndrew Swan <aswan@mozilla.com>
Fri, 25 Mar 2016 14:34:56 -0700
changeset 290867 3df6a745a563855868ce0dfaba1c74f0f263307f
parent 290866 4772ee550675da7ea644d8cf41ca0021caf18c65
child 290868 791698f3f8cfaa225a00339f8b2b963bca71c407
push id19656
push usergwagner@mozilla.com
push dateMon, 04 Apr 2016 13:43:23 +0000
treeherderb2g-inbound@e99061fde28a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskmag
bugs1257581
milestone48.0a1
Bug 1257581 - Fix and re-enable downloads misc tests. r=kmag The original problem was that the erase() test did not wait for downloads to complete which caused a race with cleanup code trying to remove the download directory while downloads were still writing to it. This was fixed in https://hg.mozilla.org/mozilla-central/rev/d6d9e7411319 But meanwhile, the removeFile() test bit-rotted slightly, fixed it here and re-enabled the misc test. MozReview-Commit-ID: 6BgDKKkUK55
toolkit/components/extensions/test/mochitest/chrome.ini
toolkit/components/extensions/test/mochitest/test_chrome_ext_downloads_misc.html
--- a/toolkit/components/extensions/test/mochitest/chrome.ini
+++ b/toolkit/components/extensions/test/mochitest/chrome.ini
@@ -2,13 +2,12 @@
 support-files =
   file_download.html
   file_download.txt
   interruptible.sjs
   file_sample.html
 
 [test_chrome_ext_downloads_download.html]
 [test_chrome_ext_downloads_misc.html]
-skip-if = 1 # Currently causes too many intermittent failures.
 [test_chrome_ext_downloads_search.html]
 [test_chrome_ext_eventpage_warning.html]
 [test_chrome_ext_contentscript_unrecognizedprop_warning.html]
 skip-if = (os == 'android') # browser.tabs is undefined. Bug 1258975 on android.
--- a/toolkit/components/extensions/test/mochitest/test_chrome_ext_downloads_misc.html
+++ b/toolkit/components/extensions/test/mochitest/test_chrome_ext_downloads_misc.html
@@ -619,16 +619,25 @@ add_task(function* test_removal_of_incom
           previous: false,
           current: true,
         },
         canResume: {
           previous: false,
           current: true,
         },
       },
+    }, {
+      type: "onChanged",
+      data: {
+        id,
+        error: {
+          previous: null,
+          current: "USER_CANCELED",
+        },
+      },
     }]);
   is(msg.status, "success", "got onChanged event corresponding to pause");
 
   msg = yield runInExtension("removeFile", id);
   is(msg.status, "error", "removeFile() on paused download failed");
 
   ok(/Cannot remove incomplete download/.test(msg.errmsg), "removeFile() failed due to download being incomplete");