Commit 7f29653c authored by dtu@chromium.org's avatar dtu@chromium.org

Add PyAuto automation call GetPanelInfo(). Includes basic information: title,...

Add PyAuto automation call GetPanelInfo(). Includes basic information: title, url, renderer pid, and whether it is incognito.

BUG=chromium-os:14135
TEST=Manual.

Review URL: http://codereview.chromium.org/7108025

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@88439 0039d316-1c4b-4281-b951-d872f2087c98
parent 0ead3635
...@@ -2586,6 +2586,22 @@ void TestingAutomationProvider::GetBrowserInfo( ...@@ -2586,6 +2586,22 @@ void TestingAutomationProvider::GetBrowserInfo(
browser_item->SetInteger("selected_tab", browser->active_index()); browser_item->SetInteger("selected_tab", browser->active_index());
browser_item->SetBoolean("incognito", browser_item->SetBoolean("incognito",
browser->profile()->IsOffTheRecord()); browser->profile()->IsOffTheRecord());
std::string type;
switch (browser->type()) {
case Browser::TYPE_TABBED:
type = "tabbed";
break;
case Browser::TYPE_POPUP:
type = "popup";
break;
case Browser::TYPE_PANEL:
type = "panel";
break;
default:
type = "unknown";
break;
}
browser_item->SetString("type", type);
// For each window, add info about all tabs in a list of dictionaries, // For each window, add info about all tabs in a list of dictionaries,
// one dictionary item per tab. // one dictionary item per tab.
ListValue* tabs = new ListValue; ListValue* tabs = new ListValue;
......
...@@ -1220,6 +1220,7 @@ class PyUITest(pyautolib.PyUITestBase, unittest.TestCase): ...@@ -1220,6 +1220,7 @@ class PyUITest(pyautolib.PyUITestBase, unittest.TestCase):
u'renderer_pid': 93929, u'renderer_pid': 93929,
u'url': u'http://slides.html5rocks.com/#slide14'}, u'url': u'http://slides.html5rocks.com/#slide14'},
], ],
u'type': u'tabbed',
u'width': 925, u'width': 925,
u'x': 26, u'x': 26,
u'y': 44}]} u'y': 44}]}
...@@ -2948,6 +2949,38 @@ class PyUITest(pyautolib.PyUITestBase, unittest.TestCase): ...@@ -2948,6 +2949,38 @@ class PyUITest(pyautolib.PyUITestBase, unittest.TestCase):
cmd_dict = { 'command': 'GetBatteryInfo' } cmd_dict = { 'command': 'GetBatteryInfo' }
return self._GetResultFromJSONRequest(cmd_dict, windex=-1) return self._GetResultFromJSONRequest(cmd_dict, windex=-1)
def GetPanelInfo(self):
"""Get details about open ChromeOS panels.
A panel is actually a type of browser window, so all of
this information is also available using GetBrowserInfo().
Returns:
A dictionary.
Sample:
[{ 'incognito': False,
'renderer_pid': 4820,
'title': u'Downloads',
'url': u'chrome://active-downloads/'}]
Raises:
pyauto_errors.JSONInterfaceError if the automation call returns an error.
"""
panels = []
for browser in self.GetBrowserInfo()['windows']:
if browser['type'] != 'panel':
continue
panel = {}
panels.append(panel)
tab = browser['tabs'][0]
panel['incognito'] = browser['incognito']
panel['renderer_pid'] = tab['renderer_pid']
panel['title'] = self.GetActiveTabTitle(browser['index'])
panel['url'] = tab['url']
return panels
def GetNetworkInfo(self): def GetNetworkInfo(self):
"""Get details about ethernet, wifi, and cellular networks on chromeos. """Get details about ethernet, wifi, and cellular networks on chromeos.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment