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 1983551f943980c643260496f7f58e4821a972d6..a72faa19dd98764d1b2c184cd80a9e95da33e8aa 100755 |
--- a/chrome/test/chromedriver/test/run_py_tests.py |
+++ b/chrome/test/chromedriver/test/run_py_tests.py |
@@ -774,6 +774,41 @@ class ChromeDriverTest(ChromeDriverBaseTest): |
lots_of_data = self._driver.ExecuteScript(script) |
self.assertEquals('0'.zfill(int(10e6)), lots_of_data) |
+ def testEmulateNetworkConditions(self): |
+ # DSL: 2Mbps throughput, 5ms RTT |
+ latency = 5 |
+ throughput = 2048 * 1024 |
+ self._driver.SetNetworkConditions(latency, throughput, throughput) |
+ |
+ network = self._driver.GetNetworkConditions() |
+ self.assertEquals(latency, network['latency']); |
+ self.assertEquals(throughput, network['download_throughput']); |
+ self.assertEquals(throughput, network['upload_throughput']); |
+ |
+ def testEmulateNetworkConditionsSpeed(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 |
+ latency = 5 |
+ throughput_kbps = 2000 |
+ throughput = throughput_kbps * 1024 |
+ self._driver.SetNetworkConditions(latency, throughput, throughput) |
+ |
+ _32_bytes = " 0 1 2 3 4 5 6 7 8 9 A B C D E F" |
+ self._http_server.SetDataForPath( |
+ '/1MB', |
+ "<html><body>%s</body></html>" % (_32_bytes * 32768)) |
+ 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.333) |
+ self.assertGreaterEqual(actual_throughput_kbps, throughput_kbps / 1.333) |
samuong
2015/02/11 23:22:14
I'm a bit concerned about flakiness for these test
srawlins
2015/02/25 22:40:57
I can presumably add a latency check as well that
|
+ |
def testShadowDomFindElementWithSlashDeep(self): |
"""Checks that chromedriver can find elements in a shadow DOM using /deep/ |
css selectors.""" |