Index: chrome/test/functional/passwords.py |
=================================================================== |
--- chrome/test/functional/passwords.py (revision 137688) |
+++ chrome/test/functional/passwords.py (working copy) |
@@ -18,6 +18,12 @@ |
URL = 'https://accounts.google.com/ServiceLogin' |
URL_HTTPS = 'https://accounts.google.com/Login' |
URL_LOGOUT = 'https://accounts.google.com/Logout' |
+ # Create a list of each bit between slashes. |
+ SLASHPARTS = URL.split('/') |
+ # Join the first three sections. |
+ HOSTNAME = '/'.join(SLASHPARTS[:3]) + '/' |
Ilya Sherman
2012/05/19 01:08:57
Hmm, you should probably use something like the ur
dyu1
2012/05/19 02:21:47
Done.
|
+ USERNAME_ELEM = 'Email' |
+ PASSWORD_ELEM = 'Passwd' |
def Debug(self): |
"""Test method for experimentation. |
@@ -80,9 +86,9 @@ |
window.domAutomationController.send(value); |
""" |
self.assertTrue(self.WaitUntil( |
- lambda: self.ExecuteJavascript(js_template % 'Email', |
+ lambda: self.ExecuteJavascript(js_template % self.USERNAME_ELEM, |
tab_index, window_index) != '' and |
- self.ExecuteJavascript(js_template % 'Passwd', |
+ self.ExecuteJavascript(js_template % self.PASSWORD_ELEM, |
tab_index, window_index) != '')) |
def testSavePassword(self): |
@@ -216,19 +222,20 @@ |
Saved passwords should be autofilled once the username is entered in |
incognito mode. |
""" |
- driver = self.NewWebDriver() |
username = 'test@google.com' |
password = 'test.password' |
+ action_target = self.HOSTNAME |
+ |
+ driver = self.NewWebDriver() |
password_dict = self._ConstructPasswordDictionary( |
- username, password, |
- 'https://www.google.com/', 'https://www.google.com/accounts', |
- 'Email', 'Passwd', 'https://www.google.com/accounts') |
+ username, password, self.HOSTNAME, self.URL, |
+ self.USERNAME_ELEM, self.PASSWORD_ELEM, action_target) |
self.AddSavedPassword(password_dict) |
self.RunCommand(pyauto.IDC_NEW_INCOGNITO_WINDOW) |
self.NavigateToURL(self.URL, 1, 0) |
# Switch to window 1. |
driver.switch_to_window(driver.window_handles[1]) |
- driver.find_element_by_id('Email').send_keys(username + '\t') |
+ driver.find_element_by_id(self.USERNAME_ELEM).send_keys(username + '\t') |
incognito_passwd = self.GetDOMValue( |
'document.getElementById("Passwd").value', tab_index=0, windex=1) |
self.assertEqual(incognito_passwd, password, |