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

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

Issue 12278015: [Telemetry] Reorganize everything. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Re-add shebangs. Created 7 years, 10 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
(Empty)
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
3 # found in the LICENSE file.
4 """Finds android browsers that can be controlled by telemetry."""
5
6 import logging
7
8 from telemetry import browser
9 from telemetry import platform
10 from telemetry import possible_browser
11 from telemetry import cros_browser_backend
12 from telemetry import cros_interface
13
14 ALL_BROWSER_TYPES = ','.join([
15 'cros-chrome',
16 ])
17
18 class PossibleCrOSBrowser(possible_browser.PossibleBrowser):
19 """A launchable chromeos browser instance."""
20 def __init__(self, browser_type, options, *args):
21 super(PossibleCrOSBrowser, self).__init__(browser_type, options)
22 self._args = args
23
24 def __repr__(self):
25 return 'PossibleCrOSBrowser(browser_type=%s)' % self.browser_type
26
27 def Create(self):
28 backend = cros_browser_backend.CrOSBrowserBackend(
29 self.browser_type, self._options, *self._args)
30 b = browser.Browser(backend, platform.Platform())
31 backend.SetBrowser(b)
32 return b
33
34 def SupportsOptions(self, options):
35 return True
36
37 def FindAllAvailableBrowsers(options):
38 """Finds all the desktop browsers available on this machine."""
39 if options.cros_remote == None:
40 logging.debug('No --remote specified, will not probe for CrOS.')
41 return []
42
43 if not cros_interface.HasSSH():
44 logging.debug('ssh not found. Cannot talk to CrOS devices.')
45 return []
46 cri = cros_interface.CrOSInterface(options.cros_remote,
47 options.cros_ssh_identity)
48
49 # Check ssh
50 try:
51 cri.TryLogin()
52 except cros_interface.LoginException, ex:
53 if isinstance(ex, cros_interface.KeylessLoginRequiredException):
54 logging.warn('Could not ssh into %s. Your device must be configured',
55 options.cros_remote)
56 logging.warn('to allow passwordless login as root.')
57 logging.warn('For a test-build device, pass this to your script:')
58 logging.warn(' --identity $(CHROMITE)/ssh_keys/testing_rsa')
59 logging.warn('')
60 logging.warn('For a developer-mode device, the steps are:')
61 logging.warn(' - Ensure you have an id_rsa.pub (etc) on this computer')
62 logging.warn(' - On the chromebook:')
63 logging.warn(' - Control-Alt-T; shell; sudo -s')
64 logging.warn(' - openssh-server start')
65 logging.warn(' - scp <this machine>:.ssh/id_rsa.pub /tmp/')
66 logging.warn(' - mkdir /root/.ssh')
67 logging.warn(' - chown go-rx /root/.ssh')
68 logging.warn(' - cat /tmp/id_rsa.pub >> /root/.ssh/authorized_keys')
69 logging.warn(' - chown 0600 /root/.ssh/authorized_keys')
70 logging.warn('There, that was easy!')
71 logging.warn('')
72 logging.warn('P.S. Please, tell your manager how INANE this is.')
73 else:
74 logging.warn(str(ex))
75 return []
76
77 if not cri.FileExistsOnDevice('/opt/google/chrome/chrome'):
78 logging.warn('Could not find a chrome on ' % cri.hostname)
79
80 return [PossibleCrOSBrowser('cros-chrome', options, cri)]
OLDNEW
« no previous file with comments | « tools/telemetry/telemetry/cros_browser_backend.py ('k') | tools/telemetry/telemetry/cros_browser_finder_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698