summaryrefslogtreecommitdiffstats
path: root/testing/marionette/harness/marionette_harness/tests/unit/test_browsermobproxy.py
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /testing/marionette/harness/marionette_harness/tests/unit/test_browsermobproxy.py
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'testing/marionette/harness/marionette_harness/tests/unit/test_browsermobproxy.py')
-rw-r--r--testing/marionette/harness/marionette_harness/tests/unit/test_browsermobproxy.py34
1 files changed, 34 insertions, 0 deletions
diff --git a/testing/marionette/harness/marionette_harness/tests/unit/test_browsermobproxy.py b/testing/marionette/harness/marionette_harness/tests/unit/test_browsermobproxy.py
new file mode 100644
index 000000000..64b3d1a77
--- /dev/null
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_browsermobproxy.py
@@ -0,0 +1,34 @@
+import datetime
+
+from marionette_harness.runner import BrowserMobTestCase
+
+
+class TestBrowserMobProxy(BrowserMobTestCase):
+ """To run this test, you'll need to download the browsermob-proxy from
+ http://bmp.lightbody.net/, and then pass the path to the startup
+ script (typically /path/to/browsermob-proxy-2.0.0/bin/browsermob-proxy)
+ as the --browsermob-script argument when running runtests.py.
+
+ You can additionally pass --browsermob-port to specify the port that
+ the proxy will run on; it defaults to 8080.
+
+ This test is NOT run in CI, as bmp and dependencies aren't available
+ there.
+ """
+
+ def test_browsermob_proxy_limits(self):
+ """This illustrates the use of download limits in the proxy,
+ and verifies that it's slower to load a page @100kbps
+ than it is to download the same page @1000kbps.
+ """
+ proxy = self.create_browsermob_proxy()
+ proxy.limits({'downstream_kbps': 1000})
+ time1 = datetime.datetime.now()
+ self.marionette.navigate('http://forecast.weather.gov')
+ time2 = datetime.datetime.now()
+ proxy.limits({'downstream_kbps': 100})
+ time3 = datetime.datetime.now()
+ self.marionette.refresh()
+ time4 = datetime.datetime.now()
+ self.assertTrue(time4 - time3 > time2 - time1,
+ "page load @ 100kbps not slower than page load @ 1000kbps")