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

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

Issue 8680018: Fix python scripts in src/chrome/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: copyright Created 9 years 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 #!/usr/bin/python 1 #!/usr/bin/env python
2
3 # Copyright (c) 2011 The Chromium Authors. All rights reserved. 2 # 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 3 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 4 # found in the LICENSE file.
6 5
7 """Enable chrome testing interface on ChromeOS. 6 """Enable chrome testing interface on ChromeOS.
8 7
9 Enables chrome automation over a named automation channel on ChromeOS. 8 Enables chrome automation over a named automation channel on ChromeOS.
10 Also, allows passing extra flags to chrome (--extra-chrome-flags). 9 Also, allows passing extra flags to chrome (--extra-chrome-flags).
11 The path to named testing interface automation socket is printed out. 10 The path to named testing interface automation socket is printed out.
12 11
13 Needs to be run with superuser privileges. 12 Needs to be run with superuser privileges.
14 13
15 Usage: 14 Usage:
16 sudo python enable_testing.py --extra-chrome-flags="--homepage=about:blank" 15 sudo python enable_testing.py --extra-chrome-flags="--homepage=about:blank"
17 """ 16 """
18 17
19 import dbus 18 import dbus
20 import optparse 19 import optparse
21 import os 20 import os
21 import sys
22 22
23 23
24 class EnableChromeTestingOnChromeOS(object): 24 class EnableChromeTestingOnChromeOS(object):
25 """Helper to enable chrome testing interface on ChromeOS. 25 """Helper to enable chrome testing interface on ChromeOS.
26 26
27 Also, can add additional flags to chrome to be used for testing. 27 Also, can add additional flags to chrome to be used for testing.
28 """ 28 """
29 29
30 SESSION_MANAGER_INTERFACE = 'org.chromium.SessionManagerInterface' 30 SESSION_MANAGER_INTERFACE = 'org.chromium.SessionManagerInterface'
31 SESSION_MANAGER_PATH = '/org/chromium/SessionManager' 31 SESSION_MANAGER_PATH = '/org/chromium/SessionManager'
32 SESSION_MANAGER_SERVICE = 'org.chromium.SessionManager' 32 SESSION_MANAGER_SERVICE = 'org.chromium.SessionManager'
33 33
34 def _ParseArgs(self): 34 def _ParseArgs(self):
35 parser = optparse.OptionParser() 35 parser = optparse.OptionParser()
36 parser.add_option( 36 parser.add_option(
37 '', '--extra-chrome-flags', action='append', default=[], 37 '', '--extra-chrome-flags', action='append', default=[],
38 help='Pass extra flags to chrome.') 38 help='Pass extra flags to chrome.')
39 self._options, self._args = parser.parse_args() 39 self._options, self._args = parser.parse_args()
40 40
41 def Run(self): 41 def Run(self):
42 self._ParseArgs() 42 self._ParseArgs()
43 assert os.geteuid() == 0, 'Needs superuser privileges.' 43 assert os.geteuid() == 0, 'Needs superuser privileges.'
44 system_bus = dbus.SystemBus() 44 system_bus = dbus.SystemBus()
45 manager = dbus.Interface(system_bus.get_object(self.SESSION_MANAGER_SERVICE, 45 manager = dbus.Interface(system_bus.get_object(self.SESSION_MANAGER_SERVICE,
46 self.SESSION_MANAGER_PATH), 46 self.SESSION_MANAGER_PATH),
47 self.SESSION_MANAGER_INTERFACE) 47 self.SESSION_MANAGER_INTERFACE)
48 print manager.EnableChromeTesting(True, self._options.extra_chrome_flags) 48 print manager.EnableChromeTesting(True, self._options.extra_chrome_flags)
49 return 0
49 50
50 51
51 if __name__ == '__main__': 52 if __name__ == '__main__':
52 enabler = EnableChromeTestingOnChromeOS() 53 sys.exit(EnableChromeTestingOnChromeOS().Run())
53 enabler.Run()
OLDNEW
« no previous file with comments | « chrome/test/pyautolib/chromeos/chromeos_utils.py ('k') | chrome/test/pyautolib/chromeos/file_browser.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698