Bug 1045209 - Updating tests for new OpenH264 plugin path handling. r=unfocused, r=ted, r=jmaher, a=sledru
authorQeole <qeole@outlook.com>
Mon, 25 Aug 2014 17:23:34 +0200
changeset 209609 ec5f67c9d71260c2334a548c5e340af79331e466
parent 209608 93fa2a38c5d54ad97470bbd0f8639b153cc57175
child 209610 84bdca67fffedf5f9a313e2ff23b5921826c4fd3
push idunknown
push userunknown
push dateunknown
reviewersunfocused, ted, jmaher, sledru
bugs1045209
milestone33.0a2
Bug 1045209 - Updating tests for new OpenH264 plugin path handling. r=unfocused, r=ted, r=jmaher, a=sledru
dom/media/gmp-plugin/Makefile.in
testing/mochitest/Makefile.in
testing/mochitest/mach_commands.py
testing/mochitest/runtests.py
toolkit/modules/tests/xpcshell/test_GMPInstallManager.js
toolkit/mozapps/extensions/test/browser/browser_openH264.js
toolkit/mozapps/extensions/test/xpcshell/test_openh264.js
--- a/dom/media/gmp-plugin/Makefile.in
+++ b/dom/media/gmp-plugin/Makefile.in
@@ -1,12 +1,12 @@
 #
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 INSTALL_TARGETS += FAKE_GMP_PLUGIN
-FAKE_GMP_PLUGIN_DEST = $(DEPTH)/dist/bin/gmp-fake
+FAKE_GMP_PLUGIN_DEST = $(DEPTH)/dist/bin/gmp-fake/1.0
 FAKE_GMP_PLUGIN_FILES = \
   $(SHARED_LIBRARY) \
   $(srcdir)/fake.info
 
 include $(topsrcdir)/config/rules.mk
--- a/testing/mochitest/Makefile.in
+++ b/testing/mochitest/Makefile.in
@@ -171,17 +171,17 @@ GMP_TEST_FILES := \
 # Rules for staging the necessary harness bits for a test package
 PKG_STAGE = $(DIST)/test-stage
 DIST_BIN = $(DIST)/bin
 
 $(_DEST_DIR):
 	$(NSINSTALL) -D $@
 
 stage-package:
-	$(NSINSTALL) -D $(PKG_STAGE)/mochitest && $(NSINSTALL) -D $(PKG_STAGE)/bin/plugins && $(NSINSTALL) -D $(DIST)/plugins && $(NSINSTALL) -D $(PKG_STAGE)/bin/plugins/gmp-fake
+	$(NSINSTALL) -D $(PKG_STAGE)/mochitest && $(NSINSTALL) -D $(PKG_STAGE)/bin/plugins && $(NSINSTALL) -D $(DIST)/plugins && $(NSINSTALL) -D $(PKG_STAGE)/bin/plugins/gmp-fake/1.0
 	cp $(DEPTH)/mozinfo.json $(PKG_STAGE)/mochitest
 	(cd $(DEPTH)/_tests/testing && tar $(TAR_CREATE_FLAGS) - mochitest) | (cd $(PKG_STAGE) && tar -xf -)
 	@cp $(DEPTH)/mozinfo.json $(PKG_STAGE)/mochitest
 	@(cd $(DIST_BIN) && tar $(TAR_CREATE_FLAGS) - $(TEST_HARNESS_BINS)) | (cd $(PKG_STAGE)/bin && tar -xf -)
 	@(cd $(DIST_BIN)/components && tar $(TAR_CREATE_FLAGS) - $(TEST_HARNESS_COMPONENTS)) | (cd $(PKG_STAGE)/bin/components && tar -xf -)
 	(cd $(topsrcdir)/build/pgo && tar $(TAR_CREATE_FLAGS) - certs) | (cd $(PKG_STAGE) && tar -xf -)
 	@(cd $(DIST)/plugins && tar $(TAR_CREATE_FLAGS) - $(TEST_HARNESS_PLUGINS)) | (cd $(PKG_STAGE)/bin/plugins && tar -xf -)
-	$(foreach x,$(GMP_TEST_FILES),cp $(x) $(PKG_STAGE)/bin/plugins/gmp-fake;)
+	$(foreach x,$(GMP_TEST_FILES),cp $(x) $(PKG_STAGE)/bin/plugins/gmp-fake/1.0;)
--- a/testing/mochitest/mach_commands.py
+++ b/testing/mochitest/mach_commands.py
@@ -360,17 +360,17 @@ class MochitestRunner(MozbuildObject):
         if app_override:
             if app_override == "dist":
                 options.app = self.get_binary_path(where='staged-package')
             elif app_override:
                 options.app = app_override
             if options.gmp_path is None:
                 # Need to fix the location of gmp_fake which might not be shipped in the binary
                 bin_path = self.get_binary_path()
-                options.gmp_path = os.path.join(os.path.dirname(bin_path), 'gmp-fake')
+                options.gmp_path = os.path.join(os.path.dirname(bin_path), 'gmp-fake', '1.0')
 
 
         logger_options = {key: value for key, value in vars(options).iteritems() if key.startswith('log')}
         runner = mochitest.Mochitest(logger_options)
         options = opts.verifyOptions(options, runner)
 
         if options is None:
             raise Exception('mochitest option validator failed.')
--- a/testing/mochitest/runtests.py
+++ b/testing/mochitest/runtests.py
@@ -1156,22 +1156,22 @@ class Mochitest(MochitestUtilsMixin):
 
     return manifest
 
   def getGMPPluginPath(self, options):
     if options.gmp_path:
       return options.gmp_path
 
     # For local builds, gmp-fake will be under dist/bin.
-    gmp_path = os.path.join(options.xrePath, 'gmp-fake')
+    gmp_path = os.path.join(options.xrePath, 'gmp-fake', '1.0')
     if os.path.isdir(gmp_path):
       return gmp_path
 
     # For packaged builds, gmp-fake will get copied under $profile/plugins.
-    gmp_path = os.path.join(self.profile.profile, 'plugins', 'gmp-fake')
+    gmp_path = os.path.join(self.profile.profile, 'plugins', 'gmp-fake', '1.0')
     if os.path.isdir(gmp_path):
       return gmp_path
     # This is fatal for desktop environments.
     raise EnvironmentError('Could not find gmp-fake')
 
   def buildBrowserEnv(self, options, debugger=False):
     """build the environment variables for the specific test and operating system"""
     if mozinfo.info["asan"]:
--- a/toolkit/modules/tests/xpcshell/test_GMPInstallManager.js
+++ b/toolkit/modules/tests/xpcshell/test_GMPInstallManager.js
@@ -24,33 +24,29 @@ function run_test() {Cu.import("resource
  */
 add_test(function test_prefs() {
   let addon1 = "addon1", addon2 = "addon2";
 
   GMPPrefs.set(GMPPrefs.KEY_LOG_ENABLED, true);
   GMPPrefs.set(GMPPrefs.KEY_URL, "http://not-really-used");
   GMPPrefs.set(GMPPrefs.KEY_URL_OVERRIDE, "http://not-really-used-2");
   GMPPrefs.set(GMPPrefs.KEY_ADDON_LAST_UPDATE, "1", addon1);
-  GMPPrefs.set(GMPPrefs.KEY_ADDON_PATH, "2", addon1);
-  GMPPrefs.set(GMPPrefs.KEY_ADDON_VERSION, "3", addon1);
-  GMPPrefs.set(GMPPrefs.KEY_ADDON_LAST_UPDATE, "4", addon2);
-  GMPPrefs.set(GMPPrefs.KEY_ADDON_PATH, "5", addon2);
-  GMPPrefs.set(GMPPrefs.KEY_ADDON_VERSION, "6", addon2);
+  GMPPrefs.set(GMPPrefs.KEY_ADDON_VERSION, "2", addon1);
+  GMPPrefs.set(GMPPrefs.KEY_ADDON_LAST_UPDATE, "3", addon2);
+  GMPPrefs.set(GMPPrefs.KEY_ADDON_VERSION, "4", addon2);
   GMPPrefs.set(GMPPrefs.KEY_ADDON_AUTOUPDATE, false, addon2);
   GMPPrefs.set(GMPPrefs.KEY_CERT_CHECKATTRS, true);
 
   do_check_true(GMPPrefs.get(GMPPrefs.KEY_LOG_ENABLED));
   do_check_eq(GMPPrefs.get(GMPPrefs.KEY_URL), "http://not-really-used");
   do_check_eq(GMPPrefs.get(GMPPrefs.KEY_URL_OVERRIDE), "http://not-really-used-2");
   do_check_eq(GMPPrefs.get(GMPPrefs.KEY_ADDON_LAST_UPDATE, addon1), "1");
-  do_check_eq(GMPPrefs.get(GMPPrefs.KEY_ADDON_PATH, addon1), "2");
-  do_check_eq(GMPPrefs.get(GMPPrefs.KEY_ADDON_VERSION, addon1), "3");
-  do_check_eq(GMPPrefs.get(GMPPrefs.KEY_ADDON_LAST_UPDATE, addon2), "4");
-  do_check_eq(GMPPrefs.get(GMPPrefs.KEY_ADDON_PATH, addon2), "5");
-  do_check_eq(GMPPrefs.get(GMPPrefs.KEY_ADDON_VERSION, addon2), "6");
+  do_check_eq(GMPPrefs.get(GMPPrefs.KEY_ADDON_VERSION, addon1), "2");
+  do_check_eq(GMPPrefs.get(GMPPrefs.KEY_ADDON_LAST_UPDATE, addon2), "3");
+  do_check_eq(GMPPrefs.get(GMPPrefs.KEY_ADDON_VERSION, addon2), "4");
   do_check_eq(GMPPrefs.get(GMPPrefs.KEY_ADDON_AUTOUPDATE, addon2), false);
   do_check_true(GMPPrefs.get(GMPPrefs.KEY_CERT_CHECKATTRS));
   GMPPrefs.set(GMPPrefs.KEY_ADDON_AUTOUPDATE, true, addon2);
   run_next_test();
 });
 
 /**
  * Tests that an uninit without a check works fine
@@ -430,29 +426,27 @@ function test_checkForAddons_installAddo
 
       let extractedFile = Cc["@mozilla.org/file/local;1"].
                           createInstance(Ci.nsIFile);
       extractedFile.initWithPath(extractedPath);
       do_check_true(extractedFile.exists());
       let readData = readStringFromFile(extractedFile);
       do_check_eq(readData, data);
 
-      // Check that the downloaded zip mathces the offered zip exactly
+      // Check that the downloaded zip matches the offered zip exactly
       let downloadedGMPFile = FileUtils.getFile("TmpD",
         [gmpAddon.id + ".zip"]);
       do_check_true(downloadedGMPFile.exists());
       let downloadedBytes = getBinaryFileData(downloadedGMPFile);
       let sourceBytes = getBinaryFileData(zipFile);
       do_check_true(compareBinaryData(downloadedBytes, sourceBytes));
 
       // Make sure the prefs are set correctly
       do_check_true(!!GMPPrefs.get(GMPPrefs.KEY_ADDON_LAST_UPDATE,
                                    gmpAddon.id, ""));
-      do_check_eq(GMPPrefs.get(GMPPrefs.KEY_ADDON_PATH, gmpAddon.id, ""),
-                               extractedFile.parent.path);
       do_check_eq(GMPPrefs.get(GMPPrefs.KEY_ADDON_VERSION, gmpAddon.id, ""),
                                "1.1");
       // Make sure it reports as being installed
       do_check_true(gmpAddon.isInstalled);
 
       // Cleanup
       extractedFile.parent.remove(true);
       zipFile.remove(false);
--- a/toolkit/mozapps/extensions/test/browser/browser_openH264.js
+++ b/toolkit/mozapps/extensions/test/browser/browser_openH264.js
@@ -6,17 +6,16 @@
 
 Cu.import("resource://gre/modules/Promise.jsm");
 let {AddonTestUtils} = Cu.import("resource://testing-common/AddonManagerTesting.jsm", {});
 let OpenH264Scope = Cu.import("resource://gre/modules/addons/OpenH264Provider.jsm");
 
 const OPENH264_PLUGIN_ID       = "gmp-gmpopenh264";
 const OPENH264_PREF_BRANCH     = "media." + OPENH264_PLUGIN_ID + ".";
 const OPENH264_PREF_ENABLED    = OPENH264_PREF_BRANCH + "enabled";
-const OPENH264_PREF_PATH       = OPENH264_PREF_BRANCH + "path";
 const OPENH264_PREF_VERSION    = OPENH264_PREF_BRANCH + "version";
 const OPENH264_PREF_LASTUPDATE = OPENH264_PREF_BRANCH + "lastUpdate";
 const OPENH264_PREF_AUTOUPDATE = OPENH264_PREF_BRANCH + "autoupdate";
 const PREF_LOGGING             = OPENH264_PREF_BRANCH + "provider.logging";
 const PREF_LOGGING_LEVEL       = PREF_LOGGING + ".level";
 const PREF_LOGGING_DUMP        = PREF_LOGGING + ".dump";
 const GMP_PREF_LASTCHECK       = "media.gmp-manager.lastCheck";
 const GMP_PREF_LOG             = "media.gmp-manager.log";
@@ -94,37 +93,35 @@ add_task(function* initializeState() {
 
   gManagerWindow = yield open_manager();
   gCategoryUtilities = new CategoryUtilities(gManagerWindow);
 
   registerCleanupFunction(() => {
     Services.obs.removeObserver(gOptionsObserver, AddonManager.OPTIONS_NOTIFICATION_DISPLAYED);
 
     Services.prefs.clearUserPref(OPENH264_PREF_ENABLED);
-    Services.prefs.clearUserPref(OPENH264_PREF_PATH);
     Services.prefs.clearUserPref(OPENH264_PREF_VERSION);
     Services.prefs.clearUserPref(OPENH264_PREF_LASTUPDATE);
     Services.prefs.clearUserPref(OPENH264_PREF_AUTOUPDATE);
     Services.prefs.clearUserPref(PREF_LOGGING_DUMP);
     Services.prefs.clearUserPref(PREF_LOGGING_LEVEL);
     Services.prefs.clearUserPref(GMP_PREF_LOG);
     Services.prefs.clearUserPref(GMP_PREF_LASTCHECK);
   });
 
   let chrome = Cc["@mozilla.org/chrome/chrome-registry;1"].getService(Ci.nsIXULChromeRegistry);
   gIsEnUsLocale = chrome.getSelectedLocale("global") == "en-US";
 
   Services.obs.addObserver(gOptionsObserver, AddonManager.OPTIONS_NOTIFICATION_DISPLAYED, false);
 
   // Start out with OpenH264 not being installed, disabled and automatic updates disabled.
   Services.prefs.setBoolPref(OPENH264_PREF_ENABLED, false);
+  Services.prefs.setIntPref (OPENH264_PREF_LASTUPDATE, 0);
+  Services.prefs.setBoolPref(OPENH264_PREF_AUTOUPDATE, false);
   Services.prefs.setCharPref(OPENH264_PREF_VERSION, "");
-  Services.prefs.setCharPref(OPENH264_PREF_LASTUPDATE, "");
-  Services.prefs.setBoolPref(OPENH264_PREF_AUTOUPDATE, false);
-  Services.prefs.setCharPref(OPENH264_PREF_PATH, "");
 });
 
 add_task(function* testNotInstalled() {
   Assert.ok(gCategoryUtilities.isTypeVisible("plugin"), "Plugin tab visible.");
   yield gCategoryUtilities.openType("plugin");
 
   let item = get_addon_element(gManagerWindow, OPENH264_PLUGIN_ID);
   Assert.ok(item, "Got add-on element.");
@@ -157,20 +154,19 @@ add_task(function* testNotInstalledDetai
   is_element_visible(el, "Find updates link is visible.");
   el = doc.getElementById("detail-warning");
   is_element_visible(el, "Warning notification is visible.");
   el = doc.getElementsByTagName("setting")[0];
 });
 
 add_task(function* testInstalled() {
   Services.prefs.setBoolPref(OPENH264_PREF_ENABLED, true);
-  Services.prefs.setBoolPref(OPENH264_PREF_VERSION, "1.2.3.4");
-  Services.prefs.setBoolPref(OPENH264_PREF_LASTUPDATE, "" + TEST_DATE.getTime());
+  Services.prefs.setIntPref (OPENH264_PREF_LASTUPDATE, TEST_DATE.getTime());
   Services.prefs.setBoolPref(OPENH264_PREF_AUTOUPDATE, false);
-  Services.prefs.setCharPref(OPENH264_PREF_PATH, "foo/bar");
+  Services.prefs.setCharPref(OPENH264_PREF_VERSION, "1.2.3.4");
 
   yield gCategoryUtilities.openType("plugin");
 
   let item = get_addon_element(gManagerWindow, OPENH264_PLUGIN_ID);
   Assert.ok(item, "Got add-on element.");
   item.parentNode.ensureElementIsVisible(item);
   is(item.getAttribute("active"), "true");
 
@@ -199,30 +195,27 @@ add_task(function* testInstalledDetails(
   el = doc.getElementById("detail-findUpdates-btn");
   is_element_visible(el, "Find updates link is visible.");
   el = doc.getElementById("detail-warning");
   is_element_hidden(el, "Warning notification is hidden.");
   el = doc.getElementsByTagName("setting")[0];
 });
 
 add_task(function* testPreferencesButton() {
-  let file = Services.dirsvc.get("ProfD", Ci.nsIFile);
-  file.append("openh264");
-  file.append("testDir");
 
   let prefValues = [
-    { enabled: false, path: "" },
-    { enabled: false, path: file.path },
-    { enabled: true, path: "" },
-    { enabled: true, path: file.path },
+    { enabled: false, version: "" },
+    { enabled: false, version: "1.2.3.4" },
+    { enabled: true, version: "" },
+    { enabled: true, version: "1.2.3.4" },
   ];
 
   for (let prefs of prefValues) {
     dump("Testing preferences button with pref settings: " + JSON.stringify(prefs) + "\n");
-    Services.prefs.setCharPref(OPENH264_PREF_PATH, prefs.path);
+    Services.prefs.setCharPref(OPENH264_PREF_VERSION, prefs.version);
     Services.prefs.setBoolPref(OPENH264_PREF_ENABLED, prefs.enabled);
 
     yield gCategoryUtilities.openType("plugin");
     let doc = gManagerWindow.document;
     let item = get_addon_element(gManagerWindow, OPENH264_PLUGIN_ID);
 
     let button = doc.getAnonymousElementByAttribute(item, "anonid", "preferences-btn");
     EventUtils.synthesizeMouseAtCenter(button, { clickCount: 1 }, gManagerWindow);
--- a/toolkit/mozapps/extensions/test/xpcshell/test_openh264.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_openh264.js
@@ -3,17 +3,16 @@
 
 "use strict";
 
 const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
 
 const OPENH264_PLUGIN_ID       = "gmp-gmpopenh264";
 const OPENH264_PREF_BRANCH     = "media." + OPENH264_PLUGIN_ID + ".";
 const OPENH264_PREF_ENABLED    = OPENH264_PREF_BRANCH + "enabled";
-const OPENH264_PREF_PATH       = OPENH264_PREF_BRANCH + "path";
 const OPENH264_PREF_VERSION    = OPENH264_PREF_BRANCH + "version";
 const OPENH264_PREF_LASTUPDATE = OPENH264_PREF_BRANCH + "lastUpdate";
 const OPENH264_PREF_AUTOUPDATE = OPENH264_PREF_BRANCH + "autoupdate";
 const PREF_LOGGING             = OPENH264_PREF_BRANCH + "provider.logging";
 const PREF_LOGGING_LEVEL       = PREF_LOGGING + ".level";
 const PREF_LOGGING_DUMP        = PREF_LOGGING + ".dump";
 const GMP_PREF_LASTCHECK       = "media.gmp-manager.lastCheck";
 const GMP_PREF_LOG             = "media.gmp-manager.log";
@@ -50,17 +49,17 @@ function run_test() {
   Services.prefs.setBoolPref(PREF_LOGGING_DUMP, true);
   Services.prefs.setIntPref(PREF_LOGGING_LEVEL, 0);
   Services.prefs.setBoolPref(GMP_PREF_LOG, true);
 
   run_next_test();
 }
 
 add_task(function* test_notInstalled() {
-  Services.prefs.setCharPref(OPENH264_PREF_PATH, "");
+  Services.prefs.setCharPref(OPENH264_PREF_VERSION, "");
   Services.prefs.setBoolPref(OPENH264_PREF_ENABLED, false);
 
   let addons = yield promiseAddonsByIDs([OPENH264_PLUGIN_ID]);
   Assert.equal(addons.length, 1);
   let addon = addons[0];
 
   Assert.ok(!addon.isInstalled);
   Assert.equal(addon.type, "plugin");
@@ -101,23 +100,22 @@ add_task(function* test_notInstalled() {
 });
 
 add_task(function* test_installed() {
   const TEST_DATE = new Date(2013, 0, 1, 12);
   const TEST_VERSION = "1.2.3.4";
   const TEST_TIME_SEC = Math.round(TEST_DATE.getTime() / 1000);
 
   let file = Services.dirsvc.get("ProfD", Ci.nsIFile);
-  file.append("openh264");
-  file.append("testDir");
+  file.append(OPENH264_PLUGIN_ID);
+  file.append(TEST_VERSION);
 
   Services.prefs.setBoolPref(OPENH264_PREF_ENABLED, false);
   Services.prefs.setCharPref(OPENH264_PREF_LASTUPDATE, "" + TEST_TIME_SEC);
   Services.prefs.setCharPref(OPENH264_PREF_VERSION, TEST_VERSION);
-  Services.prefs.setCharPref(OPENH264_PREF_PATH, file.path);
 
   let addons = yield promiseAddonsByIDs([OPENH264_PLUGIN_ID]);
   Assert.equal(addons.length, 1);
   let addon = addons[0];
 
   Assert.ok(addon.isInstalled);
   Assert.equal(addon.type, "plugin");
   let name = pluginsBundle.GetStringFromName("openH264_name");
@@ -134,17 +132,17 @@ add_task(function* test_installed() {
   Assert.equal(addon.updateDate.getTime(), TEST_TIME_SEC * 1000);
 
   let mimetypes = addon.pluginMimeTypes;
   Assert.ok(mimetypes);
   Assert.equal(mimetypes.length, 0);
   let libraries = addon.pluginLibraries;
   Assert.ok(libraries);
   Assert.equal(libraries.length, 1);
-  Assert.equal(libraries[0], "testDir");
+  Assert.equal(libraries[0], TEST_VERSION);
   let fullpath = addon.pluginFullpath;
   Assert.equal(fullpath.length, 1);
   Assert.equal(fullpath[0], file.path);
 });
 
 add_task(function* test_enable() {
   Services.prefs.setBoolPref(OPENH264_PREF_ENABLED, true);
 
@@ -174,63 +172,67 @@ add_task(function* test_autoUpdatePrefPe
   Assert.equal(addon.applyBackgroundUpdates, AddonManager.AUTOUPDATE_ENABLE);
   Assert.ok(prefs.getBoolPref(OPENH264_PREF_AUTOUPDATE));
 
   addon.applyBackgroundUpdates = AddonManager.AUTOUPDATE_DEFAULT;
   Assert.ok(!prefs.prefHasUserValue(OPENH264_PREF_AUTOUPDATE));
 });
 
 add_task(function* test_pluginRegistration() {
+  const TEST_VERSION = "1.2.3.4";
+
   let file = Services.dirsvc.get("ProfD", Ci.nsIFile);
-  file.append("openh264");
-  file.append("testDir");
+  file.append(OPENH264_PLUGIN_ID);
+  file.append(TEST_VERSION);
 
   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;
   Services.prefs.setBoolPref(OPENH264_PREF_ENABLED, true);
 
   // Check that the OpenH264 plugin gets registered after startup.
-  Services.prefs.setCharPref(OPENH264_PREF_PATH, file.path);
+  Services.prefs.setCharPref(OPENH264_PREF_VERSION, TEST_VERSION);
   clearPaths();
   yield promiseRestartManager();
   Assert.equal(addedPath, file.path);
   Assert.equal(removedPath, null);
 
-  // Check that clearing the path doesn't trigger registration.
+  // Check that clearing the version doesn't trigger registration.
   clearPaths();
-  Services.prefs.clearUserPref(OPENH264_PREF_PATH);
+  Services.prefs.clearUserPref(OPENH264_PREF_VERSION);
   Assert.equal(addedPath, null);
   Assert.equal(removedPath, file.path);
 
-  // Restarting with no path set should not trigger registration.
+  // Restarting with no version 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);
+  Services.prefs.setCharPref(OPENH264_PREF_VERSION, TEST_VERSION);
   clearPaths();
-  let file2 = file.clone();
-  file2.append("foo");
-  Services.prefs.setCharPref(OPENH264_PREF_PATH, file2.path);
+  const TEST_VERSION_2 = "5.6.7.8";
+  let file2 = Services.dirsvc.get("ProfD", Ci.nsIFile);
+  file2.append(OPENH264_PLUGIN_ID);
+  file2.append(TEST_VERSION_2);
+  Services.prefs.setCharPref(OPENH264_PREF_VERSION, TEST_VERSION_2);
   Assert.equal(addedPath, file2.path);
   Assert.equal(removedPath, file.path);
 
   // Disabling OpenH264 should cause unregistration.
-  Services.prefs.setCharPref(OPENH264_PREF_PATH, file.path);
+  Services.prefs.setCharPref(OPENH264_PREF_VERSION, TEST_VERSION);
   clearPaths();
   Services.prefs.setBoolPref(OPENH264_PREF_ENABLED, false);
   Assert.equal(addedPath, null);
   Assert.equal(removedPath, file.path);
 
   // Restarting with OpenH264 disabled should not cause registration.
   clearPaths();
   yield promiseRestartManager();