Bug 1238140 - Always download the GMP plugin before playing Netflix - r?maja_zf, r?ksteuber draft
authorSyd Polk <spolk@mozilla.com>
Fri, 11 Mar 2016 11:36:39 -0600
changeset 339525 2592be714347d315b41cd622efc0e19945f6a2b2
parent 339110 dd1abe874252e507b825a0a4e1063b0e13578288
child 516010 2e54a3d5b4f26631d2c5627391b13c06f18338c6
push id12754
push userspolk@mozilla.com
push dateFri, 11 Mar 2016 17:38:30 +0000
reviewersmaja_zf, ksteuber
bugs1238140
milestone48.0a1
Bug 1238140 - Always download the GMP plugin before playing Netflix - r?maja_zf, r?ksteuber MozReview-Commit-ID: 71tqt7T9oSH
dom/media/test/external/external_media_tests/playback/test_eme_playback.py
--- a/dom/media/test/external/external_media_tests/playback/test_eme_playback.py
+++ b/dom/media/test/external/external_media_tests/playback/test_eme_playback.py
@@ -1,32 +1,61 @@
 # 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/.
 
 import re
 
 from external_media_harness.testcase import MediaTestCase, VideoPlaybackTestsMixin
+from external_media_tests.media_utils.video_puppeteer import VideoException
 
+reset_adobe_gmp_script = """
+navigator.requestMediaKeySystemAccess('com.adobe.primetime',
+[{initDataType: 'cenc'}]).then(
+    function(access) {
+        marionetteScriptFinished('success');
+    },
+    function(ex) {
+        marionetteScriptFinished(ex);
+    }
+);
+"""
 
 class TestEMEPlayback(MediaTestCase, VideoPlaybackTestsMixin):
 
+    # Class variable. We only need to reset the adobe GMP version once, not
+    # every time we instantiate the class.
+    version_needs_reset = True
+
     def setUp(self):
         super(TestEMEPlayback, self).setUp()
         self.set_eme_prefs()
+        self.reset_GMP_version()
         assert(self.check_eme_prefs())
 
     def set_eme_prefs(self):
         with self.marionette.using_context('chrome'):
 
             # https://bugzilla.mozilla.org/show_bug.cgi?id=1187471#c28
             # 2015-09-28 cpearce says this is no longer necessary, but in case
             # we are working with older firefoxes...
             self.prefs.set_pref('media.gmp.trial-create.enabled', False)
 
+    def reset_GMP_version(self):
+        if TestEMEPlayback.version_needs_reset:
+            with self.marionette.using_context('chrome'):
+                if self.prefs.get_pref('media.gm-eme-adobe.version'):
+                    self.prefs.set_pref('media.gm-eme-adobe.version', None)
+                result = self.marionette.execute_async_script(reset_adobe_gmp_script,
+                                                              script_timeout=60000)
+                if not result == 'success':
+                    raise VideoException('ERROR: Resetting Adobe GMP failed % s' % result)
+
+            TestEMEPlayback.version_needs_reset = False
+
     def check_and_log_boolean_pref(self, pref_name, expected_value):
         with self.marionette.using_context('chrome'):
             pref_value = self.prefs.get_pref(pref_name)
 
             if pref_value is None:
                 self.logger.info('Pref %s has no value.' % pref_name)
                 return False
             else: