function createSiteSettingsPrefs(defaultsList, exceptionsList) {
    // These test defaults reflect the actual defaults assigned to each
    // ContentSettingType, but keeping these in sync shouldn't matter for tests.
    const defaults = {};
    for (let type in settings.ContentSettingsTypes) {
      defaults[settings.ContentSettingsTypes[type]] =
          createDefaultContentSetting({});
    }
    defaults[settings.ContentSettingsTypes.COOKIES].setting =
        settings.ContentSetting.ALLOW;
    defaults[settings.ContentSettingsTypes.IMAGES].setting =
        settings.ContentSetting.ALLOW;
    defaults[settings.ContentSettingsTypes.JAVASCRIPT].setting =
        settings.ContentSetting.ALLOW;
    defaults[settings.ContentSettingsTypes.SOUND].setting =
        settings.ContentSetting.ALLOW;
    defaults[settings.ContentSettingsTypes.POPUPS].setting =
        settings.ContentSetting.BLOCK;
    defaults[settings.ContentSettingsTypes.PROTOCOL_HANDLERS].setting =
        settings.ContentSetting.ALLOW;
    defaults[settings.ContentSettingsTypes.BACKGROUND_SYNC].setting =
        settings.ContentSetting.ALLOW;
    defaults[settings.ContentSettingsTypes.ADS].setting =
        settings.ContentSetting.BLOCK;
    defaults[settings.ContentSettingsTypes.SENSORS].setting =
        settings.ContentSetting.ALLOW;
    defaults[settings.ContentSettingsTypes.USB_DEVICES].setting =
        settings.ContentSetting.ASK;
    defaultsList.forEach((override) => {
      defaults[override.setting] = override.value;
    });

    const exceptions = {};
    for (let type in settings.ContentSettingsTypes) {
      exceptions[settings.ContentSettingsTypes[type]] = [];
    }
    exceptionsList.forEach((override) => {
      exceptions[override.setting] = override.value;
    });

    return {
      defaults: defaults,
      exceptions: exceptions,
    };
  }
/**
   * Helper to create a mock SiteSettingsPref.
   * @param {!Array<{setting: settings.ContentSettingsTypes,
   *                 value: DefaultContentSetting}>} defaultsList A list of
   *     DefaultContentSettings and the content settings they apply to, which
   *     will overwrite the defaults in the SiteSettingsPref returned by this
   *     function.
   * @param {!Array<{setting: settings.ContentSettingsTypes,
   *                 value: !Array<RawSiteException>}>} exceptionsList A list of
   *     RawSiteExceptions and the content settings they apply to, which will
   *     overwrite the exceptions in the SiteSettingsPref returned by this
   *     function.
   * @return {SiteSettingsPref}
   */
Helper to create a mock SiteSettingsPref.
@param {!Array<{setting: settings.ContentSettingsTypes,
value: DefaultContentSetting}>} defaultsList A list of
DefaultContentSettings and the content settings they apply to, which
will overwrite the defaults in the SiteSettingsPref returned by this
function.
@param {!Array<{setting: settings.ContentSettingsTypes,
value: !Array}>} exceptionsList A list of
RawSiteExceptions and the content settings they apply to, which will
overwrite the exceptions in the SiteSettingsPref returned by this
function.
Helper to create a mock SiteSettingsPref . @param { !Array< { setting : settings . ContentSettingsTypes value : DefaultContentSetting } > } defaultsList A list of DefaultContentSettings and the content settings they apply to which will overwrite the defaults in the SiteSettingsPref returned by this function . @param { !Array< { setting : settings . ContentSettingsTypes value : !Array } > } exceptionsList A list of RawSiteExceptions and the content settings they apply to which will overwrite the exceptions in the SiteSettingsPref returned by this function .
function createSiteSettingsPrefs(defaultsList, exceptionsList) {
    const defaults = {};
    for (let type in settings.ContentSettingsTypes) {
      defaults[settings.ContentSettingsTypes[type]] =
          createDefaultContentSetting({});
    }
    defaults[settings.ContentSettingsTypes.COOKIES].setting =
        settings.ContentSetting.ALLOW;
    defaults[settings.ContentSettingsTypes.IMAGES].setting =
        settings.ContentSetting.ALLOW;
    defaults[settings.ContentSettingsTypes.JAVASCRIPT].setting =
        settings.ContentSetting.ALLOW;
    defaults[settings.ContentSettingsTypes.SOUND].setting =
        settings.ContentSetting.ALLOW;
    defaults[settings.ContentSettingsTypes.POPUPS].setting =
        settings.ContentSetting.BLOCK;
    defaults[settings.ContentSettingsTypes.PROTOCOL_HANDLERS].setting =
        settings.ContentSetting.ALLOW;
    defaults[settings.ContentSettingsTypes.BACKGROUND_SYNC].setting =
        settings.ContentSetting.ALLOW;
    defaults[settings.ContentSettingsTypes.ADS].setting =
        settings.ContentSetting.BLOCK;
    defaults[settings.ContentSettingsTypes.SENSORS].setting =
        settings.ContentSetting.ALLOW;
    defaults[settings.ContentSettingsTypes.USB_DEVICES].setting =
        settings.ContentSetting.ASK;
    defaultsList.forEach((override) => {
      defaults[override.setting] = override.value;
    });
    const exceptions = {};
    for (let type in settings.ContentSettingsTypes) {
      exceptions[settings.ContentSettingsTypes[type]] = [];
    }
    exceptionsList.forEach((override) => {
      exceptions[override.setting] = override.value;
    });
    return {
      defaults: defaults,
      exceptions: exceptions,
    };
  }
function createSiteSettingsPrefs ( defaultsList , exceptionsList ) { const defaults = { } ; for ( let type in settings . ContentSettingsTypes ) { defaults [ settings . ContentSettingsTypes [ type ] ] = createDefaultContentSetting ( { } ) ; } defaults [ settings . ContentSettingsTypes . COOKIES ] . setting = settings . ContentSetting . ALLOW ; defaults [ settings . ContentSettingsTypes . IMAGES ] . setting = settings . ContentSetting . ALLOW ; defaults [ settings . ContentSettingsTypes . JAVASCRIPT ] . setting = settings . ContentSetting . ALLOW ; defaults [ settings . ContentSettingsTypes . SOUND ] . setting = settings . ContentSetting . ALLOW ; defaults [ settings . ContentSettingsTypes . POPUPS ] . setting = settings . ContentSetting . BLOCK ; defaults [ settings . ContentSettingsTypes . PROTOCOL_HANDLERS ] . setting = settings . ContentSetting . ALLOW ; defaults [ settings . ContentSettingsTypes . BACKGROUND_SYNC ] . setting = settings . ContentSetting . ALLOW ; defaults [ settings . ContentSettingsTypes . ADS ] . setting = settings . ContentSetting . BLOCK ; defaults [ settings . ContentSettingsTypes . SENSORS ] . setting = settings . ContentSetting . ALLOW ; defaults [ settings . ContentSettingsTypes . USB_DEVICES ] . setting = settings . ContentSetting . ASK ; defaultsList . forEach ( ( override ) => { defaults [ override . setting ] = override . value ; } ) ; const exceptions = { } ; for ( let type in settings . ContentSettingsTypes ) { exceptions [ settings . ContentSettingsTypes [ type ] ] = [ ] ; } exceptionsList . forEach ( ( override ) => { exceptions [ override . setting ] = override . value ; } ) ; return { defaults : defaults , exceptions : exceptions , } ; }
Helper to create a mock SiteSettingsPref.
Helper to create a mock SiteSettingsPref .
// These test defaults reflect the actual defaults assigned to each // ContentSettingType, but keeping these in sync shouldn't matter for tests.