| Index: chrome/test/chromedriver/test/run_py_tests.py
|
| diff --git a/chrome/test/chromedriver/test/run_py_tests.py b/chrome/test/chromedriver/test/run_py_tests.py
|
| index 556227a45c6cefaa585b2338a70881acba94f4c1..923f84796275edf18b9c07d335eda577db130a4d 100755
|
| --- a/chrome/test/chromedriver/test/run_py_tests.py
|
| +++ b/chrome/test/chromedriver/test/run_py_tests.py
|
| @@ -799,6 +799,19 @@ class ChromeDriverTest(ChromeDriverBaseTest):
|
| self.assertEquals(latency, network['latency']);
|
| self.assertEquals(throughput, network['download_throughput']);
|
| self.assertEquals(throughput, network['upload_throughput']);
|
| + self.assertEquals(False, network['offline']);
|
| +
|
| + def testEmulateNetworkConditionsName(self):
|
| + # DSL: 2Mbps throughput, 5ms RTT
|
| + #latency = 5
|
| + #throughput = 2048 * 1024
|
| + self._driver.SetNetworkConditionsName('DSL')
|
| +
|
| + network = self._driver.GetNetworkConditions()
|
| + self.assertEquals(5, network['latency']);
|
| + self.assertEquals(2048*1024, network['download_throughput']);
|
| + self.assertEquals(2048*1024, network['upload_throughput']);
|
| + self.assertEquals(False, network['offline']);
|
|
|
| def testEmulateNetworkConditionsOffline(self):
|
| self._driver.SetNetworkConditions(5, 2048, 2048, offline=True)
|
| @@ -830,6 +843,30 @@ class ChromeDriverTest(ChromeDriverBaseTest):
|
| self.assertLessEqual(actual_throughput_kbps, throughput_kbps * 1.5)
|
| self.assertGreaterEqual(actual_throughput_kbps, throughput_kbps / 1.5)
|
|
|
| + def testEmulateNetworkConditionsNameSpeed(self):
|
| + # Warm up the browser.
|
| + self._http_server.SetDataForPath(
|
| + '/', "<html><body>blank</body></html>")
|
| + self._driver.Load(self._http_server.GetUrl() + '/')
|
| +
|
| + # DSL: 2Mbps throughput, 5ms RTT
|
| + throughput_kbps = 2048
|
| + throughput = throughput_kbps * 1024
|
| + self._driver.SetNetworkConditionsName('DSL')
|
| +
|
| + _32_bytes = " 0 1 2 3 4 5 6 7 8 9 A B C D E F"
|
| + _1_megabyte = _32_bytes * 32768
|
| + self._http_server.SetDataForPath(
|
| + '/1MB',
|
| + "<html><body>%s</body></html>" % _1_megabyte)
|
| + start = time.time()
|
| + self._driver.Load(self._http_server.GetUrl() + '/1MB')
|
| + finish = time.time()
|
| + duration = finish - start
|
| + actual_throughput_kbps = 1024 / duration
|
| + self.assertLessEqual(actual_throughput_kbps, throughput_kbps * 1.5)
|
| + self.assertGreaterEqual(actual_throughput_kbps, throughput_kbps / 1.5)
|
| +
|
| def testShadowDomFindElementWithSlashDeep(self):
|
| """Checks that chromedriver can find elements in a shadow DOM using /deep/
|
| css selectors."""
|
|
|