Commit 1cbfc987 authored by dyu@chromium.org's avatar dyu@chromium.org

Fix and enable testPasswordAutofilledInIncognito.

TEST=Tested on chromium bots and passed.
BUG=none
NOTRY=true
Review URL: https://chromiumcodereview.appspot.com/10383241

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@138289 0039d316-1c4b-4281-b951-d872f2087c98
parent 35324778
...@@ -108,8 +108,6 @@ ...@@ -108,8 +108,6 @@
'-omnibox.OmniboxTest.testHistoryResult', '-omnibox.OmniboxTest.testHistoryResult',
# crbug.com/123019 # crbug.com/123019
'-omnibox.OmniboxTest.testAutoCompleteForNonAsciiSearch', '-omnibox.OmniboxTest.testAutoCompleteForNonAsciiSearch',
# crbug.com/117720
'-passwords.PasswordTest.testPasswordAutofilledInIncognito',
# crbug.com/86524 # crbug.com/86524
'-plugins.PluginsTest.testAllowPluginException', '-plugins.PluginsTest.testAllowPluginException',
# crbug.com/97140 # crbug.com/97140
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
# found in the LICENSE file. # found in the LICENSE file.
import os import os
from urlparse import urlparse
import pyauto_functional # Must be imported before pyauto import pyauto_functional # Must be imported before pyauto
import pyauto import pyauto
...@@ -18,6 +19,11 @@ class PasswordTest(pyauto.PyUITest): ...@@ -18,6 +19,11 @@ class PasswordTest(pyauto.PyUITest):
URL = 'https://accounts.google.com/ServiceLogin' URL = 'https://accounts.google.com/ServiceLogin'
URL_HTTPS = 'https://accounts.google.com/Login' URL_HTTPS = 'https://accounts.google.com/Login'
URL_LOGOUT = 'https://accounts.google.com/Logout' URL_LOGOUT = 'https://accounts.google.com/Logout'
HOSTNAME = 'https://' + urlparse(URL).netloc
USERNAME_ELEM = 'Email'
PASSWORD_ELEM = 'Passwd'
USERNAME = 'test@google.com'
PASSWORD = 'test.password'
def Debug(self): def Debug(self):
"""Test method for experimentation. """Test method for experimentation.
...@@ -80,9 +86,9 @@ class PasswordTest(pyauto.PyUITest): ...@@ -80,9 +86,9 @@ class PasswordTest(pyauto.PyUITest):
window.domAutomationController.send(value); window.domAutomationController.send(value);
""" """
self.assertTrue(self.WaitUntil( self.assertTrue(self.WaitUntil(
lambda: self.ExecuteJavascript(js_template % 'Email', lambda: self.ExecuteJavascript(js_template % self.USERNAME_ELEM,
tab_index, window_index) != '' and tab_index, window_index) != '' and
self.ExecuteJavascript(js_template % 'Passwd', self.ExecuteJavascript(js_template % self.PASSWORD_ELEM,
tab_index, window_index) != '')) tab_index, window_index) != ''))
def testSavePassword(self): def testSavePassword(self):
...@@ -216,23 +222,23 @@ class PasswordTest(pyauto.PyUITest): ...@@ -216,23 +222,23 @@ class PasswordTest(pyauto.PyUITest):
Saved passwords should be autofilled once the username is entered in Saved passwords should be autofilled once the username is entered in
incognito mode. incognito mode.
""" """
action_target = self.HOSTNAME
driver = self.NewWebDriver() driver = self.NewWebDriver()
username = 'test@google.com'
password = 'test.password'
password_dict = self._ConstructPasswordDictionary( password_dict = self._ConstructPasswordDictionary(
username, password, self.USERNAME, self.PASSWORD, self.HOSTNAME, self.URL,
'https://www.google.com/', 'https://www.google.com/accounts', self.USERNAME_ELEM, self.PASSWORD_ELEM, action_target)
'Email', 'Passwd', 'https://www.google.com/accounts')
self.AddSavedPassword(password_dict) self.AddSavedPassword(password_dict)
self.RunCommand(pyauto.IDC_NEW_INCOGNITO_WINDOW) self.RunCommand(pyauto.IDC_NEW_INCOGNITO_WINDOW)
self.NavigateToURL(self.URL, 1, 0) self.NavigateToURL(self.URL, 1, 0)
# Switch to window 1. # Switch to window 1.
driver.switch_to_window(driver.window_handles[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(self.USERNAME + '\t')
incognito_passwd = self.GetDOMValue( incognito_passwd = self.GetDOMValue(
'document.getElementById("Passwd").value', tab_index=0, windex=1) 'document.getElementById("Passwd").value', tab_index=0, windex=1)
self.assertEqual(incognito_passwd, password, self.assertEqual(incognito_passwd, self.PASSWORD,
msg='Password creds did not autofill in incognito mode.') msg='Password creds did not autofill in incognito mode.')
def testInfoBarDisappearByNavigatingPage(self): def testInfoBarDisappearByNavigatingPage(self):
"""Test password infobar is dismissed when navigating to different page.""" """Test password infobar is dismissed when navigating to different page."""
...@@ -269,8 +275,8 @@ class PasswordTest(pyauto.PyUITest): ...@@ -269,8 +275,8 @@ class PasswordTest(pyauto.PyUITest):
If the password field has autocomplete turned off, then the password infobar If the password field has autocomplete turned off, then the password infobar
should not offer to save the password info. should not offer to save the password info.
""" """
password_info = {'Email': 'test@google.com', password_info = {'Email': self.USERNAME,
'Passwd': 'test12345'} 'Passwd': self.PASSWORD}
# Disable one-click login infobar for sync. # Disable one-click login infobar for sync.
self.SetPrefs(pyauto.kReverseAutologinEnabled, False) self.SetPrefs(pyauto.kReverseAutologinEnabled, False)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment