Bug 1316984 - Update external media tests to get/set preferences via Marionette. r=SingingTree, a=test-only
authorHenrik Skupin <mail@hskupin.info>
Wed, 14 Dec 2016 15:40:20 +0100
changeset 353203 738eff2f2aa20953c1caa3809d52c927805ed462
parent 353202 4f352e05e27fd467491b95e9f4089730a4264b69
child 353204 2638daa602187f2f8e4c9510c659ce0ca5251711
push id6795
push userjlund@mozilla.com
push dateMon, 23 Jan 2017 14:19:46 +0000
treeherdermozilla-esr52@76101b503191 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersSingingTree, test-only
bugs1316984
milestone52.0a2
Bug 1316984 - Update external media tests to get/set preferences via Marionette. r=SingingTree, a=test-only 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)