Index: chrome/test/chromedriver/client/chromedriver.py |
diff --git a/chrome/test/chromedriver/client/chromedriver.py b/chrome/test/chromedriver/client/chromedriver.py |
index a4389f97321ef041b6c24de531648b7df05021d7..3700a73a06339f2d42f8505c0cd9cc5ea85bc455 100644 |
--- a/chrome/test/chromedriver/client/chromedriver.py |
+++ b/chrome/test/chromedriver/client/chromedriver.py |
@@ -357,3 +357,26 @@ class ChromeDriver(object): |
def SetAutoReporting(self, enabled): |
self.ExecuteCommand(Command.SET_AUTO_REPORTING, {'enabled': enabled}) |
+ |
+ def SetNetworkConditions(self, latency, download_throughput, |
+ upload_throughput): |
+ # Until http://crbug.com/456324 is resolved, we'll always set 'offline' to |
+ # False, as going "offline" will sever Chromedriver's connection to Chrome. |
+ params = { |
+ 'network_conditions': { |
+ 'offline': False, |
+ 'latency': latency, |
+ 'download_throughput': download_throughput, |
+ 'upload_throughput': upload_throughput |
+ } |
+ } |
+ self.ExecuteCommand(Command.SET_NETWORK_CONDITIONS, params) |
+ |
+ def GetNetworkConditions(self): |
+ conditions = self.ExecuteCommand(Command.GET_NETWORK_CONDITIONS) |
+ return { |
+ 'latency': conditions['latency'], |
+ 'download_throughput': conditions['download_throughput'], |
+ 'upload_throughput': conditions['upload_throughput'], |
+ 'offline': conditions['offline'] |
+ } |