diff options
author | kamrik@chromium.org <kamrik@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-12 01:46:13 +0000 |
---|---|---|
committer | kamrik@chromium.org <kamrik@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-12 01:46:13 +0000 |
commit | c654d8102e848b058f111fa3ea4e004e4cd770e7 (patch) | |
tree | f748f6cfbf64a27c8bea3ad735742ea308ae35b6 | |
parent | 1d7df116d9d818fb59d241058c5e793e24ceb82a (diff) | |
download | chromium_src-c654d8102e848b058f111fa3ea4e004e4cd770e7.zip chromium_src-c654d8102e848b058f111fa3ea4e004e4cd770e7.tar.gz chromium_src-c654d8102e848b058f111fa3ea4e004e4cd770e7.tar.bz2 |
Wrap AppendTab function so it can accept string URLs.
The pyautolib.PyUITestBase.AppendTab function can only accept GURL objects.
Being able to pass string URLs is much more convenient.
Additional rationale:
GURL class is not exposed in some derived classes (e.g. PyUITestInAutotest)
GURL objects are not easily serializable which is needed in RemotePyAuto
BUG=chromium-os:30562
TEST=run an AutoTest derived from cros_ui_test.UITest that calls
self.pyauto.AppendTab('about:blank')
Review URL: https://chromiumcodereview.appspot.com/10379030
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@136739 0039d316-1c4b-4281-b951-d872f2087c98
-rwxr-xr-x | chrome/test/pyautolib/pyauto.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/chrome/test/pyautolib/pyauto.py b/chrome/test/pyautolib/pyauto.py index 0eb5765..f96a5ae 100755 --- a/chrome/test/pyautolib/pyauto.py +++ b/chrome/test/pyautolib/pyauto.py @@ -3159,6 +3159,25 @@ class PyUITest(pyautolib.PyUITestBase, unittest.TestCase): } return self._GetResultFromJSONRequest(cmd_dict, windex=None) + def AppendTab(self, url, windex=0): + """Create a new tab. + + Create a new tab at the end of given or first browser window + and activate it. Blocks until the url is loaded. + + Args: + url: The url to load, can be string or a GURL object. + windex: Index of the window to open a tab in. Default 0 - first window. + + Returns: + True on success. + """ + if type(url) is GURL: + gurl = url + else: + gurl = GURL(url) + return pyautolib.PyUITestBase.AppendTab(self, gurl, windex) + def WaitUntilNavigationCompletes(self, tab_index=0, windex=0): """Wait until the specified tab is done navigating. |