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

Side by Side Diff: components/cronet/android/test/javaperftests/android_rndis_forwarder.py

Issue 1945023004: [Cronet] run pylint in Cronet presubmit check (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
« no previous file with comments | « components/cronet/PRESUBMIT.py ('k') | components/cronet/android/test/javaperftests/run.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2016 The Chromium Authors. All rights reserved. 1 # Copyright 2016 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 atexit 5 import atexit
6 import logging
6 import os 7 import os
7 import re 8 import re
8 import socket 9 import socket
9 import struct 10 import struct
10 import subprocess 11 import subprocess
11 12
12 from telemetry.core import platform 13 from telemetry.core import platform
14 from telemetry.core import util
13 from telemetry.internal.platform import android_device 15 from telemetry.internal.platform import android_device
16 from telemetry.internal.util import binary_manager
14 17
15 from devil.android import device_errors 18 from devil.android import device_errors
16 from devil.android import device_utils 19 from devil.android import device_utils
17 20
18 class AndroidRndisForwarder(object): 21 class AndroidRndisForwarder(object):
19 """Forwards traffic using RNDIS. Assumes the device has root access.""" 22 """Forwards traffic using RNDIS. Assumes the device has root access."""
20 23
21 def __init__(self, device, rndis_configurator): 24 def __init__(self, device, rndis_configurator):
22 self._device = device 25 self._device = device
23 self._rndis_configurator = rndis_configurator 26 self._rndis_configurator = rndis_configurator
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after
406 assert host_address, 'Interface %s could not be configured.' % host_iface 409 assert host_address, 'Interface %s could not be configured.' % host_iface
407 410
408 host_ip, netmask = host_address # pylint: disable=unpacking-non-sequence 411 host_ip, netmask = host_address # pylint: disable=unpacking-non-sequence
409 network = host_ip & netmask 412 network = host_ip & netmask
410 413
411 if not _IsNetworkUnique(network, addresses): 414 if not _IsNetworkUnique(network, addresses):
412 logging.warning( 415 logging.warning(
413 'The IP address configuration %s of %s is not unique!\n' 416 'The IP address configuration %s of %s is not unique!\n'
414 'Check your /etc/network/interfaces. If this overlap is intended,\n' 417 'Check your /etc/network/interfaces. If this overlap is intended,\n'
415 'you might need to use: ip rule add from <device_ip> lookup <table>\n' 418 'you might need to use: ip rule add from <device_ip> lookup <table>\n'
416 'or add the interface to a bridge in order to route to this network.' 419 'or add the interface to a bridge in order to route to this network.',
417 % (host_address, host_iface) 420 host_address, host_iface
418 ) 421 )
419 422
420 # Find unused IP address. 423 # Find unused IP address.
421 used_addresses = [addr for addr, _ in addresses] 424 used_addresses = [addr for addr, _ in addresses]
422 used_addresses += [self._IpPrefix2AddressMask(addr)[0] 425 used_addresses += [self._IpPrefix2AddressMask(addr)[0]
423 for addr in self._GetDeviceAddresses(device_iface)] 426 for addr in self._GetDeviceAddresses(device_iface)]
424 used_addresses += [host_ip] 427 used_addresses += [host_ip]
425 428
426 device_ip = _NextUnusedAddress(network, netmask, used_addresses) 429 device_ip = _NextUnusedAddress(network, netmask, used_addresses)
427 assert device_ip, ('The network %s on %s is full.' % 430 assert device_ip, ('The network %s on %s is full.' %
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
468 device_iface, host_iface = self._CheckEnableRndis(force) 471 device_iface, host_iface = self._CheckEnableRndis(force)
469 self._ConfigureNetwork(device_iface, host_iface) 472 self._ConfigureNetwork(device_iface, host_iface)
470 self.OverrideRoutingPolicy() 473 self.OverrideRoutingPolicy()
471 # Sometimes the first packet will wake up the connection. 474 # Sometimes the first packet will wake up the connection.
472 for _ in range(3): 475 for _ in range(3):
473 if self._TestConnectivity(): 476 if self._TestConnectivity():
474 return 477 return
475 force = True 478 force = True
476 self.RestoreRoutingPolicy() 479 self.RestoreRoutingPolicy()
477 raise Exception('No connectivity, giving up.') 480 raise Exception('No connectivity, giving up.')
OLDNEW
« no previous file with comments | « components/cronet/PRESUBMIT.py ('k') | components/cronet/android/test/javaperftests/run.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698