Chromium Code Reviews| Index: functional/test_utils.py | 
| =================================================================== | 
| --- functional/test_utils.py (revision 67497) | 
| +++ functional/test_utils.py (working copy) | 
| @@ -44,7 +44,7 @@ | 
| pyauto_utils.RemovePath(downloaded_pkg + '.crdownload') | 
| -def GoogleAccountsLogin(test, url, username, password): | 
| +def GoogleAccountsLogin(test, url, username, password, tab_index=0, windex=0): | 
| 
 
Nirnimesh
2010/12/09 00:25:14
I think the url should be hardcoded. It'll only ev
 
sunandt
2010/12/09 00:47:46
Done.
 
 | 
| """Log into Google Accounts. | 
| Attempts to login to Google by entering the username/password into the google | 
| @@ -52,30 +52,39 @@ | 
| Args: | 
| test: derived from pyauto.PyUITest - base class for UI test cases. | 
| + url: url where user is trying to login. | 
| 
 
Nirnimesh
2010/12/09 00:25:14
remove this
 
sunandt
2010/12/09 00:47:46
Done.
 
 | 
| username: users login input. | 
| password: users login password input. | 
| + tab_index: The tab index, default is 0. | 
| + windex: The window index, default is 0. | 
| """ | 
| - test.NavigateToURL('https://www.google.com/accounts/') | 
| - email_id = 'document.getElementById("Email").value = \"%s\"; ' \ | 
| + test.NavigateToURL(url, windex, tab_index) | 
| 
 
Nirnimesh
2010/12/09 00:25:14
hardcode the url here
 
sunandt
2010/12/09 00:47:46
Done.
 
 | 
| + 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: | 
| test: derived from pyauto.PyUITest - base class for UI test cases. | 
| username: user log in input. | 
| password: user log in password input. | 
| + tab_index: The tab index, default is 0. | 
| + windex: The window index, default is 0. | 
| """ | 
| - 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) | 
| @@ -137,4 +146,3 @@ | 
| smtp_obj = smtplib.SMTP(smtp) | 
| smtp_obj.sendmail(send_from, send_to, msg.as_string()) | 
| smtp_obj.close() | 
| - |