summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authornduca@chromium.org <nduca@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-09-06 01:24:44 +0000
committernduca@chromium.org <nduca@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-09-06 01:24:44 +0000
commit874a8e5feab3f68a94b3bda2f53a6e5c407490e4 (patch)
tree06722cd3602b940192412d14d75d24e55b1d0c41 /tools
parent8504fe5baf7b3e97e4d26ba4cb2b4e368c12586d (diff)
downloadchromium_src-874a8e5feab3f68a94b3bda2f53a6e5c407490e4.zip
chromium_src-874a8e5feab3f68a94b3bda2f53a6e5c407490e4.tar.gz
chromium_src-874a8e5feab3f68a94b3bda2f53a6e5c407490e4.tar.bz2
chrome_remote_control: detect desktop content-shell
TBR=dtu@chromium.org Review URL: https://chromiumcodereview.appspot.com/10911119 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@155088 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'tools')
-rw-r--r--tools/chrome_remote_control/chrome_remote_control/desktop_browser_finder.py67
-rw-r--r--tools/chrome_remote_control/chrome_remote_control/desktop_browser_finder_unittest.py24
2 files changed, 60 insertions, 31 deletions
diff --git a/tools/chrome_remote_control/chrome_remote_control/desktop_browser_finder.py b/tools/chrome_remote_control/chrome_remote_control/desktop_browser_finder.py
index b4ca1a2..7aa70f6 100644
--- a/tools/chrome_remote_control/chrome_remote_control/desktop_browser_finder.py
+++ b/tools/chrome_remote_control/chrome_remote_control/desktop_browser_finder.py
@@ -12,7 +12,14 @@ import possible_browser
"""Finds desktop browsers that can be controlled by chrome_remote_control."""
-ALL_BROWSER_TYPES = "exact,release,debug,canary,system"
+ALL_BROWSER_TYPES = ','.join([
+ 'exact',
+ 'release',
+ 'debug',
+ 'canary',
+ 'content-shell-debug',
+ 'content-shell-release',
+ 'system'])
class PossibleDesktopBrowser(possible_browser.PossibleBrowser):
"""A desktop browser that can be controlled."""
@@ -23,7 +30,7 @@ class PossibleDesktopBrowser(possible_browser.PossibleBrowser):
self._is_content_shell = is_content_shell
def __repr__(self):
- return "PossibleDesktopBrowser(type=%s)" % self.type
+ return 'PossibleDesktopBrowser(type=%s)' % self.type
def Create(self):
backend = desktop_browser_backend.DesktopBrowserBackend(
@@ -45,50 +52,54 @@ def FindAllAvailableBrowsers(options,
# Add the explicit browser executable if given.
if options.browser_executable:
if os.path.exists(options.browser_executable):
- browsers.append(PossibleDesktopBrowser("exact", options,
+ browsers.append(PossibleDesktopBrowser('exact', options,
options.browser_executable, False))
# Look for a browser in the standard chrome build locations.
if options.chrome_root:
chrome_root = options.chrome_root
else:
- chrome_root = os.path.join(os.path.dirname(__file__), "..", "..", "..")
+ chrome_root = os.path.join(os.path.dirname(__file__), '..', '..', '..')
if sys.platform == 'darwin':
- app_name = "Chromium.app/Contents/MacOS/Chromium"
+ chromium_app_name = 'Chromium.app/Contents/MacOS/Chromium'
+ content_shell_app_name = 'Content\ Shell.app/Contents/MacOS/Content Shell'
elif sys.platform.startswith('linux'):
- app_name = "chrome"
+ chromium_app_name = 'chrome'
+ content_shell_app_name = 'content_shell'
elif sys.platform.startswith('win'):
- app_name = "chrome.exe"
+ chromium_app_name = 'chrome.exe'
+ content_shell_app_name = 'content_shell.exe'
else:
- raise Exception("Platform not recognized")
+ raise Exception('Platform not recognized')
if sys.platform.startswith('win'):
- build_dir = "build"
+ build_dir = 'build'
else:
- build_dir = "out"
-
- debug_app = os.path.join(chrome_root, build_dir, "Debug", app_name)
- if os.path.exists(debug_app):
- browsers.append(PossibleDesktopBrowser("debug", options,
- debug_app, False))
-
- release_app = os.path.join(chrome_root, build_dir, "Release", app_name)
- if os.path.exists(release_app):
- browsers.append(PossibleDesktopBrowser("release", options,
- release_app, False))
+ build_dir = 'out'
+
+ # Add local builds
+ def AddIfFound(type, type_dir, app_name, content_shell):
+ app = os.path.join(chrome_root, build_dir, type_dir, app_name)
+ if os.path.exists(app):
+ browsers.append(PossibleDesktopBrowser(type, options,
+ app, content_shell))
+ AddIfFound('debug', 'Debug', chromium_app_name, False)
+ AddIfFound('content-shell-debug', 'Debug', content_shell_app_name, True)
+ AddIfFound('release', 'Release', chromium_app_name, False)
+ AddIfFound('content-shell-release', 'Release', content_shell_app_name, True)
# Mac-specific options.
if sys.platform == 'darwin':
- mac_canary = ("/Applications/Google Chrome Canary.app/"
- "Contents/MacOS/Google Chrome Canary")
- mac_system = "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"
+ mac_canary = ('/Applications/Google Chrome Canary.app/'
+ 'Contents/MacOS/Google Chrome Canary')
+ mac_system = '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome'
if os.path.exists(mac_canary):
- browsers.append(PossibleDesktopBrowser("canary", options,
+ browsers.append(PossibleDesktopBrowser('canary', options,
mac_canary, False))
if os.path.exists(mac_system):
- browsers.append(PossibleDesktopBrowser("system", options,
+ browsers.append(PossibleDesktopBrowser('system', options,
mac_system, False))
# Linux specific options.
@@ -103,7 +114,7 @@ def FindAllAvailableBrowsers(options,
pass
if found:
browsers.append(
- PossibleDesktopBrowser("system", options,
+ PossibleDesktopBrowser('system', options,
'google-chrome', False))
# Win32-specific options.
@@ -114,11 +125,11 @@ def FindAllAvailableBrowsers(options,
win_system = os.path.join(local_app_data,
'Google\\Chrome\\Application\\chrome.exe')
if os.path.exists(win_canary):
- browsers.append(PossibleDesktopBrowser("canary", options,
+ browsers.append(PossibleDesktopBrowser('canary', options,
win_canary, False))
if os.path.exists(win_system):
- browsers.append(PossibleDesktopBrowser("system", options,
+ browsers.append(PossibleDesktopBrowser('system', options,
win_system, False))
if len(browsers) and not has_display:
diff --git a/tools/chrome_remote_control/chrome_remote_control/desktop_browser_finder_unittest.py b/tools/chrome_remote_control/chrome_remote_control/desktop_browser_finder_unittest.py
index 8cb8ea8..ed580a5 100644
--- a/tools/chrome_remote_control/chrome_remote_control/desktop_browser_finder_unittest.py
+++ b/tools/chrome_remote_control/chrome_remote_control/desktop_browser_finder_unittest.py
@@ -119,6 +119,8 @@ class LinuxFindTest(FindTestBase):
self._files.append("/foo/chrome")
self._files.append("../../../out/Release/chrome")
self._files.append("../../../out/Debug/chrome")
+ self._files.append("../../../out/Release/content_shell")
+ self._files.append("../../../out/Debug/content_shell")
self._has_google_chrome_on_path = False
this = self
@@ -128,6 +130,13 @@ class LinuxFindTest(FindTestBase):
raise OSError("Not found")
self._subprocess_stub.call_hook = call_hook
+ def testFindAllWithExact(self):
+ types = self.DoFindAllTypes()
+ self.assertEquals(
+ set(types),
+ set(['debug', 'release',
+ 'content-shell-debug', 'content-shell-release']))
+
def testFindWithProvidedExecutable(self):
self._options.browser_executable = "/foo/chrome"
self.assertTrue("exact" in self.DoFindAllTypes())
@@ -142,11 +151,13 @@ class LinuxFindTest(FindTestBase):
self._has_google_chrome_on_path = False
del self._files[1]
- self.assertEquals([], self.DoFindAllTypes())
+ self.assertEquals(["content-shell-debug", "content-shell-release"],
+ self.DoFindAllTypes())
def testFindUsingRelease(self):
self.assertTrue("release" in self.DoFindAllTypes())
+
class WinFindTest(FindTestBase):
def setUp(self):
super(WinFindTest, self).setUp()
@@ -156,6 +167,8 @@ class WinFindTest(FindTestBase):
self._files.append('c:\\tmp\\chrome.exe')
self._files.append('..\\..\\..\\build\\Release\\chrome.exe')
self._files.append('..\\..\\..\\build\\Debug\\chrome.exe')
+ self._files.append('..\\..\\..\\build\\Release\\content_shell.exe')
+ self._files.append('..\\..\\..\\build\\Debug\\content_shell.exe')
self._files.append(self._os_stub.local_app_data + '\\' +
'Google\\Chrome\\Application\\chrome.exe')
self._files.append(self._os_stub.local_app_data + '\\' +
@@ -164,11 +177,16 @@ class WinFindTest(FindTestBase):
def testFindAllGivenDefaults(self):
types = self.DoFindAllTypes()
self.assertEquals(set(types),
- set(['debug', 'release', 'system', 'canary']))
+ set(['debug', 'release',
+ 'content-shell-debug', 'content-shell-release',
+ 'system', 'canary']))
def testFindAllWithExact(self):
self._options.browser_executable = 'c:\\tmp\\chrome.exe'
types = self.DoFindAllTypes()
self.assertEquals(
set(types),
- set(['exact', 'debug', 'release', 'system', 'canary']))
+ set(['exact',
+ 'debug', 'release',
+ 'content-shell-debug', 'content-shell-release',
+ 'system', 'canary']))