DXR is a code search and navigation tool aimed at making sense of large projects. It supports full-text and regex searches as well as structural queries.

Untracked file

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
<html>
<head>
  <title>Testing Application.js</title>
  <script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
  <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"></link>
</head>
<body>
<pre id="test">
<script class="testbody" type="text/javascript">

// The various pieces that we'll be testing
var test = {
	dummyid: "fuel-dummy-extension@mozilla.org",
	dummyname: "Dummy Extension",
	inspectorid: "inspector@mozilla.org",
	inspectorname: "DOM Inspector"
};

test_Extensions();

function test_Extensions() {
  netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");

  // test to see if a non-existant extension exists
  ok(!Application.extensions.has(test.dummyid), "Check non-existant extension for existance");

  // test to see if an extension exists
  ok(Application.extensions.has(test.inspectorid), "Check extension for existance");

  var inspector = Application.extensions.get(test.inspectorid);
  is(inspector.id, test.inspectorid, "Check 'Extension.id' for known extension");
  is(inspector.name, test.inspectorname, "Check 'Extension.name' for known extension");
  // The known version number changes too frequently to hardcode in
  ok(inspector.version, "Check 'Extension.version' for known extension");
  ok(inspector.firstRun, "Check 'Extension.firstRun' for known extension");
  
  // test to see if extension find works
  is(Application.extensions.all.length, 1, "Check a find for all extensions");

  // test the value of the preference root
  is(Application.extensions.all[0].prefs.root, "extensions.inspector@mozilla.org.", "Check an extension preference root");
  
  // Reset the install event preference, so that we can test it again later
  inspector.prefs.get("install-event-fired").reset();
}
</script>
</pre>
</body>
</html>