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 @@
'-omnibox.OmniboxTest.testHistoryResult',
# crbug.com/123019
'-omnibox.OmniboxTest.testAutoCompleteForNonAsciiSearch',
# crbug.com/117720
'-passwords.PasswordTest.testPasswordAutofilledInIncognito',
# crbug.com/86524
'-plugins.PluginsTest.testAllowPluginException',
# crbug.com/97140
......
......@@ -4,6 +4,7 @@
# found in the LICENSE file.
import os
from urlparse import urlparse
import pyauto_functional # Must be imported before pyauto
import pyauto
......@@ -18,6 +19,11 @@ class PasswordTest(pyauto.PyUITest):
URL = 'https://accounts.google.com/ServiceLogin'
URL_HTTPS = 'https://accounts.google.com/Login'
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):
"""Test method for experimentation.
......@@ -80,9 +86,9 @@ class PasswordTest(pyauto.PyUITest):
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,23 +222,23 @@ class PasswordTest(pyauto.PyUITest):
Saved passwords should be autofilled once the username is entered in
incognito mode.
"""
action_target = self.HOSTNAME
driver = self.NewWebDriver()
username = 'test@google.com'
password = 'test.password'
password_dict = self._ConstructPasswordDictionary(
username, password,
'https://www.google.com/', 'https://www.google.com/accounts',
'Email', 'Passwd', 'https://www.google.com/accounts')
self.USERNAME, self.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(self.USERNAME + '\t')
incognito_passwd = self.GetDOMValue(
'document.getElementById("Passwd").value', tab_index=0, windex=1)
self.assertEqual(incognito_passwd, password,
msg='Password creds did not autofill in incognito mode.')
self.assertEqual(incognito_passwd, self.PASSWORD,
msg='Password creds did not autofill in incognito mode.')
def testInfoBarDisappearByNavigatingPage(self):
"""Test password infobar is dismissed when navigating to different page."""
......@@ -269,8 +275,8 @@ class PasswordTest(pyauto.PyUITest):
If the password field has autocomplete turned off, then the password infobar
should not offer to save the password info.
"""
password_info = {'Email': 'test@google.com',
'Passwd': 'test12345'}
password_info = {'Email': self.USERNAME,
'Passwd': self.PASSWORD}
# Disable one-click login infobar for sync.
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