Bug 1126362 - Add unit tests for navigating to a data: url containing an image r?whimboo draft
authorMike Yusko <freshjelly12@yahoo.com>
Mon, 26 Feb 2018 15:36:30 +0200
changeset 765201 65726dd5c763fc5490d5f4ec176343eb489f2ad9
parent 755180 27fd083ed7ee5782e52a5eaf0286c5ffa8b35a9e
push id102004
push userbmo:mykhaylo.yusko@gmail.com
push dateFri, 09 Mar 2018 10:35:05 +0000
reviewerswhimboo
bugs1126362
milestone60.0a1
Bug 1126362 - Add unit tests for navigating to a data: url containing an image r?whimboo MozReview-Commit-ID: GZg1BOY7tOj
testing/marionette/harness/marionette_harness/tests/unit/test_navigation.py
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_navigation.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_navigation.py
@@ -17,19 +17,25 @@ from marionette_harness import (
     skip,
     skip_if_mobile,
     WindowManagerMixin,
 )
 
 here = os.path.abspath(os.path.dirname(__file__))
 
 
+BLACK_PIXEL = 'iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNkYPhfDwAChwGA60e6kgAAAABJRU5ErkJggg==' # noqa
+RED_PIXEL = 'iVBORw0KGgoAAAANSUhEUgAAAAEAAAABAQMAAAAl21bKAAAAA1BMVEX/TQBcNTh/AAAAAXRSTlPM0jRW/QAAAApJREFUeJxjYgAAAAYAAzY3fKgAAAAASUVORK5CYII=' # noqa
+
 def inline(doc):
     return "data:text/html;charset=utf-8,%s" % urllib.quote(doc)
 
+def inline_image(data):
+    return 'data:image/png;base64,%s' % data
+
 
 class BaseNavigationTestCase(WindowManagerMixin, MarionetteTestCase):
 
     def setUp(self):
         super(BaseNavigationTestCase, self).setUp()
 
         file_path = os.path.join(here, 'data', 'test.html').replace("\\", "/")
 
@@ -482,16 +488,19 @@ class TestBackForwardNavigation(BaseNavi
             {"url": self.marionette.absolute_url("white.png")},
         ]
         self.run_bfcache_test(test_pages)
 
     def test_image_to_image(self):
         test_pages = [
             {"url": self.marionette.absolute_url("black.png")},
             {"url": self.marionette.absolute_url("white.png")},
+            {"url": inline_image(RED_PIXEL)},
+            {"url": inline_image(BLACK_PIXEL)},
+            {"url": self.marionette.absolute_url("black.png")},
         ]
         self.run_bfcache_test(test_pages)
 
     @run_if_e10s("Requires e10s mode enabled")
     def test_remoteness_change(self):
         test_pages = [
             {"url": "about:robots", "is_remote": False},
             {"url": self.test_page_remote, "is_remote": True},