Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | <?xml version="1.0"?> |
michael@0 | 2 | <!-- |
michael@0 | 3 | /* Any copyright is dedicated to the Public Domain. |
michael@0 | 4 | * http://creativecommons.org/publicdomain/zero/1.0/ |
michael@0 | 5 | */ |
michael@0 | 6 | |
michael@0 | 7 | /** |
michael@0 | 8 | * Removes files and preferences for previous application update tests in case |
michael@0 | 9 | * any of them had a fatal error. The test name ensures that it will run after |
michael@0 | 10 | * all other tests as long as the test naming uses the same format as the |
michael@0 | 11 | * existing tests. |
michael@0 | 12 | */ |
michael@0 | 13 | --> |
michael@0 | 14 | |
michael@0 | 15 | <?xml-stylesheet href="chrome://global/skin" type="text/css"?> |
michael@0 | 16 | <?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?> |
michael@0 | 17 | |
michael@0 | 18 | <window title="Application Update test cleanup" |
michael@0 | 19 | xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" |
michael@0 | 20 | onload="runTest();"> |
michael@0 | 21 | <script type="application/javascript" |
michael@0 | 22 | src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/> |
michael@0 | 23 | <script type="application/javascript" |
michael@0 | 24 | src="utils.js"/> |
michael@0 | 25 | |
michael@0 | 26 | <script type="application/javascript"> |
michael@0 | 27 | <![CDATA[ |
michael@0 | 28 | |
michael@0 | 29 | /** |
michael@0 | 30 | * If the application update tests left behind any of the files it uses it could |
michael@0 | 31 | * be a very bad thing. The purpose of this test is to prevent that from |
michael@0 | 32 | * happening. |
michael@0 | 33 | */ |
michael@0 | 34 | function runTest() { |
michael@0 | 35 | debugDump("entering"); |
michael@0 | 36 | |
michael@0 | 37 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 38 | |
michael@0 | 39 | closeUpdateWindow(); |
michael@0 | 40 | |
michael@0 | 41 | resetPrefs(); |
michael@0 | 42 | resetFiles(); |
michael@0 | 43 | removeUpdateDirsAndFiles(); |
michael@0 | 44 | reloadUpdateManagerData(); |
michael@0 | 45 | |
michael@0 | 46 | let file = getUpdatesXMLFile(true); |
michael@0 | 47 | ok(!file.exists(), file.path + " should not exist"); |
michael@0 | 48 | |
michael@0 | 49 | file = getUpdatesXMLFile(false); |
michael@0 | 50 | ok(!file.exists(), file.path + " should not exist"); |
michael@0 | 51 | |
michael@0 | 52 | let dir = getUpdatesDir(); |
michael@0 | 53 | |
michael@0 | 54 | file = dir.clone(); |
michael@0 | 55 | file.append(FILE_UPDATE_STATUS); |
michael@0 | 56 | ok(!file.exists(), file.path + " should not exist"); |
michael@0 | 57 | |
michael@0 | 58 | file = dir.clone(); |
michael@0 | 59 | file.append(FILE_UPDATE_ARCHIVE); |
michael@0 | 60 | ok(!file.exists(), file.path + " should not exist"); |
michael@0 | 61 | |
michael@0 | 62 | let addonPrepDir = Services.dirsvc.get(NS_APP_USER_PROFILE_50_DIR, |
michael@0 | 63 | AUS_Ci.nsILocalFile); |
michael@0 | 64 | addonPrepDir.append(ADDON_PREP_DIR); |
michael@0 | 65 | // Not being able to remove the directory used to create the test add-ons |
michael@0 | 66 | // will not adversely affect subsequent tests so wrap it in a try lock and |
michael@0 | 67 | // don't test whether its removal was successful. |
michael@0 | 68 | try { |
michael@0 | 69 | removeDirRecursive(addonPrepDir); |
michael@0 | 70 | } |
michael@0 | 71 | catch (e) { |
michael@0 | 72 | dump("Unable to remove directory\n" + |
michael@0 | 73 | "path: " + addonPrepDir.path + "\n" + |
michael@0 | 74 | "Exception: " + e + "\n"); |
michael@0 | 75 | } |
michael@0 | 76 | |
michael@0 | 77 | resetAddons(SimpleTest.finish); |
michael@0 | 78 | } |
michael@0 | 79 | |
michael@0 | 80 | ]]> |
michael@0 | 81 | </script> |
michael@0 | 82 | |
michael@0 | 83 | <body xmlns="http://www.w3.org/1999/xhtml"> |
michael@0 | 84 | <p id="display"></p> |
michael@0 | 85 | <div id="content" style="display: none"></div> |
michael@0 | 86 | <pre id="test"></pre> |
michael@0 | 87 | </body> |
michael@0 | 88 | </window> |