summaryrefslogtreecommitdiffstats
path: root/chrome/test/pyautolib/pyauto.py
diff options
context:
space:
mode:
authoralyssad@chromium.org <alyssad@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-15 19:00:07 +0000
committeralyssad@chromium.org <alyssad@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-15 19:00:07 +0000
commitc5aa5321a9bbc18daef554c8fe60030d193d1360 (patch)
tree051c43c8edaf5bc420f6ecdab6039e3a2a0df06d /chrome/test/pyautolib/pyauto.py
parent196562021d98360096a71ad3b6e6f5e1181278a4 (diff)
downloadchromium_src-c5aa5321a9bbc18daef554c8fe60030d193d1360.zip
chromium_src-c5aa5321a9bbc18daef554c8fe60030d193d1360.tar.gz
chromium_src-c5aa5321a9bbc18daef554c8fe60030d193d1360.tar.bz2
Adding a new PyAuto hook for importing settings.
BUG=43231 Review URL: http://codereview.chromium.org/2923010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@52508 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test/pyautolib/pyauto.py')
-rw-r--r--chrome/test/pyautolib/pyauto.py35
1 files changed, 35 insertions, 0 deletions
diff --git a/chrome/test/pyautolib/pyauto.py b/chrome/test/pyautolib/pyauto.py
index c25b893..72304d5 100644
--- a/chrome/test/pyautolib/pyauto.py
+++ b/chrome/test/pyautolib/pyauto.py
@@ -757,6 +757,41 @@ class PyUITest(pyautolib.PyUITestBase, unittest.TestCase):
finally:
shutil.rmtree(tempdir)
+ def ImportSettings(self, import_from, first_run, import_items):
+ """Import the specified import items from the specified browser.
+
+ Implements the features available in the "Import Settings" part of the
+ first-run UI dialog.
+
+ Args:
+ import_from: A string indicating which browser to import from. Possible
+ strings (depending on which browsers are installed on the
+ machine) are: 'Mozilla Firefox', 'Google Toolbar',
+ 'Microsoft Internet Explorer', 'Safari'
+ first_run: A boolean indicating whether this is the first run of
+ the browser.
+ If it is not the first run then:
+ 1) Bookmarks are only imported to the bookmarks bar if there
+ aren't already bookmarks.
+ 2) The bookmark bar is shown.
+ import_items: A list of strings indicating which items to import.
+ Strings that can be in the list are:
+ HISTORY, FAVORITES, PASSWORDS, SEARCH_ENGINES, HOME_PAGE,
+ ALL (note: COOKIES is not supported by the browser yet)
+ Raises:
+ pyauto_errors.JSONInterfaceError if the automation call returns an error.
+ """
+ cmd_dict = { # Prepare command for the json interface
+ 'command': 'ImportSettings',
+ 'import_from': import_from,
+ 'first_run': first_run,
+ 'import_items': import_items
+ }
+ ret_dict = json.loads(self._SendJSONRequest(0, json.dumps(cmd_dict)))
+ if ret_dict.has_key('error'):
+ raise JSONInterfaceError(ret_dict['error'])
+ return ret_dict
+
def ClearBrowsingData(self, to_remove, time_period):
"""Clear the specified browsing data. Implements the features available in
the "ClearBrowsingData" UI.