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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/test/pyautolib/chromeos/chromeos_utils.py ('k') | chrome/test/pyautolib/pyauto.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/pyautolib/chromeos/enable_testing.py
diff --git a/chrome/test/pyautolib/chromeos/enable_testing.py b/chrome/test/pyautolib/chromeos/enable_testing.py
new file mode 100644
index 0000000000000000000000000000000000000000..5191cebd529dc25295d05d9aa3a5319d8e6a3356
--- /dev/null
+++ b/chrome/test/pyautolib/chromeos/enable_testing.py
@@ -0,0 +1,53 @@
+#!/usr/bin/python
+
+# Copyright (c) 2011 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""Enable chrome testing interface on ChromeOS.
+
+Enables chrome automation over a named automation channel on ChromeOS.
+Also, allows passing extra flags to chrome (--extra-chrome-flags).
+The path to named testing interface automation socket is printed out.
+
+Needs to be run with superuser privileges.
+
+Usage:
+ sudo python enable_testing.py --extra-chrome-flags="--homepage=about:blank"
+"""
+
+import dbus
+import optparse
+import os
+
+
+class EnableChromeTestingOnChromeOS(object):
+ """Helper to enable chrome testing interface on ChromeOS.
+
+ Also, can add additional flags to chrome to be used for testing.
+ """
+
+ SESSION_MANAGER_INTERFACE = 'org.chromium.SessionManagerInterface'
+ SESSION_MANAGER_PATH = '/org/chromium/SessionManager'
+ SESSION_MANAGER_SERVICE = 'org.chromium.SessionManager'
+
+ def _ParseArgs(self):
+ parser = optparse.OptionParser()
+ parser.add_option(
+ '', '--extra-chrome-flags', action='append', default=[],
+ help='Pass extra flags to chrome.')
+ self._options, self._args = parser.parse_args()
+
+ def Run(self):
+ self._ParseArgs()
+ assert os.geteuid() == 0, 'Needs superuser privileges.'
+ system_bus = dbus.SystemBus()
+ manager = dbus.Interface(system_bus.get_object(self.SESSION_MANAGER_SERVICE,
+ self.SESSION_MANAGER_PATH),
+ self.SESSION_MANAGER_INTERFACE)
+ print manager.EnableChromeTesting(True, self._options.extra_chrome_flags)
+
+
+if __name__ == '__main__':
+ enabler = EnableChromeTestingOnChromeOS()
+ enabler.Run()
« no previous file with comments | « chrome/test/pyautolib/chromeos/chromeos_utils.py ('k') | chrome/test/pyautolib/pyauto.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698