test_quicksuggest_migrate_v2.js (2206B)
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 1 to 2. 6 7 "use strict"; 8 9 const TO_VERSION = 2; 10 11 add_setup(async () => { 12 await setUpMigrateTest(); 13 }); 14 15 // No user-branch values set 16 add_task(async function () { 17 await doMigrateTest({ 18 toVersion: TO_VERSION, 19 }); 20 }); 21 22 // Migrating from offline scenario 23 add_task(async function () { 24 await doMigrateTest({ 25 toVersion: TO_VERSION, 26 preMigrationUserPrefs: { 27 "quicksuggest.scenario": "offline", 28 }, 29 expectedPostMigrationUserPrefs: { 30 "quicksuggest.scenario": "offline", 31 }, 32 }); 33 }); 34 35 // Migrating from offline scenario, no user prefs set 36 add_task(async function () { 37 await doMigrateTest({ 38 toVersion: TO_VERSION, 39 preMigrationUserPrefs: { 40 "quicksuggest.scenario": "online", 41 }, 42 expectedPostMigrationUserPrefs: { 43 "quicksuggest.scenario": "online", 44 "suggest.quicksuggest.nonsponsored": false, 45 "suggest.quicksuggest.sponsored": false, 46 }, 47 }); 48 }); 49 50 // Migrating from offline scenario, sponsored/nonsponsored set to false 51 add_task(async function () { 52 await doMigrateTest({ 53 toVersion: TO_VERSION, 54 preMigrationUserPrefs: { 55 "quicksuggest.scenario": "online", 56 "suggest.quicksuggest.nonsponsored": false, 57 "suggest.quicksuggest.sponsored": false, 58 }, 59 expectedPostMigrationUserPrefs: { 60 "quicksuggest.scenario": "online", 61 "suggest.quicksuggest.nonsponsored": false, 62 "suggest.quicksuggest.sponsored": false, 63 }, 64 }); 65 }); 66 67 // Migrating from offline scenario, sponsored/nonsponsored set to true 68 add_task(async function () { 69 await doMigrateTest({ 70 toVersion: TO_VERSION, 71 preMigrationUserPrefs: { 72 "quicksuggest.scenario": "online", 73 "suggest.quicksuggest.nonsponsored": true, 74 "suggest.quicksuggest.sponsored": true, 75 }, 76 expectedPostMigrationUserPrefs: { 77 "quicksuggest.scenario": "online", 78 "suggest.quicksuggest.nonsponsored": true, 79 "suggest.quicksuggest.sponsored": true, 80 }, 81 }); 82 });