Commit ab71188e authored by Alex Catarineu's avatar Alex Catarineu
Browse files

Fix dom objects enumeration tests for 80

parent 5c0a4650
import os import os
import json import json
from marionette_harness import MarionetteTestCase
class TestSuite(object): class TestSuite(object):
def __init__(self): def __init__(self):
...@@ -24,3 +25,9 @@ class TestSuite(object): ...@@ -24,3 +25,9 @@ class TestSuite(object):
output = open(screenshot_file, 'w') output = open(screenshot_file, 'w')
output.write(png_data) output.write(png_data)
output.close() output.close()
class TorBrowserTest(MarionetteTestCase):
def get_version(self):
with self.marionette.using_context("chrome"):
return self.marionette.execute_script("return parseFloat(AppConstants.MOZ_APP_VERSION);")
from marionette_harness import MarionetteTestCase from marionette_harness import MarionetteTestCase
import testsuite
class Test(MarionetteTestCase): class Test(testsuite.TorBrowserTest):
def setUp(self): def setUp(self):
MarionetteTestCase.setUp(self) testsuite.TorBrowserTest.setUp(self)
self.marionette.set_pref("network.proxy.allow_hijacking_localhost", False) self.marionette.set_pref("network.proxy.allow_hijacking_localhost", False)
self.test_page_file_url = self.marionette.absolute_url("dom-objects-enumeration.html?testType=worker") self.test_page_file_url = self.marionette.absolute_url("dom-objects-enumeration.html?testType=worker")
...@@ -196,8 +197,14 @@ class Test(MarionetteTestCase): ...@@ -196,8 +197,14 @@ class Test(MarionetteTestCase):
"XMLHttpRequestEventTarget", "XMLHttpRequestEventTarget",
"XMLHttpRequestUpload", "XMLHttpRequestUpload",
] ]
self.expectedObjects80 = self.expectedObjects + ["AggregateError", "FinalizationRegistry", "WeakRef"]
self.expectedObjects80.sort()
def test_dom_objects_enumeration_workers(self): def test_dom_objects_enumeration_workers(self):
expectedObjects = self.expectedObjects
if self.get_version() >= 80:
expectedObjects = self.expectedObjects80
with self.marionette.using_context('content'): with self.marionette.using_context('content'):
self.marionette.navigate(self.test_page_file_url) self.marionette.navigate(self.test_page_file_url)
self.marionette.timeout.implicit = 5 self.marionette.timeout.implicit = 5
...@@ -206,7 +213,7 @@ class Test(MarionetteTestCase): ...@@ -206,7 +213,7 @@ class Test(MarionetteTestCase):
err = False err = False
unknown_objects = '' unknown_objects = ''
for l in r: for l in r:
if l in self.expectedObjects: if l in expectedObjects:
continue continue
err = True err = True
unknown_objects += l + "\n" unknown_objects += l + "\n"
...@@ -214,7 +221,7 @@ class Test(MarionetteTestCase): ...@@ -214,7 +221,7 @@ class Test(MarionetteTestCase):
err_msg = "Unknown objects:\n%s" % unknown_objects err_msg = "Unknown objects:\n%s" % unknown_objects
self.assertFalse(err, msg=err_msg) self.assertFalse(err, msg=err_msg)
for l in self.expectedObjects: for l in expectedObjects:
if l in r: if l in r:
continue continue
err = True err = True
......
...@@ -8,10 +8,11 @@ from marionette_driver import By ...@@ -8,10 +8,11 @@ from marionette_driver import By
from marionette_driver.errors import MarionetteException from marionette_driver.errors import MarionetteException
from marionette_harness import MarionetteTestCase from marionette_harness import MarionetteTestCase
import testsuite
class Test(MarionetteTestCase): class Test(testsuite.TorBrowserTest):
def setUp(self): def setUp(self):
MarionetteTestCase.setUp(self) testsuite.TorBrowserTest.setUp(self)
self.marionette.set_pref("network.proxy.allow_hijacking_localhost", False) self.marionette.set_pref("network.proxy.allow_hijacking_localhost", False)
self.test_page_file_url = self.marionette.absolute_url("dom-objects-enumeration.html?testType=window") self.test_page_file_url = self.marionette.absolute_url("dom-objects-enumeration.html?testType=window")
# The list of expected DOM objects # The list of expected DOM objects
...@@ -753,8 +754,15 @@ class Test(MarionetteTestCase): ...@@ -753,8 +754,15 @@ class Test(MarionetteTestCase):
"XPathResult", "XPathResult",
"XSLTProcessor", "XSLTProcessor",
] ]
self.expectedObjects80 = self.expectedObjects + ["AggregateError", "FinalizationRegistry", "WeakRef"]
self.expectedObjects80.remove("content")
self.expectedObjects80.sort()
def test_dom_objects_enumeration(self): def test_dom_objects_enumeration(self):
expectedObjects = self.expectedObjects
if self.get_version() >= 80:
expectedObjects = self.expectedObjects80
with self.marionette.using_context('content'): with self.marionette.using_context('content'):
self.marionette.navigate(self.test_page_file_url) self.marionette.navigate(self.test_page_file_url)
self.marionette.timeout.implicit = 5 self.marionette.timeout.implicit = 5
...@@ -763,7 +771,7 @@ class Test(MarionetteTestCase): ...@@ -763,7 +771,7 @@ class Test(MarionetteTestCase):
err = False err = False
unknown_objects = '' unknown_objects = ''
for l in r: for l in r:
if l in self.expectedObjects: if l in expectedObjects:
continue continue
err = True err = True
unknown_objects += l + "\n" unknown_objects += l + "\n"
...@@ -771,7 +779,7 @@ class Test(MarionetteTestCase): ...@@ -771,7 +779,7 @@ class Test(MarionetteTestCase):
err_msg = "Unknown objects:\n%s" % unknown_objects err_msg = "Unknown objects:\n%s" % unknown_objects
self.assertFalse(err, msg=err_msg) self.assertFalse(err, msg=err_msg)
for l in self.expectedObjects: for l in expectedObjects:
if l in r: if l in r:
continue continue
err = True err = True
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment