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

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

Issue 11187036: Android: start upstreaming some of our perf tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Revert adb_commands Created 8 years, 1 month 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 """Finds android browsers that can be controlled by chrome_remote_control.""" 4 """Finds android browsers that can be controlled by chrome_remote_control."""
5 5
6 import logging 6 import logging
7 7
8 from chrome_remote_control import browser 8 from chrome_remote_control import browser
9 from chrome_remote_control import platform
9 from chrome_remote_control import possible_browser 10 from chrome_remote_control import possible_browser
10 from chrome_remote_control import cros_browser_backend 11 from chrome_remote_control import cros_browser_backend
11 from chrome_remote_control import cros_interface 12 from chrome_remote_control import cros_interface
12 13
13 ALL_BROWSER_TYPES = ','.join([ 14 ALL_BROWSER_TYPES = ','.join([
14 'cros-chrome', 15 'cros-chrome',
15 ]) 16 ])
16 17
17 class PossibleCrOSBrowser(possible_browser.PossibleBrowser): 18 class PossibleCrOSBrowser(possible_browser.PossibleBrowser):
18 """A launchable android browser instance.""" 19 """A launchable android browser instance."""
19 def __init__(self, browser_type, options, *args): 20 def __init__(self, browser_type, options, *args):
20 super(PossibleCrOSBrowser, self).__init__( 21 super(PossibleCrOSBrowser, self).__init__(
21 browser_type, options) 22 browser_type, options)
22 self._args = args 23 self._args = args
23 24
24 def __repr__(self): 25 def __repr__(self):
25 return 'PossibleCrOSBrowser(browser_type=%s)' % self.browser_type 26 return 'PossibleCrOSBrowser(browser_type=%s)' % self.browser_type
26 27
27 def Create(self): 28 def Create(self):
28 backend = cros_browser_backend.CrOSBrowserBackend( 29 backend = cros_browser_backend.CrOSBrowserBackend(
29 self.browser_type, self._options, *self._args) 30 self.browser_type, self._options, *self._args)
30 return browser.Browser(backend) 31 return browser.Browser(backend, platform.Platform())
31 32
32 def FindAllAvailableBrowsers(options): 33 def FindAllAvailableBrowsers(options):
33 """Finds all the desktop browsers available on this machine.""" 34 """Finds all the desktop browsers available on this machine."""
34 if options.cros_remote == None: 35 if options.cros_remote == None:
35 logging.debug('No --remote specified, will not probe for CrOS.') 36 logging.debug('No --remote specified, will not probe for CrOS.')
36 return [] 37 return []
37 38
38 if not cros_interface.HasSSH(): 39 if not cros_interface.HasSSH():
39 logging.debug('ssh not found. Cannot talk to CrOS devices.') 40 logging.debug('ssh not found. Cannot talk to CrOS devices.')
40 return [] 41 return []
(...skipping 25 matching lines...) Expand all
66 logging.warn('') 67 logging.warn('')
67 logging.warn('P.S. Please, tell your manager how INANE this is.') 68 logging.warn('P.S. Please, tell your manager how INANE this is.')
68 else: 69 else:
69 logging.warn(str(ex)) 70 logging.warn(str(ex))
70 return [] 71 return []
71 72
72 if not cri.FileExistsOnDevice('/opt/google/chrome/chrome'): 73 if not cri.FileExistsOnDevice('/opt/google/chrome/chrome'):
73 logging.warn('Could not find a chrome on ' % cri.hostname) 74 logging.warn('Could not find a chrome on ' % cri.hostname)
74 75
75 return [PossibleCrOSBrowser('cros-chrome', options, False, cri)] 76 return [PossibleCrOSBrowser('cros-chrome', options, False, cri)]
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698