Bug 1316984 - Update external media tests to get/set preferences via Marionette. r=SingingTree
authorHenrik Skupin <mail@hskupin.info>
Wed, 14 Dec 2016 15:40:20 +0100
changeset 450746 499f2417ea87ef8d82e18c1d4ec368cbbfa1dcd8
parent 450745 e56429e854a4b30a051f3151746a48f63da9e451
child 450747 37dab4ba15ccfce7d35460c0169d45bd98e9de10
push id38944
push userbmo:leftysolara@gmail.com
push dateSun, 18 Dec 2016 16:01:15 +0000
reviewersSingingTree
bugs1316984
milestone53.0a1
Bug 1316984 - Update external media tests to get/set preferences via Marionette. r=SingingTree MozReview-Commit-ID: 8ObRLtE4ULb
dom/media/test/external/external_media_harness/testcase.py
dom/media/test/external/external_media_tests/playback/test_shaka_playback.py
dom/media/test/external/external_media_tests/playback/youtube/test_prefs.py
--- a/dom/media/test/external/external_media_harness/testcase.py
+++ b/dom/media/test/external/external_media_harness/testcase.py
@@ -246,25 +246,25 @@ class EMESetupMixin(object):
         self.reset_GMP_version()
         assert(self.check_eme_prefs())
 
     def set_eme_prefs(self):
         with self.marionette.using_context(Marionette.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)
+            self.marionette.set_pref('media.gmp.trial-create.enabled', False)
 
     def reset_GMP_version(self):
         if EMESetupMixin.version_needs_reset:
             with self.marionette.using_context(Marionette.CONTEXT_CHROME):
-                if self.prefs.get_pref('media.gmp-eme-adobe.version'):
-                    self.prefs.reset_pref('media.gmp-eme-adobe.version')
-                if self.prefs.get_pref('media.gmp-widevinecdm.version'):
-                    self.prefs.reset_pref('media.gmp-widevinecdm.version')
+                if self.marionette.get_pref('media.gmp-eme-adobe.version'):
+                    self.marionette.reset_pref('media.gmp-eme-adobe.version')
+                if self.marionette.get_pref('media.gmp-widevinecdm.version'):
+                    self.marionette.reset_pref('media.gmp-widevinecdm.version')
             with self.marionette.using_context(Marionette.CONTEXT_CONTENT):
                 adobe_result = self.marionette.execute_async_script(
                     reset_adobe_gmp_script,
                     script_timeout=60000)
                 widevine_result = self.marionette.execute_async_script(
                     reset_widevine_gmp_script,
                     script_timeout=60000)
                 if not adobe_result == 'success':
@@ -275,33 +275,33 @@ class EMESetupMixin(object):
                     raise VideoException(
                         'ERROR: Resetting Widevine GMP failed {}'
                         .format(widevine_result))
 
             EMESetupMixin.version_needs_reset = False
 
     def check_and_log_boolean_pref(self, pref_name, expected_value):
         with self.marionette.using_context(Marionette.CONTEXT_CHROME):
-            pref_value = self.prefs.get_pref(pref_name)
+            pref_value = self.marionette.get_pref(pref_name)
 
             if pref_value is None:
                 self.logger.info('Pref {} has no value.'.format(pref_name))
                 return False
             else:
                 self.logger.info('Pref {} = {}'.format(pref_name, pref_value))
                 if pref_value != expected_value:
                     self.logger.info('Pref {} has unexpected value.'
                                      .format(pref_name))
                     return False
 
         return True
 
     def check_and_log_integer_pref(self, pref_name, minimum_value=0):
         with self.marionette.using_context(Marionette.CONTEXT_CHROME):
-            pref_value = self.prefs.get_pref(pref_name)
+            pref_value = self.marionette.get_pref(pref_name)
 
             if pref_value is None:
                 self.logger.info('Pref {} has no value.'.format(pref_name))
                 return False
             else:
                 self.logger.info('Pref {} = {}'.format(pref_name, pref_value))
 
                 match = re.search('^\d+$', pref_value)
@@ -318,17 +318,17 @@ class EMESetupMixin(object):
         version string of the same format. The number of integers in each
         string does not need to match. The comparison is done by converting
         each to an integer array and comparing those. Both version strings
         must be made up of only integers, or this method will raise an
         unhandled exception of type ValueError when the conversion to int
         fails.
         """
         with self.marionette.using_context(Marionette.CONTEXT_CHROME):
-            pref_value = self.prefs.get_pref(pref_name)
+            pref_value = self.marionette.get_pref(pref_name)
 
             if pref_value is None:
                 self.logger.info('Pref {} has no value.'.format(pref_name))
                 return False
             else:
                 self.logger.info('Pref {} = {}'.format(pref_name, pref_value))
 
                 match = re.search('^\d(.\d+)*$', pref_value)
--- a/dom/media/test/external/external_media_tests/playback/test_shaka_playback.py
+++ b/dom/media/test/external/external_media_tests/playback/test_shaka_playback.py
@@ -14,17 +14,17 @@ class TestShakaPlayback(MediaTestCase):
     This test takes manifest URLs rather than URLs for pages with videos. These
     manifests are loaded with shaka-player
     """
 
     def test_video_playback_partial(self):
         """ Plays 60 seconds of the video from the manifest URLs given
         """
         shakaUrl = "http://shaka-player-demo.appspot.com"
-        self.prefs.set_pref('media.mediasource.webm.enabled', True)
+        self.marionette.set_pref('media.mediasource.webm.enabled', True)
 
         with self.marionette.using_context(Marionette.CONTEXT_CONTENT):
             for manifestUrl in self.video_urls:
                 vp = VideoPuppeteer(self.marionette,
                                     shakaUrl,
                                     stall_wait_time=10,
                                     set_duration=60,
                                     video_selector="video#video",
--- a/dom/media/test/external/external_media_tests/playback/youtube/test_prefs.py
+++ b/dom/media/test/external/external_media_tests/playback/youtube/test_prefs.py
@@ -23,19 +23,19 @@ class TestMediaSourcePrefs(MediaTestCase
         self.set_mse_enabled_prefs(False)
         self.check_mse_src(False, self.test_urls[0])
 
         self.set_mse_enabled_prefs(True)
         self.check_mse_src(True, self.test_urls[0])
 
     def set_mse_enabled_prefs(self, value):
         with self.marionette.using_context('chrome'):
-            self.prefs.set_pref('media.mediasource.enabled', value)
-            self.prefs.set_pref('media.mediasource.mp4.enabled', value)
-            self.prefs.set_pref('media.mediasource.webm.enabled', value)
+            self.marionette.set_pref('media.mediasource.enabled', value)
+            self.marionette.set_pref('media.mediasource.mp4.enabled', value)
+            self.marionette.set_pref('media.mediasource.webm.enabled', value)
 
     def check_mse_src(self, mse_expected, url):
         with self.marionette.using_context('content'):
             youtube = YouTubePuppeteer(self.marionette, url)
             wait = Wait(youtube,
                         timeout=min(self.max_timeout,
                                     youtube.expected_duration * 1.3),
                         interval=1)