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

Side by Side Diff: chrome/test/pyautolib/chromeos/enable_testing.py

Issue 6410134: Use named automation interface to control primary chrome on ChromeOS (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: nit Created 9 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 #!/usr/bin/python
2
3 # Copyright (c) 2011 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file.
6
7 """Enable chrome testing interface on ChromeOS.
8
9 Enables chrome automation over a named automation channel on ChromeOS.
10 Also, allows passing extra flags to chrome (--extra-chrome-flags).
11 The path to named testing interface automation socket is printed out.
12
13 Needs to be run with superuser privileges.
14
15 Usage:
16 sudo python enable_testing.py --extra-chrome-flags="--homepage=about:blank"
17 """
18
19 import dbus
20 import optparse
21 import os
22
23
24 class EnableChromeTestingOnChromeOS(object):
25 """Helper to enable chrome testing interface on ChromeOS.
26
27 Also, can add additional flags to chrome to be used for testing.
28 """
29
30 SESSION_MANAGER_INTERFACE = 'org.chromium.SessionManagerInterface'
31 SESSION_MANAGER_PATH = '/org/chromium/SessionManager'
32 SESSION_MANAGER_SERVICE = 'org.chromium.SessionManager'
33
34 def _ParseArgs(self):
35 parser = optparse.OptionParser()
36 parser.add_option(
37 '', '--extra-chrome-flags', action='append', default=[],
Chris Masone 2011/02/22 15:58:41 What are these flags expected to be? Adding and r
Nirnimesh 2011/02/22 22:17:18 It's passed from pyauto.py. These are: '--homepag
38 help='Pass extra flags to chrome.')
39 self._options, self._args = parser.parse_args()
40
41 def Run(self):
42 self._ParseArgs()
43 assert os.geteuid() == 0, 'Needs superuser privileges.'
44 system_bus = dbus.SystemBus()
45 manager = dbus.Interface(system_bus.get_object(self.SESSION_MANAGER_SERVICE,
46 self.SESSION_MANAGER_PATH),
47 self.SESSION_MANAGER_INTERFACE)
48 print manager.EnableChromeTesting(True, self._options.extra_chrome_flags)
49
50
51 if __name__ == '__main__':
52 enabler = EnableChromeTestingOnChromeOS()
53 enabler.Run()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698