Chromium Code Reviews| Index: functional/test_utils.py |
| =================================================================== |
| --- functional/test_utils.py (revision 67497) |
| +++ functional/test_utils.py (working copy) |
| @@ -30,7 +30,6 @@ |
| test.DownloadAndWaitForStart(file_url) |
| test.WaitForAllDownloadsToComplete() |
|
Nirnimesh
2010/11/29 22:42:58
leave 2 blank lines at global scope
sunandt
2010/12/07 23:47:45
Done.
|
| - |
| def RemoveDownloadedTestFile(test, file_name): |
| """Delete a file from the downloads directory. |
| @@ -43,8 +42,7 @@ |
| pyauto_utils.RemovePath(downloaded_pkg) |
| pyauto_utils.RemovePath(downloaded_pkg + '.crdownload') |
|
Nirnimesh
2010/11/29 22:42:58
ditto. and repeat everywhere
sunandt
2010/12/07 23:47:45
Done.
|
| - |
| -def GoogleAccountsLogin(test, url, username, password): |
| +def GoogleAccountsLogin(test, url, username, password, windex=0, tab_index=0): |
|
Nirnimesh
2010/11/29 22:42:58
Please reverse the order. Pass tab_index then wind
sunandt
2010/12/07 23:47:45
Done.
|
| """Log into Google Accounts. |
| Attempts to login to Google by entering the username/password into the google |
| @@ -54,19 +52,20 @@ |
| test: derived from pyauto.PyUITest - base class for UI test cases. |
| username: users login input. |
| password: users login password input. |
| - """ |
| - test.NavigateToURL('https://www.google.com/accounts/') |
| - email_id = 'document.getElementById("Email").value = \"%s\"; ' \ |
| + """ |
| + 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, windex=0, |
|
Nirnimesh
2010/11/29 22:42:58
same here
sunandt
2010/12/07 23:47:45
Done.
|
| + tab_index=0): |
| """Verify stored/saved user and password values to the values in the field. |
| Args: |
| @@ -74,17 +73,17 @@ |
| 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) |
| - |
| def ClearPasswords(test): |
| """Clear saved passwords.""" |
| test.ClearBrowsingData(['PASSWORDS'], 'EVERYTHING') |
| - |
| def Shell2(cmd_string, bg=False): |
| """Run a shell command. |
| @@ -106,7 +105,6 @@ |
| retcode = 0 |
| return (out, retcode) |
| - |
| 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 +135,3 @@ |
| smtp_obj = smtplib.SMTP(smtp) |
| smtp_obj.sendmail(send_from, send_to, msg.as_string()) |
| smtp_obj.close() |
| - |