@Test public void shouldInstallExtensionFromZip() throws IOException { FirefoxProfile profile = new FirefoxProfile(); profile.addExtension(InProject.locate(FIREBUG_PATH)); File profileDir = profile.layoutOnDisk(); File extensionDir = new File(profileDir, "extensions/[email protected]"); assertTrue(extensionDir.exists()); }
@Test public void shouldInstallExtensionUsingClasspath() throws IOException { FirefoxProfile profile = new FirefoxProfile(); profile.addExtension( FirefoxProfileTest.class, "/org/openqa/selenium/testing/drivers/firebug-1.5.0-fx.xpi"); File profileDir = profile.layoutOnDisk(); File extensionDir = new File(profileDir, "extensions/[email protected]"); assertTrue(extensionDir.exists()); }
@Test public void shouldInstallExtensionFromDirectory() throws IOException { FirefoxProfile profile = new FirefoxProfile(); File extension = InProject.locate(FIREBUG_PATH); File unzippedExtension = FileHandler.unzip(new FileInputStream(extension)); profile.addExtension(unzippedExtension); File profileDir = profile.layoutOnDisk(); File extensionDir = new File(profileDir, "extensions/[email protected]"); assertTrue(extensionDir.exists()); }
private List<String> readGeneratedProperties(FirefoxProfile profile) throws Exception { File generatedProfile = profile.layoutOnDisk(); File prefs = new File(generatedProfile, "user.js"); BufferedReader reader = new BufferedReader(new FileReader(prefs)); List<String> prefLines = new ArrayList<String>(); for (String line = reader.readLine(); line != null; line = reader.readLine()) { prefLines.add(line); } reader.close(); return prefLines; }
private Preferences parseUserPrefs(FirefoxProfile profile) throws IOException { File directory = profile.layoutOnDisk(); File userPrefs = new File(directory, "user.js"); FileReader reader = new FileReader(userPrefs); return new Preferences(new StringReader("{\"mutable\": {}, \"frozen\": {}}"), reader); }