function initTestParamsForFeature(feature, initiallyEnabled) {
    var list = initiallyEnabled ? observerTestState.toBeDisabled :
                                  observerTestState.toBeEnabled;

    var listener = function(ev) {
      // Fail the test in case the new feature value is not as expected, but
      // before that, do some cleanup.
      if (initiallyEnabled == ev.value)
        clearRemainingListeners();
      chrome.test.assertEq(!initiallyEnabled, ev.value);

      var index = findFeatureIndex(list, feature);
      if (index < 0)
        clearRemaningListeners();
      chrome.test.assertTrue(index > -1);

      chrome.accessibilityFeatures[feature].onChange.removeListener(
          list[index].listener);
      list.splice(index, 1);

      if (observerTestState.toBeEnabled.length == 0 &&
          observerTestState.toBeDisabled.length == 0) {
        chrome.test.succeed();
      }
    }

    list.push({name: feature, listener: listener});
    chrome.accessibilityFeatures[feature].onChange.addListener(listener);
  }
/**
   * Initializes listener for a feature and adds it to the appropriate list in
   * {@code observerTestState}.
   * @param {string} feature The feature name.
   * @param {boolean} initiallyEnabled Whether the feature is initially enabled.
   */
Initializes listener for a feature and adds it to the appropriate list in
observerTestState.
@param {string} feature The feature name.
@param {boolean} initiallyEnabled Whether the feature is initially enabled.
Initializes listener for a feature and adds it to the appropriate list in observerTestState . @param { string } feature The feature name . @param { boolean } initiallyEnabled Whether the feature is initially enabled .
function initTestParamsForFeature(feature, initiallyEnabled) {
    var list = initiallyEnabled ? observerTestState.toBeDisabled :
                                  observerTestState.toBeEnabled;
    var listener = function(ev) {
      if (initiallyEnabled == ev.value)
        clearRemainingListeners();
      chrome.test.assertEq(!initiallyEnabled, ev.value);
      var index = findFeatureIndex(list, feature);
      if (index < 0)
        clearRemaningListeners();
      chrome.test.assertTrue(index > -1);
      chrome.accessibilityFeatures[feature].onChange.removeListener(
          list[index].listener);
      list.splice(index, 1);
      if (observerTestState.toBeEnabled.length == 0 &&
          observerTestState.toBeDisabled.length == 0) {
        chrome.test.succeed();
      }
    }
    list.push({name: feature, listener: listener});
    chrome.accessibilityFeatures[feature].onChange.addListener(listener);
  }
function initTestParamsForFeature ( feature , initiallyEnabled ) { var list = initiallyEnabled ? observerTestState . toBeDisabled : observerTestState . toBeEnabled ; var listener = function ( ev ) { if ( initiallyEnabled == ev . value ) clearRemainingListeners ( ) ; chrome . test . assertEq ( ! initiallyEnabled , ev . value ) ; var index = findFeatureIndex ( list , feature ) ; if ( index < 0 ) clearRemaningListeners ( ) ; chrome . test . assertTrue ( index > - 1 ) ; chrome . accessibilityFeatures [ feature ] . onChange . removeListener ( list [ index ] . listener ) ; list . splice ( index , 1 ) ; if ( observerTestState . toBeEnabled . length == 0 && observerTestState . toBeDisabled . length == 0 ) { chrome . test . succeed ( ) ; } } list . push ( { name : feature , listener : listener } ) ; chrome . accessibilityFeatures [ feature ] . onChange . addListener ( listener ) ; }
Initializes listener for a feature and adds it to the appropriate list in
 {@code observerTestState}.
Initializes listener for a feature and adds it to the appropriate list in { @code observerTestState } .
// Fail the test in case the new feature value is not as expected, but // before that, do some cleanup.