~mozillateam/firefox/firefox.artful

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
function run_test()
{
  do_check_true(!!_SEARCHPLUGIN_TEST_LOCALE);
  _XPCSHELL_PROCESS = "child-" + _SEARCHPLUGIN_TEST_LOCALE;

  //Services.prefs.setBoolPref("browser.search.log", true);
  Services.prefs.setCharPref("general.useragent.locale", _SEARCHPLUGIN_TEST_LOCALE);
  createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1");

  let expected = 0;

  let locations = Services.dirsvc.get("SrchPluginsDL", Ci.nsISimpleEnumerator);

  while (locations.hasMoreElements()) {
    let location = locations.getNext().QueryInterface(Ci.nsIFile);
    let entries = location.directoryEntries;
    while (entries.hasMoreElements()) {
      entries.getNext();
      expected++;
    }
  }

  do_test_pending();

  Services.search.init({
    onInitComplete: function(aStatus) {
      do_check_true(Components.isSuccessCode(aStatus));

      // Check that all of the files in the searchplugin directories
      // are valid search plugins
      do_check_eq(Services.search.getEngines().length, expected);

      do_test_finished();
    }
  });
}