GitLab is used only for code review, issue tracking and project management. Canonical locations for source code are still https://gitweb.torproject.org/ https://git.torproject.org/ and git-rw.torproject.org.

Unverified Commit 741c3880 authored by boklm's avatar boklm
Browse files

Bug 18597: move user timing testing in a separate test

The user timing API testing was initialy added to the resource-timing
test. For better clarity, we move it to a separate user-timing test.
parent e7994fdb
......@@ -319,12 +319,22 @@ our @tests = (
{
name => 'resource-timing',
type => 'marionette',
descr => 'Check that the Resource Timing and User Timing APIs are really disabled',
descr => 'Check that the Resource Timing API is really disabled',
use_net => 1,
# To check that the test fails when resource timing or user
# timing is enabled, uncomment this:
# To check that the test fails when resource timing is enabled,
# uncomment this:
#prefs => {
# 'dom.enable_resource_timing' => 'true',
#},
},
{
name => 'user-timing',
type => 'marionette',
descr => 'Check that the User Timing API is really disabled',
use_net => 1,
# To check that the test fails when user timing is enabled,
# uncomment this:
#prefs => {
# 'dom.enable_user_timing' => 'true',
#},
},
......
......@@ -3,11 +3,6 @@
# Tor Browser. Setting |dom.enable_resource_timing| to |false| and testing that
# might not be sufficient.
# This test also checks where the User Timing API (see:
# https://www.w3.org/TR/user-timing/) is really disabled in the default
# Tor Browser. Setting |dom.enable_user_timing| to |false| and testing that
# might not be sufficient.
from marionette_driver import By
from marionette_driver.errors import MarionetteException
......@@ -29,7 +24,7 @@ class Test(FirefoxTestCase):
# If resource timing is disabled we should not be able to get resource
# entries at all in the first place. We test all three methods for safety's
# sake. We also test the user timing mark and measure methods.
# sake.
# getEntriesByType()
err_msg = 'resource entries found (getEntriesByType())'
......@@ -73,28 +68,3 @@ class Test(FirefoxTestCase):
"""),
msg=err_msg)
# measure()
err_msg = 'user timing is working (performance.measure())'
self.assertTrue(self.marionette.execute_script("""
var pass = false;
try {
document.defaultView.performance.measure("measure1");
} catch (e) {
pass = true;
}
return pass;
"""),
msg=err_msg)
# mark()
err_msg = 'user timing is working (performance.mark())'
self.assertTrue(self.marionette.execute_script("""
var pass = false;
try {
document.defaultView.performance.mark("startTask1");
} catch (e) {
pass = true;
}
return pass;
"""),
msg=err_msg)
# This test checks whether the User Timing API (see:
# https://www.w3.org/TR/user-timing/) is really disabled in the default
# Tor Browser. Setting |dom.enable_user_timing| to |false| and testing that
# might not be sufficient.
from marionette_driver import By
from marionette_driver.errors import MarionetteException
from firefox_ui_harness import FirefoxTestCase
class Test(FirefoxTestCase):
def setUp(self):
FirefoxTestCase.setUp(self)
self.TEST_URL = "https://www.mediawiki.org/wiki/MediaWiki"
self.RESOURCE_URL = "https://upload.wikimedia.org/wikipedia/mediawiki/b/bc/Wiki.png"
def test_user_timing(self):
with self.marionette.using_context('content'):
self.marionette.navigate(self.TEST_URL)
# If user timing is disabled we should not be able to use the
# measure and mark methods.
# measure()
err_msg = 'user timing is working (performance.measure())'
self.assertTrue(self.marionette.execute_script("""
var pass = false;
try {
document.defaultView.performance.measure("measure1");
} catch (e) {
pass = true;
}
return pass;
"""),
msg=err_msg)
# mark()
err_msg = 'user timing is working (performance.mark())'
self.assertTrue(self.marionette.execute_script("""
var pass = false;
try {
document.defaultView.performance.mark("startTask1");
} catch (e) {
pass = true;
}
return pass;
"""),
msg=err_msg)
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