OLD | NEW |
1 # Copyright 2013 The Chromium Authors. All rights reserved. | 1 # Copyright 2013 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import command_executor | 5 import command_executor |
6 from command_executor import Command | 6 from command_executor import Command |
7 from webelement import WebElement | 7 from webelement import WebElement |
8 | 8 |
9 | 9 |
10 class ChromeDriverException(Exception): | 10 class ChromeDriverException(Exception): |
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 def GetAvailableLogTypes(self): | 352 def GetAvailableLogTypes(self): |
353 return self.ExecuteCommand(Command.GET_AVAILABLE_LOG_TYPES) | 353 return self.ExecuteCommand(Command.GET_AVAILABLE_LOG_TYPES) |
354 | 354 |
355 def IsAutoReporting(self): | 355 def IsAutoReporting(self): |
356 return self.ExecuteCommand(Command.IS_AUTO_REPORTING) | 356 return self.ExecuteCommand(Command.IS_AUTO_REPORTING) |
357 | 357 |
358 def SetAutoReporting(self, enabled): | 358 def SetAutoReporting(self, enabled): |
359 self.ExecuteCommand(Command.SET_AUTO_REPORTING, {'enabled': enabled}) | 359 self.ExecuteCommand(Command.SET_AUTO_REPORTING, {'enabled': enabled}) |
360 | 360 |
361 def SetNetworkConditions(self, latency, download_throughput, | 361 def SetNetworkConditions(self, latency, download_throughput, |
362 upload_throughput): | 362 upload_throughput, offline=False): |
363 # Until http://crbug.com/456324 is resolved, we'll always set 'offline' to | 363 # Until http://crbug.com/456324 is resolved, we'll always set 'offline' to |
364 # False, as going "offline" will sever Chromedriver's connection to Chrome. | 364 # False, as going "offline" will sever Chromedriver's connection to Chrome. |
365 params = { | 365 params = { |
366 'network_conditions': { | 366 'network_conditions': { |
367 'offline': False, | 367 'offline': offline, |
368 'latency': latency, | 368 'latency': latency, |
369 'download_throughput': download_throughput, | 369 'download_throughput': download_throughput, |
370 'upload_throughput': upload_throughput | 370 'upload_throughput': upload_throughput |
371 } | 371 } |
372 } | 372 } |
373 self.ExecuteCommand(Command.SET_NETWORK_CONDITIONS, params) | 373 self.ExecuteCommand(Command.SET_NETWORK_CONDITIONS, params) |
374 | 374 |
375 def SetNetworkConditionsName(self, network_name): | 375 def SetNetworkConditionsName(self, network_name): |
376 self.ExecuteCommand( | 376 self.ExecuteCommand( |
377 Command.SET_NETWORK_CONDITIONS, {'network_name': network_name}) | 377 Command.SET_NETWORK_CONDITIONS, {'network_name': network_name}) |
378 | 378 |
379 def GetNetworkConditions(self): | 379 def GetNetworkConditions(self): |
380 conditions = self.ExecuteCommand(Command.GET_NETWORK_CONDITIONS) | 380 conditions = self.ExecuteCommand(Command.GET_NETWORK_CONDITIONS) |
381 return { | 381 return { |
382 'latency': conditions['latency'], | 382 'latency': conditions['latency'], |
383 'download_throughput': conditions['download_throughput'], | 383 'download_throughput': conditions['download_throughput'], |
384 'upload_throughput': conditions['upload_throughput'], | 384 'upload_throughput': conditions['upload_throughput'], |
385 'offline': conditions['offline'] | 385 'offline': conditions['offline'] |
386 } | 386 } |
387 | 387 |
388 def DeleteNetworkConditions(self): | 388 def DeleteNetworkConditions(self): |
389 self.ExecuteCommand(Command.DELETE_NETWORK_CONDITIONS) | 389 self.ExecuteCommand(Command.DELETE_NETWORK_CONDITIONS) |
OLD | NEW |