tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

test_browserGlue_migration_no_errors.js (1197B)


      1 /* Any copyright is dedicated to the Public Domain.
      2   http://creativecommons.org/publicdomain/zero/1.0/ */
      3 
      4 /**
      5 * Since various migrations in BrowserGlue are sometimes trivial, e.g. just
      6 * clearing a pref, it does not feel necessary to write tests for each of those.
      7 *
      8 * However, ensuring we have at least some coverage to check for errors, e.g.
      9 * typos, is a good idea, hence this test.
     10 *
     11 * If your migration is more complex that clearing a couple of prefs, you
     12 * should consider adding your own BrowserGlue migration test.
     13 */
     14 const TOPIC_BROWSERGLUE_TEST = "browser-glue-test";
     15 const TOPICDATA_BROWSERGLUE_TEST = "force-ui-migration";
     16 
     17 const gBrowserGlue = Cc["@mozilla.org/browser/browserglue;1"].getService(
     18  Ci.nsIObserver
     19 );
     20 
     21 // Set the migration value to 1, to ensure that the migration code is called,
     22 // and so that this doesn't need updating every time we obsolete old tests.
     23 Services.prefs.setIntPref("browser.migration.version", 1);
     24 
     25 add_task(async function test_no_errors() {
     26  // Simulate a migration.
     27  gBrowserGlue.observe(
     28    null,
     29    TOPIC_BROWSERGLUE_TEST,
     30    TOPICDATA_BROWSERGLUE_TEST
     31  );
     32 
     33  Assert.ok(true, "should have run the migration with no errors");
     34 });