Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
The Tor Project
Applications
tor-browser-bundle-testsuite
Commits
ab71188e
Commit
ab71188e
authored
Aug 03, 2020
by
Alex Catarineu
Browse files
Fix dom objects enumeration tests for 80
parent
5c0a4650
Changes
3
Hide whitespace changes
Inline
Side-by-side
marionette/tor_browser_tests/lib/testsuite.py
View file @
ab71188e
import
os
import
json
from
marionette_harness
import
MarionetteTestCase
class
TestSuite
(
object
):
def
__init__
(
self
):
...
...
@@ -24,3 +25,9 @@ class TestSuite(object):
output
=
open
(
screenshot_file
,
'w'
)
output
.
write
(
png_data
)
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);"
)
marionette/tor_browser_tests/test_dom-objects-enumeration-worker.py
View file @
ab71188e
from
marionette_harness
import
MarionetteTestCase
import
testsuite
class
Test
(
MarionetteTestCase
):
class
Test
(
testsuite
.
TorBrowserTest
):
def
setUp
(
self
):
MarionetteTestCase
.
setUp
(
self
)
testsuite
.
TorBrowserTest
.
setUp
(
self
)
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"
)
...
...
@@ -196,8 +197,14 @@ class Test(MarionetteTestCase):
"XMLHttpRequestEventTarget"
,
"XMLHttpRequestUpload"
,
]
self
.
expectedObjects80
=
self
.
expectedObjects
+
[
"AggregateError"
,
"FinalizationRegistry"
,
"WeakRef"
]
self
.
expectedObjects80
.
sort
()
def
test_dom_objects_enumeration_workers
(
self
):
expectedObjects
=
self
.
expectedObjects
if
self
.
get_version
()
>=
80
:
expectedObjects
=
self
.
expectedObjects80
with
self
.
marionette
.
using_context
(
'content'
):
self
.
marionette
.
navigate
(
self
.
test_page_file_url
)
self
.
marionette
.
timeout
.
implicit
=
5
...
...
@@ -206,7 +213,7 @@ class Test(MarionetteTestCase):
err
=
False
unknown_objects
=
''
for
l
in
r
:
if
l
in
self
.
expectedObjects
:
if
l
in
expectedObjects
:
continue
err
=
True
unknown_objects
+=
l
+
"
\n
"
...
...
@@ -214,7 +221,7 @@ class Test(MarionetteTestCase):
err_msg
=
"Unknown objects:
\n
%s"
%
unknown_objects
self
.
assertFalse
(
err
,
msg
=
err_msg
)
for
l
in
self
.
expectedObjects
:
for
l
in
expectedObjects
:
if
l
in
r
:
continue
err
=
True
...
...
marionette/tor_browser_tests/test_dom-objects-enumeration.py
View file @
ab71188e
...
...
@@ -8,10 +8,11 @@ from marionette_driver import By
from
marionette_driver.errors
import
MarionetteException
from
marionette_harness
import
MarionetteTestCase
import
testsuite
class
Test
(
MarionetteTestCase
):
class
Test
(
testsuite
.
TorBrowserTest
):
def
setUp
(
self
):
MarionetteTestCase
.
setUp
(
self
)
testsuite
.
TorBrowserTest
.
setUp
(
self
)
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"
)
# The list of expected DOM objects
...
...
@@ -753,8 +754,15 @@ class Test(MarionetteTestCase):
"XPathResult"
,
"XSLTProcessor"
,
]
self
.
expectedObjects80
=
self
.
expectedObjects
+
[
"AggregateError"
,
"FinalizationRegistry"
,
"WeakRef"
]
self
.
expectedObjects80
.
remove
(
"content"
)
self
.
expectedObjects80
.
sort
()
def
test_dom_objects_enumeration
(
self
):
expectedObjects
=
self
.
expectedObjects
if
self
.
get_version
()
>=
80
:
expectedObjects
=
self
.
expectedObjects80
with
self
.
marionette
.
using_context
(
'content'
):
self
.
marionette
.
navigate
(
self
.
test_page_file_url
)
self
.
marionette
.
timeout
.
implicit
=
5
...
...
@@ -763,7 +771,7 @@ class Test(MarionetteTestCase):
err
=
False
unknown_objects
=
''
for
l
in
r
:
if
l
in
self
.
expectedObjects
:
if
l
in
expectedObjects
:
continue
err
=
True
unknown_objects
+=
l
+
"
\n
"
...
...
@@ -771,7 +779,7 @@ class Test(MarionetteTestCase):
err_msg
=
"Unknown objects:
\n
%s"
%
unknown_objects
self
.
assertFalse
(
err
,
msg
=
err_msg
)
for
l
in
self
.
expectedObjects
:
for
l
in
expectedObjects
:
if
l
in
r
:
continue
err
=
True
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment