public void testsSelectedEnginesNoHistoryNorForms() { SharedPreferences prefs = getPrefs(TEST_PREFS_NAME, 0); // Store engines, excluding history/forms special case. Map<String, Boolean> storedEngines = new HashMap<String, Boolean>(); storedEngines.put("forms", true); SyncConfiguration.storeSelectedEnginesToPrefs(prefs, storedEngines); // Read values from selectedEngines. assertTrue(prefs.contains(SyncConfiguration.PREF_USER_SELECTED_ENGINES_TO_SYNC)); SyncConfiguration config = null; config = new SyncConfiguration(TEST_PREFS_NAME, this); config.loadFromPrefs(prefs); // Forms should not be selected if history is not present. assertTrue(config.userSelectedEngines.isEmpty()); }
/** Tests dependency of forms engine on history engine. */ public void testSelectedEnginesHistoryAndForms() { SharedPreferences prefs = getPrefs(TEST_PREFS_NAME, 0); // Store engines, excluding history/forms special case. Map<String, Boolean> storedEngines = new HashMap<String, Boolean>(); storedEngines.put("history", true); SyncConfiguration.storeSelectedEnginesToPrefs(prefs, storedEngines); // Expected engines. storedEngines.put("forms", true); // Read values from selectedEngines. assertTrue(prefs.contains(SyncConfiguration.PREF_USER_SELECTED_ENGINES_TO_SYNC)); SyncConfiguration config = null; config = new SyncConfiguration(TEST_PREFS_NAME, this); config.loadFromPrefs(prefs); assertEquals(storedEngines, config.userSelectedEngines); }