toolkit/components/search/tests/xpcshell/test_nodb.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/toolkit/components/search/tests/xpcshell/test_nodb.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,37 @@
     1.4 +/* Any copyright is dedicated to the Public Domain.
     1.5 +   http://creativecommons.org/publicdomain/zero/1.0/ */
     1.6 +
     1.7 +/*
     1.8 + * test_nodb: Start search engine
     1.9 + * - without search-metadata.json
    1.10 + * - without search.sqlite
    1.11 + *
    1.12 + * Ensure that :
    1.13 + * - nothing explodes;
    1.14 + * - no search-metadata.json is created.
    1.15 + */
    1.16 +
    1.17 +
    1.18 +function run_test()
    1.19 +{
    1.20 +  removeMetadata();
    1.21 +  updateAppInfo();
    1.22 +
    1.23 +  let search = Services.search;
    1.24 +
    1.25 +  do_test_pending();
    1.26 +  search.init(function ss_initialized(rv) {
    1.27 +    do_check_true(Components.isSuccessCode(rv));
    1.28 +    do_timeout(500, function() {
    1.29 +      // Check that search-metadata.json has not been
    1.30 +      // created. Note that we cannot do much better
    1.31 +      // than a timeout for checking a non-event.
    1.32 +      let metadata = gProfD.clone();
    1.33 +      metadata.append("search-metadata.json");
    1.34 +      do_check_true(!metadata.exists());
    1.35 +      removeMetadata();
    1.36 +
    1.37 +      do_test_finished();
    1.38 +    });
    1.39 +  });
    1.40 +}

mercurial