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

Side by Side Diff: chrome/test/chromedriver/client/chromedriver.py

Issue 288193004: [Chromedriver] Add Device Metrics override support to ChromeDriver via Capabilities (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 7 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 unified diff | Download patch
OLDNEW
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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 58
59 59
60 class ChromeDriver(object): 60 class ChromeDriver(object):
61 """Starts and controls a single Chrome instance on this machine.""" 61 """Starts and controls a single Chrome instance on this machine."""
62 62
63 def __init__(self, server_url, chrome_binary=None, android_package=None, 63 def __init__(self, server_url, chrome_binary=None, android_package=None,
64 android_activity=None, android_process=None, 64 android_activity=None, android_process=None,
65 android_use_running_app=None, chrome_switches=None, 65 android_use_running_app=None, chrome_switches=None,
66 chrome_extensions=None, chrome_log_path=None, 66 chrome_extensions=None, chrome_log_path=None,
67 debugger_address=None, browser_log_level=None, 67 debugger_address=None, browser_log_level=None,
68 experimental_options=None): 68 mobile_emulation=None, experimental_options=None):
69 self._executor = command_executor.CommandExecutor(server_url) 69 self._executor = command_executor.CommandExecutor(server_url)
70 70
71 options = {} 71 options = {}
72 72
73 if experimental_options: 73 if experimental_options:
74 assert isinstance(experimental_options, dict) 74 assert isinstance(experimental_options, dict)
75 options = experimental_options.copy() 75 options = experimental_options.copy()
76 76
77 if android_package: 77 if android_package:
78 options['androidPackage'] = android_package 78 options['androidPackage'] = android_package
79 if android_activity: 79 if android_activity:
80 options['androidActivity'] = android_activity 80 options['androidActivity'] = android_activity
81 if android_process: 81 if android_process:
82 options['androidProcess'] = android_process 82 options['androidProcess'] = android_process
83 if android_use_running_app: 83 if android_use_running_app:
84 options['androidUseRunningApp'] = android_use_running_app 84 options['androidUseRunningApp'] = android_use_running_app
85 elif chrome_binary: 85 elif chrome_binary:
86 options['binary'] = chrome_binary 86 options['binary'] = chrome_binary
87 87
88 if chrome_switches: 88 if chrome_switches:
89 assert type(chrome_switches) is list 89 assert type(chrome_switches) is list
90 options['args'] = chrome_switches 90 options['args'] = chrome_switches
91 91
92 if mobile_emulation:
93 assert type(mobile_emulation) is dict
94 options['mobileEmulation'] = mobile_emulation
95
92 if chrome_extensions: 96 if chrome_extensions:
93 assert type(chrome_extensions) is list 97 assert type(chrome_extensions) is list
94 options['extensions'] = chrome_extensions 98 options['extensions'] = chrome_extensions
95 99
96 if chrome_log_path: 100 if chrome_log_path:
97 assert type(chrome_log_path) is str 101 assert type(chrome_log_path) is str
98 options['logPath'] = chrome_log_path 102 options['logPath'] = chrome_log_path
99 103
100 if debugger_address: 104 if debugger_address:
101 assert type(debugger_address) is str 105 assert type(debugger_address) is str
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 return self.ExecuteCommand(Command.GET_LOG, {'type': type}) 335 return self.ExecuteCommand(Command.GET_LOG, {'type': type})
332 336
333 def GetAvailableLogTypes(self): 337 def GetAvailableLogTypes(self):
334 return self.ExecuteCommand(Command.GET_AVAILABLE_LOG_TYPES) 338 return self.ExecuteCommand(Command.GET_AVAILABLE_LOG_TYPES)
335 339
336 def IsAutoReporting(self): 340 def IsAutoReporting(self):
337 return self.ExecuteCommand(Command.IS_AUTO_REPORTING) 341 return self.ExecuteCommand(Command.IS_AUTO_REPORTING)
338 342
339 def SetAutoReporting(self, enabled): 343 def SetAutoReporting(self, enabled):
340 self.ExecuteCommand(Command.SET_AUTO_REPORTING, {'enabled': enabled}) 344 self.ExecuteCommand(Command.SET_AUTO_REPORTING, {'enabled': enabled})
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698