Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5783)

Unified Diff: chrome/test/chromedriver/test/run_py_tests.py

Issue 1004843002: [chromedriver] Add Network Presets to Network Throttling feature (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nits Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/test/chromedriver/embed_networks_in_cpp.py ('k') | chrome/test/chromedriver/window_commands.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 9240b18866fb9cd9178811f731873269b0bcbea6..bf73de87cacb61f890b072f159a86aa8dd8ac85f 100755
--- a/chrome/test/chromedriver/test/run_py_tests.py
+++ b/chrome/test/chromedriver/test/run_py_tests.py
@@ -54,6 +54,7 @@ _NEGATIVE_FILTER = [
'ChromeDriverTest.testEmulateNetworkConditionsOffline',
# This test is too flaky on the bots, but seems to run perfectly fine
# on developer workstations.
+ 'ChromeDriverTest.testEmulateNetworkConditionsNameSpeed',
'ChromeDriverTest.testEmulateNetworkConditionsSpeed',
]
@@ -161,6 +162,7 @@ _ANDROID_NEGATIVE_FILTER['chromedriver_webview_shell'] = (
'ChromeDriverTest.testShadowDom*',
# WebView doesn't support emulating network conditions.
'ChromeDriverTest.testEmulateNetworkConditions',
+ 'ChromeDriverTest.testEmulateNetworkConditionsNameSpeed',
'ChromeDriverTest.testEmulateNetworkConditionsOffline',
'ChromeDriverTest.testEmulateNetworkConditionsSpeed',
]
@@ -806,6 +808,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 testEmulateNetworkConditionsSpeed(self):
# Warm up the browser.
@@ -832,6 +847,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 testEmulateNetworkConditionsOffline(self):
self._driver.SetNetworkConditions(5, 2048, 2048, offline=True)
self._driver.Load(self.GetHttpUrlForFile('/chromedriver/page_test.html'))
« no previous file with comments | « chrome/test/chromedriver/embed_networks_in_cpp.py ('k') | chrome/test/chromedriver/window_commands.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698