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

Side by Side Diff: tools/chrome_remote_control/chrome_remote_control/cros_browser_finder.py

Issue 10984018: [chrome_remote_control] Add pylint to PRESUMMIT and fix lint (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: for landing Created 8 years, 2 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 | Annotate | Revision Log
OLDNEW
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2012 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 import os as real_os 4 """Finds android browsers that can be controlled by chrome_remote_control."""
5 import sys as real_sys 5
6 import subprocess as real_subprocess
7 import logging 6 import logging
8 import re
9 7
10 import browser 8 from chrome_remote_control import browser
11 import possible_browser 9 from chrome_remote_control import possible_browser
12 import cros_browser_backend 10 from chrome_remote_control import cros_browser_backend
13 import cros_interface as real_cros_interface 11 from chrome_remote_control import (
14 12 cros_interface as real_cros_interface)
15 """Finds android browsers that can be controlled by chrome_remote_control."""
16 13
17 ALL_BROWSER_TYPES = ','.join([ 14 ALL_BROWSER_TYPES = ','.join([
18 'cros-chrome', 15 'cros-chrome',
19 ]) 16 ])
20 17
21 class PossibleCrOSBrowser(possible_browser.PossibleBrowser): 18 class PossibleCrOSBrowser(possible_browser.PossibleBrowser):
22 """A launchable android browser instance.""" 19 """A launchable android browser instance."""
23 def __init__(self, browser_type, options, *args): 20 def __init__(self, browser_type, options, *args):
24 super(PossibleCrOSBrowser, self).__init__( 21 super(PossibleCrOSBrowser, self).__init__(
25 browser_type, options) 22 browser_type, options)
26 self._args = args 23 self._args = args
27 24
28 def __repr__(self): 25 def __repr__(self):
29 return 'PossibleCrOSBrowser(browser_type=%s)' % self.browser_type 26 return 'PossibleCrOSBrowser(browser_type=%s)' % self.browser_type
30 27
31 def Create(self): 28 def Create(self):
32 backend = cros_browser_backend.CrOSBrowserBackend( 29 backend = cros_browser_backend.CrOSBrowserBackend(
33 self.browser_type, self._options, *self._args) 30 self.browser_type, self._options, *self._args)
34 return browser.Browser(backend) 31 return browser.Browser(backend)
35 32
36 def FindAllAvailableBrowsers(options, 33 def FindAllAvailableBrowsers(options,
37 subprocess = real_subprocess,
38 cros_interface = real_cros_interface): 34 cros_interface = real_cros_interface):
39 """Finds all the desktop browsers available on this machine.""" 35 """Finds all the desktop browsers available on this machine."""
40 if options.cros_remote == None: 36 if options.cros_remote == None:
41 logging.debug('No --remote specified, will not probe for CrOS.') 37 logging.debug('No --remote specified, will not probe for CrOS.')
42 return [] 38 return []
43 39
44 if not cros_interface.HasSSH(): 40 if not cros_interface.HasSSH():
45 logging.debug('ssh not found. Cannot talk to CrOS devices.') 41 logging.debug('ssh not found. Cannot talk to CrOS devices.')
46 return [] 42 return []
47 cri = cros_interface.CrOSInterface(options.cros_remote) 43 cri = cros_interface.CrOSInterface(options.cros_remote)
(...skipping 17 matching lines...) Expand all
65 logging.warn(' - cat /tmp/id_rsa.pub >> /root/.ssh/authorized_keys') 61 logging.warn(' - cat /tmp/id_rsa.pub >> /root/.ssh/authorized_keys')
66 logging.warn(' - chown 0600 /root/.ssh/authorized_keys') 62 logging.warn(' - chown 0600 /root/.ssh/authorized_keys')
67 logging.warn('There, that was easy!') 63 logging.warn('There, that was easy!')
68 logging.warn('') 64 logging.warn('')
69 logging.warn('P.S. Please, make tell your manager how INANE this.') 65 logging.warn('P.S. Please, make tell your manager how INANE this.')
70 else: 66 else:
71 logging.warn(str(ex)) 67 logging.warn(str(ex))
72 return [] 68 return []
73 69
74 if not cri.FileExistsOnDevice('/opt/google/chrome/chrome'): 70 if not cri.FileExistsOnDevice('/opt/google/chrome/chrome'):
75 logging.warn('Could not find a chrome on ' % self._hostname) 71 logging.warn('Could not find a chrome on ' % cri.hostname)
76 72
77 return [PossibleCrOSBrowser('cros-chrome', options, False, cri)] 73 return [PossibleCrOSBrowser('cros-chrome', options, False, cri)]
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698