[tbb-commits] [tor-browser-bundle-testsuite/master] Fix play_videos test

gk at torproject.org gk at torproject.org
Thu Oct 15 18:41:27 UTC 2020


commit e8a5a6b29969e9b68a2d4acc989508b6a5ee748f
Author: Alex Catarineu <acat at torproject.org>
Date:   Mon May 18 10:26:07 2020 +0200

    Fix play_videos test
---
 TBBTestSuite/TestSuite/BrowserBundleTests.pm | 4 +---
 marionette/tor_browser_tests/test_page.py    | 5 +++--
 test-data/play_videos.html                   | 3 ++-
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/TBBTestSuite/TestSuite/BrowserBundleTests.pm b/TBBTestSuite/TestSuite/BrowserBundleTests.pm
index 4223132..365b7bc 100644
--- a/TBBTestSuite/TestSuite/BrowserBundleTests.pm
+++ b/TBBTestSuite/TestSuite/BrowserBundleTests.pm
@@ -428,10 +428,8 @@ our @tests = (
         descr           => 'Play some videos',
         use_net         => 1,
         marionette_test => 'page',
-        remote          => 1,
+        remote          => 0,
         timeout         => 50000,
-        # Bug 30339: temporarily disable test
-        enable          => sub { undef },
     },
     {
         name            => 'svg-disable',
diff --git a/marionette/tor_browser_tests/test_page.py b/marionette/tor_browser_tests/test_page.py
index d03367c..3d1f4cc 100644
--- a/marionette/tor_browser_tests/test_page.py
+++ b/marionette/tor_browser_tests/test_page.py
@@ -13,9 +13,10 @@ class Test(MarionetteTestCase):
 
         if ts.t['test']['remote']:
             test_data_url = ts.t['options']['test_data_url']
+            self.test_page_url = '%s/%s.html' % (test_data_url, ts.t['test']['name'])
         else:
-            test_data_url = "file://%s" % ts.t['options']['test_data_dir']
-        self.test_page_url = '%s/%s.html' % (test_data_url, ts.t['test']['name'])
+            self.test_page_url = self.marionette.absolute_url('%s.html' % (ts.t['test']['name']))
+            self.marionette.set_pref("network.proxy.allow_hijacking_localhost", False)
 
         if ts.t['test']['timeout']:
             self.timeout = ts.t['test']['timeout']
diff --git a/test-data/play_videos.html b/test-data/play_videos.html
index 76e4d1f..a2f4112 100644
--- a/test-data/play_videos.html
+++ b/test-data/play_videos.html
@@ -34,7 +34,8 @@ for (var i = 0; i < videos.length; i++) {
         next[v.id] = 'videos_' + (i + 1).toString();
     document.getElementById("videos").appendChild(v);
 }
-document.getElementById("videos_0").play();
+const first = document.getElementById("videos_0");
+first.addEventListener("canplay", () => first.play());
 
     </script>
 </body>





More information about the tbb-commits mailing list