tor-browser

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

test_IE_bookmarks.js (1094B)


      1 "use strict";
      2 
      3 add_task(async function () {
      4  let migrator = await MigrationUtils.getMigrator("ie");
      5  // Sanity check for the source.
      6  Assert.ok(await migrator.isSourceAvailable(), "Check migrator source");
      7 
      8  // Since this test doesn't mock out the favorites, execution is dependent
      9  // on the actual favorites stored on the local machine's IE favorites database.
     10  // As such, we can't assert that bookmarks were migrated to both the bookmarks
     11  // menu and the bookmarks toolbar.
     12  let itemCount = 0;
     13  let listener = events => {
     14    for (let event of events) {
     15      if (event.itemType == PlacesUtils.bookmarks.TYPE_BOOKMARK) {
     16        info("bookmark added: " + event.parentGuid);
     17        itemCount++;
     18      }
     19    }
     20  };
     21  PlacesUtils.observers.addListener(["bookmark-added"], listener);
     22 
     23  await promiseMigration(migrator, MigrationUtils.resourceTypes.BOOKMARKS);
     24  PlacesUtils.observers.removeListener(["bookmark-added"], listener);
     25  Assert.equal(
     26    MigrationUtils._importQuantities.bookmarks,
     27    itemCount,
     28    "Ensure telemetry matches actual number of imported items."
     29  );
     30 });