 Chromium Code Reviews
 Chromium Code Reviews Issue 5379007:
  Adding pyauto tests to passwords.py...  (Closed) 
  Base URL: svn://svn.chromium.org/chrome/trunk/src/chrome/test/
    
  
    Issue 5379007:
  Adding pyauto tests to passwords.py...  (Closed) 
  Base URL: svn://svn.chromium.org/chrome/trunk/src/chrome/test/| Index: functional/test_utils.py | 
| =================================================================== | 
| --- functional/test_utils.py (revision 67497) | 
| +++ functional/test_utils.py (working copy) | 
| @@ -30,7 +30,7 @@ | 
| test.DownloadAndWaitForStart(file_url) | 
| test.WaitForAllDownloadsToComplete() | 
| - | 
| + | 
| 
Nirnimesh
2010/12/08 20:59:17
Remove the extra blank space
 
sunandt
2010/12/08 22:46:34
Done.
 | 
| def RemoveDownloadedTestFile(test, file_name): | 
| """Delete a file from the downloads directory. | 
| @@ -43,8 +43,8 @@ | 
| pyauto_utils.RemovePath(downloaded_pkg) | 
| pyauto_utils.RemovePath(downloaded_pkg + '.crdownload') | 
| - | 
| -def GoogleAccountsLogin(test, url, username, password): | 
| + | 
| 
Nirnimesh
2010/12/08 20:59:17
ditto
 
sunandt
2010/12/08 22:46:34
Done.
 | 
| +def GoogleAccountsLogin(test, url, username, password, tab_index=0, windex=0): | 
| """Log into Google Accounts. | 
| Attempts to login to Google by entering the username/password into the google | 
| @@ -54,19 +54,21 @@ | 
| test: derived from pyauto.PyUITest - base class for UI test cases. | 
| username: users login input. | 
| password: users login password input. | 
| 
Nirnimesh
2010/12/08 20:59:17
document the args
 
sunandt
2010/12/08 22:46:34
Done.
 | 
| - """ | 
| - test.NavigateToURL('https://www.google.com/accounts/') | 
| - email_id = 'document.getElementById("Email").value = \"%s\"; ' \ | 
| + """ | 
| 
Nirnimesh
2010/12/08 20:59:17
get rid of extra blank spaces
 | 
| + test.NavigateToURL(url, windex, tab_index) | 
| + email_id = 'document.getElementById("Email").value = "%s"; ' \ | 
| 'window.domAutomationController.send("done")' % username | 
| - password = 'document.getElementById("Passwd").value = \"%s\"; ' \ | 
| + password = 'document.getElementById("Passwd").value = "%s"; ' \ | 
| 'window.domAutomationController.send("done")' % password | 
| - test.ExecuteJavascript(email_id); | 
| - test.ExecuteJavascript(password); | 
| + test.ExecuteJavascript(email_id, windex, tab_index); | 
| + test.ExecuteJavascript(password, windex, tab_index); | 
| test.ExecuteJavascript('document.getElementById("gaia_loginform").submit();' | 
| - 'window.domAutomationController.send("done")') | 
| + 'window.domAutomationController.send("done")', | 
| + windex, tab_index) | 
| - | 
| -def VerifyGoogleAccountCredsFilled(test, username, password): | 
| + | 
| +def VerifyGoogleAccountCredsFilled(test, username, password, tab_index=0, | 
| + windex=0): | 
| """Verify stored/saved user and password values to the values in the field. | 
| Args: | 
| @@ -74,17 +76,19 @@ | 
| username: user log in input. | 
| password: user log in password input. | 
| """ | 
| - email_value = test.GetDOMValue('document.getElementById("Email").value') | 
| - passwd_value = test.GetDOMValue('document.getElementById("Passwd").value') | 
| + email_value = test.GetDOMValue('document.getElementById("Email").value', | 
| + windex, tab_index) | 
| + passwd_value = test.GetDOMValue('document.getElementById("Passwd").value', | 
| + windex, tab_index) | 
| test.assertEqual(email_value, username) | 
| test.assertEqual(passwd_value, password) | 
| - | 
| + | 
| 
Nirnimesh
2010/12/08 20:59:17
remove extra blank spaces
 
sunandt
2010/12/08 22:46:34
Done.
 | 
| def ClearPasswords(test): | 
| """Clear saved passwords.""" | 
| test.ClearBrowsingData(['PASSWORDS'], 'EVERYTHING') | 
| - | 
| + | 
| 
Nirnimesh
2010/12/08 20:59:17
remove extra blank spaces
 
sunandt
2010/12/08 22:46:34
Done.
 | 
| def Shell2(cmd_string, bg=False): | 
| """Run a shell command. | 
| @@ -106,7 +110,7 @@ | 
| retcode = 0 | 
| return (out, retcode) | 
| - | 
| + | 
| 
Nirnimesh
2010/12/08 20:59:17
remove extra blank spaces
 
sunandt
2010/12/08 22:46:34
Done.
 | 
| def SendMail(send_from, send_to, subject, text, smtp, file_to_send=None): | 
| """Send mail to all the group to notify about the crash and uploaded data. | 
| @@ -137,4 +141,3 @@ | 
| smtp_obj = smtplib.SMTP(smtp) | 
| smtp_obj.sendmail(send_from, send_to, msg.as_string()) | 
| smtp_obj.close() | 
| - |