From 5bcfe167fdaae9e5de58ef0892c77793d66d7ac1 Mon Sep 17 00:00:00 2001 From: "alyssad@chromium.org" Date: Fri, 16 Jul 2010 20:51:57 +0000 Subject: New PyAuto hook to get saved passwords. BUG=36179 Review URL: http://codereview.chromium.org/2842047 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@52745 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/test/pyautolib/pyauto.py | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) (limited to 'chrome/test/pyautolib') diff --git a/chrome/test/pyautolib/pyauto.py b/chrome/test/pyautolib/pyauto.py index 10a4504..fc3e306 100644 --- a/chrome/test/pyautolib/pyauto.py +++ b/chrome/test/pyautolib/pyauto.py @@ -806,6 +806,43 @@ class PyUITest(pyautolib.PyUITestBase, unittest.TestCase): } return self._GetResultFromJSONRequest(cmd_dict) + def AddSavedPassword(self, username, password, time=None, window_index=0): + """Adds the given username-password combination to the saved passwords. + + Args: + username: a string representing the username + password: a string representing the password + window_index: window index, defaults to 0 + + Returns: + The success or failure of adding the password. In incognito mode, adding + the password should fail. Example return: + { "password_added": True } + + Raises: + JSONInterfaceError on error. + """ + cmd_dict = { # Prepare command for the json interface + 'command': 'AddSavedPassword', + 'username': username, + 'password': password, + 'time': time + } + return self._GetResultFromJSONRequest(cmd_dict) + + def GetSavedPasswords(self): + """Return the passwords currently saved. + + Returns: + A list of 2-item lists of username, password for all saved passwords. + Example: + { 'passwords': [['username1', 'password1'], ['username2', 'password2']] } + """ + cmd_dict = { # Prepare command for the json interface + 'command': 'GetSavedPasswords' + } + return self._GetResultFromJSONRequest(cmd_dict) + def SetTheme(self, crx_file_path): """Installs the given theme synchronously. -- cgit v1.1