toolkit/components/aboutmemory/tests/test_sqliteMultiReporter.xul

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:aae7554805b0
1 <?xml version="1.0"?>
2 <?xml-stylesheet type="text/css" href="chrome://global/skin"?>
3 <?xml-stylesheet type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"?>
4 <window title="about:memory"
5 xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
6 <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
7 <script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
8
9 <!-- test results are displayed in the html:body -->
10 <body xmlns="http://www.w3.org/1999/xhtml"></body>
11
12 <!-- test code goes here -->
13 <script type="application/javascript">
14 <![CDATA[
15
16 // Test for bug 708248, where the SQLite memory multi-reporter was
17 // crashing when a DB was closed.
18
19 // Nb: this test is all JS and so should be done with an xpcshell test,
20 // but bug 671753 is preventing the memory-reporter-manager from being
21 // accessed from xpcshell.
22
23 const Cc = Components.classes;
24 const Ci = Components.interfaces;
25 const Cu = Components.utils;
26
27 // Make a fake DB file.
28 let file = Cc["@mozilla.org/file/directory_service;1"].
29 getService(Ci.nsIProperties).
30 get("ProfD", Ci.nsIFile);
31 file.append("test_sqliteMultiReporter-fake-DB-tmp.sqlite");
32
33 // Open and close the DB.
34 let storage = Cc["@mozilla.org/storage/service;1"].
35 getService(Ci.mozIStorageService);
36 let db = storage.openDatabase(file);
37 db.close();
38
39 // Invoke all the reporters. The SQLite multi-reporter is among
40 // them. It shouldn't crash.
41 let mgr = Cc["@mozilla.org/memory-reporter-manager;1"].
42 getService(Ci.nsIMemoryReporterManager);
43 mgr.getReportsForThisProcess(function(){}, null);
44
45 // If we haven't crashed, we've passed, but the test harness requires that
46 // we explicitly check something.
47 ok(true, "didn't crash");
48
49 ]]>
50 </script>
51 </window>

mercurial