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