tor-browser

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

test_quicksuggest_migrate_v6.js (2831B)


      1 /* This Source Code Form is subject to the terms of the Mozilla Public
      2 * License, v. 2.0. If a copy of the MPL was not distributed with this
      3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      4 
      5 // Tests Suggest prefs migration from version 5 to 6.
      6 
      7 "use strict";
      8 
      9 const TO_VERSION = 6;
     10 
     11 add_setup(async () => {
     12  await setUpMigrateTest();
     13 });
     14 
     15 // No user-branch values set before migration
     16 add_task(async function () {
     17  await doMigrateTest({
     18    toVersion: TO_VERSION,
     19  });
     20 });
     21 
     22 // Nonsponsored false on the user branch before migration
     23 add_task(async function () {
     24  await doMigrateTest({
     25    toVersion: TO_VERSION,
     26    preMigrationUserPrefs: {
     27      "suggest.quicksuggest.nonsponsored": false,
     28    },
     29    expectedPostMigrationUserPrefs: {
     30      "suggest.quicksuggest.all": false,
     31      "suggest.quicksuggest.nonsponsored": false,
     32    },
     33  });
     34 });
     35 
     36 // Nonsponsored true on the user branch before migration
     37 add_task(async function () {
     38  await doMigrateTest({
     39    toVersion: TO_VERSION,
     40    preMigrationUserPrefs: {
     41      "suggest.quicksuggest.nonsponsored": true,
     42    },
     43    expectedPostMigrationUserPrefs: {
     44      "suggest.quicksuggest.all": true,
     45      "suggest.quicksuggest.nonsponsored": true,
     46    },
     47  });
     48 });
     49 
     50 // Nonsponsored and sponsored both false on the user branch before migration
     51 add_task(async function () {
     52  await doMigrateTest({
     53    toVersion: TO_VERSION,
     54    preMigrationUserPrefs: {
     55      "suggest.quicksuggest.nonsponsored": false,
     56      "suggest.quicksuggest.sponsored": false,
     57    },
     58    expectedPostMigrationUserPrefs: {
     59      "suggest.quicksuggest.all": false,
     60      "suggest.quicksuggest.nonsponsored": false,
     61      "suggest.quicksuggest.sponsored": false,
     62    },
     63  });
     64 });
     65 
     66 // Nonsponsored false sponsored true on the user branch before migration
     67 add_task(async function () {
     68  await doMigrateTest({
     69    toVersion: TO_VERSION,
     70    preMigrationUserPrefs: {
     71      "suggest.quicksuggest.nonsponsored": false,
     72      "suggest.quicksuggest.sponsored": true,
     73    },
     74    expectedPostMigrationUserPrefs: {
     75      "suggest.quicksuggest.all": false,
     76      "suggest.quicksuggest.nonsponsored": false,
     77      "suggest.quicksuggest.sponsored": true,
     78    },
     79  });
     80 });
     81 
     82 // Sponsored false on the user branch before migration
     83 add_task(async function () {
     84  await doMigrateTest({
     85    toVersion: TO_VERSION,
     86    preMigrationUserPrefs: {
     87      "suggest.quicksuggest.sponsored": false,
     88    },
     89    expectedPostMigrationUserPrefs: {
     90      "suggest.quicksuggest.sponsored": false,
     91    },
     92  });
     93 });
     94 
     95 // Sponsored true on the user branch before migration
     96 add_task(async function () {
     97  await doMigrateTest({
     98    toVersion: TO_VERSION,
     99    preMigrationUserPrefs: {
    100      "suggest.quicksuggest.sponsored": true,
    101    },
    102    expectedPostMigrationUserPrefs: {
    103      "suggest.quicksuggest.sponsored": true,
    104    },
    105  });
    106 });