mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1040048 - Register the OpenH264 plugin from the OpenH264Provider on startup. r=bsmedberg
This commit is contained in:
parent
1f8256d89b
commit
878a5c8998
@ -161,6 +161,11 @@ let OpenH264Provider = {
|
||||
Services.obs.addObserver(this, AddonManager.OPTIONS_NOTIFICATION_DISPLAYED, false);
|
||||
prefs.observe(OPENH264_PREF_ENABLED, this.onPrefEnabledChanged, this);
|
||||
prefs.observe(OPENH264_PREF_PATH, this.onPrefPathChanged, this);
|
||||
|
||||
this.gmpPath = prefs.get(OPENH264_PREF_PATH, null);
|
||||
if (this.gmpPath) {
|
||||
gmpService.addPluginDirectory(this.gmpPath);
|
||||
}
|
||||
},
|
||||
|
||||
shutdown: function() {
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
"use strict";
|
||||
|
||||
const Ci = Components.interfaces;
|
||||
const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
|
||||
|
||||
const OPENH264_PLUGIN_ID = "openh264-plugin@cisco.com";
|
||||
const OPENH264_PREF_BRANCH = "media.openh264.";
|
||||
@ -146,3 +146,49 @@ add_task(function* test_autoUpdatePrefPersistance() {
|
||||
addon.applyBackgroundUpdates = AddonManager.AUTOUPDATE_DEFAULT;
|
||||
Assert.ok(!prefs.prefHasUserValue(OPENH264_PREF_AUTOUPDATE));
|
||||
});
|
||||
|
||||
add_task(function* test_pluginRegistration() {
|
||||
let file = Services.dirsvc.get("ProfD", Ci.nsIFile);
|
||||
file.append("openh264");
|
||||
file.append("testDir");
|
||||
|
||||
let addedPath = null
|
||||
let removedPath = null;
|
||||
let clearPaths = () => addedPath = removedPath = null;
|
||||
|
||||
let MockGMPService = {
|
||||
addPluginDirectory: path => addedPath = path,
|
||||
removePluginDirectory: path => removedPath = path,
|
||||
};
|
||||
|
||||
let OpenH264Scope = Cu.import("resource://gre/modules/addons/OpenH264Provider.jsm");
|
||||
OpenH264Scope.gmpService = MockGMPService;
|
||||
|
||||
// Check that the OpenH264 plugin gets registered after startup.
|
||||
Services.prefs.setCharPref(OPENH264_PREF_PATH, file.path);
|
||||
clearPaths();
|
||||
yield promiseRestartManager();
|
||||
Assert.equal(addedPath, file.path);
|
||||
Assert.equal(removedPath, null);
|
||||
|
||||
// Check that clearing the path doesn't trigger registration.
|
||||
clearPaths();
|
||||
Services.prefs.clearUserPref(OPENH264_PREF_PATH);
|
||||
Assert.equal(addedPath, null);
|
||||
Assert.equal(removedPath, file.path);
|
||||
|
||||
// Restarting with no path set should not trigger registration.
|
||||
clearPaths();
|
||||
yield promiseRestartManager();
|
||||
Assert.equal(addedPath, null);
|
||||
Assert.equal(removedPath, null);
|
||||
|
||||
// Changing the pref mid-session should cause unregistration and registration.
|
||||
Services.prefs.setCharPref(OPENH264_PREF_PATH, file.path);
|
||||
clearPaths();
|
||||
let file2 = file.clone();
|
||||
file2.append("foo");
|
||||
Services.prefs.setCharPref(OPENH264_PREF_PATH, file2.path);
|
||||
Assert.equal(addedPath, file2.path);
|
||||
Assert.equal(removedPath, file.path);
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user