OLD | NEW |
1 # Copyright 2015 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 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 from recipe_engine import recipe_api | 5 from recipe_engine import recipe_api |
6 | 6 |
7 | 7 |
8 class AmpApi(recipe_api.RecipeApi): | 8 class AmpApi(recipe_api.RecipeApi): |
9 | 9 |
10 def __init__(self, *args, **kwargs): | 10 def __init__(self, *args, **kwargs): |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 api_port: The port of the AMP API endpoint. | 231 api_port: The port of the AMP API endpoint. |
232 api_protocol: The protocol to use to connect to the AMP API endpoint. | 232 api_protocol: The protocol to use to connect to the AMP API endpoint. |
233 network_config: Use to have AMP run tests in a simulated network | 233 network_config: Use to have AMP run tests in a simulated network |
234 environment. See the availible network environment options at | 234 environment. See the availible network environment options at |
235 https://appurify.atlassian.net/wiki/display/APD/ | 235 https://appurify.atlassian.net/wiki/display/APD/ |
236 Run+Configurations+-+Test+and+Network | 236 Run+Configurations+-+Test+and+Network |
237 | 237 |
238 Returns: | 238 Returns: |
239 A list of command-line arguments as strings. | 239 A list of command-line arguments as strings. |
240 """ | 240 """ |
241 if not api_address: | 241 assert api_address, 'api_address not specified' |
242 raise self.m.step.StepFailure('api_address not specified') | 242 assert api_port, 'api_port not specified' |
243 if not api_port: | 243 assert api_protocol, 'api_protocol not specified' |
244 raise self.m.step.StepFailure('api_port not specified') | 244 assert not (device_minimum_os and device_os), ( |
245 if not api_protocol: | 245 'cannot specify both device_minimum_os and device_os') |
246 raise self.m.step.StepFailure('api_protocol not specified') | |
247 if device_minimum_os and device_os: | |
248 raise self.m.step.StepFailure( | |
249 'cannot specify both device_minimum_os and device_os') | |
250 | 246 |
251 amp_args = [ | 247 amp_args = [ |
252 '--enable-platform-mode', | 248 '--enable-platform-mode', |
253 '-e', 'remote_device', | 249 '-e', 'remote_device', |
254 '--api-key-file', | 250 '--api-key-file', |
255 self.m.path['build'].join('site_config', '.amp_api_key'), | 251 self.m.path['build'].join('site_config', '.amp_api_key'), |
256 '--api-secret-file', | 252 '--api-secret-file', |
257 self.m.path['build'].join('site_config', '.amp_api_secret'), | 253 self.m.path['build'].join('site_config', '.amp_api_secret'), |
258 '--api-address', api_address, | 254 '--api-address', api_address, |
259 '--api-port', api_port, | 255 '--api-port', api_port, |
(...skipping 13 matching lines...) Expand all Loading... |
273 amp_args += ['--remote-device-os', d] | 269 amp_args += ['--remote-device-os', d] |
274 | 270 |
275 if device_timeout: | 271 if device_timeout: |
276 amp_args += ['--remote-device-timeout', device_timeout] | 272 amp_args += ['--remote-device-timeout', device_timeout] |
277 | 273 |
278 if network_config: | 274 if network_config: |
279 amp_args += ['--network-config', network_config] | 275 amp_args += ['--network-config', network_config] |
280 | 276 |
281 return amp_args | 277 return amp_args |
282 | 278 |
OLD | NEW |