Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(126)

Side by Side Diff: chrome/test/functional/passwords.py

Issue 10866013: Convert the browsing_data pyauto tests to chrome tests. Remove the ClearBrowsingData automation cod… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix hang on mac Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/test/functional/databases.py ('k') | chrome/test/functional/test_utils.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 import os 6 import os
7 from urlparse import urlparse 7 from urlparse import urlparse
8 8
9 import pyauto_functional # Must be imported before pyauto 9 import pyauto_functional # Must be imported before pyauto
10 import pyauto 10 import pyauto
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 self.RemoveSavedPassword(password1) 117 self.RemoveSavedPassword(password1)
118 self.assertEquals(1, len(self.GetSavedPasswords())) 118 self.assertEquals(1, len(self.GetSavedPasswords()))
119 self.assertEquals([password2], self.GetSavedPasswords()) 119 self.assertEquals([password2], self.GetSavedPasswords())
120 self.RemoveSavedPassword(password2) 120 self.RemoveSavedPassword(password2)
121 # TODO: GetSavedPasswords() doesn't return anything when empty. 121 # TODO: GetSavedPasswords() doesn't return anything when empty.
122 # http://crbug.com/64603 122 # http://crbug.com/64603
123 # self.assertFalse(self.GetSavedPasswords()) 123 # self.assertFalse(self.GetSavedPasswords())
124 124
125 def testDisplayAndSavePasswordInfobar(self): 125 def testDisplayAndSavePasswordInfobar(self):
126 """Verify password infobar displays and able to save password.""" 126 """Verify password infobar displays and able to save password."""
127 test_utils.ClearPasswords(self)
128 creds = self.GetPrivateInfo()['test_google_account'] 127 creds = self.GetPrivateInfo()['test_google_account']
129 username = creds['username'] 128 username = creds['username']
130 password = creds['password'] 129 password = creds['password']
131 # Disable one-click login infobar for sync. 130 # Disable one-click login infobar for sync.
132 self.SetPrefs(pyauto.kReverseAutologinEnabled, False) 131 self.SetPrefs(pyauto.kReverseAutologinEnabled, False)
133 test_utils.GoogleAccountsLogin(self, username, password) 132 test_utils.GoogleAccountsLogin(self, username, password)
134 # Wait until page completes loading. 133 # Wait until page completes loading.
135 self.WaitUntil( 134 self.WaitUntil(
136 lambda: self.GetDOMValue('document.readyState'), 135 lambda: self.GetDOMValue('document.readyState'),
137 expect_retval='complete') 136 expect_retval='complete')
138 self.PerformActionOnInfobar( 137 self.PerformActionOnInfobar(
139 'accept', infobar_index=test_utils.WaitForInfobarTypeAndGetIndex( 138 'accept', infobar_index=test_utils.WaitForInfobarTypeAndGetIndex(
140 self, self.INFOBAR_TYPE)) 139 self, self.INFOBAR_TYPE))
141 self.NavigateToURL(self.URL_LOGOUT) 140 self.NavigateToURL(self.URL_LOGOUT)
142 self.NavigateToURL(self.URL_HTTPS) 141 self.NavigateToURL(self.URL_HTTPS)
143 self._ClickOnLoginPage(0, 0) 142 self._ClickOnLoginPage(0, 0)
144 test_utils.VerifyGoogleAccountCredsFilled(self, username, password, 143 test_utils.VerifyGoogleAccountCredsFilled(self, username, password,
145 tab_index=0, windex=0) 144 tab_index=0, windex=0)
146 test_utils.ClearPasswords(self)
147 145
148 def testNeverSavePasswords(self): 146 def testNeverSavePasswords(self):
149 """Verify passwords not saved/deleted when 'never for this site' chosen.""" 147 """Verify passwords not saved/deleted when 'never for this site' chosen."""
150 creds1 = self.GetPrivateInfo()['test_google_account'] 148 creds1 = self.GetPrivateInfo()['test_google_account']
151 # Disable one-click login infobar for sync. 149 # Disable one-click login infobar for sync.
152 self.SetPrefs(pyauto.kReverseAutologinEnabled, False) 150 self.SetPrefs(pyauto.kReverseAutologinEnabled, False)
153 test_utils.GoogleAccountsLogin( 151 test_utils.GoogleAccountsLogin(
154 self, creds1['username'], creds1['password']) 152 self, creds1['username'], creds1['password'])
155 self.PerformActionOnInfobar( 153 self.PerformActionOnInfobar(
156 'accept', infobar_index=test_utils.WaitForInfobarTypeAndGetIndex( 154 'accept', infobar_index=test_utils.WaitForInfobarTypeAndGetIndex(
(...skipping 27 matching lines...) Expand all
184 self, self.INFOBAR_TYPE)) 182 self, self.INFOBAR_TYPE))
185 self.NavigateToURL(self.URL_LOGOUT) 183 self.NavigateToURL(self.URL_LOGOUT)
186 self.NavigateToURL(self.URL) 184 self.NavigateToURL(self.URL)
187 self._ClickOnLoginPage(0, 0) 185 self._ClickOnLoginPage(0, 0)
188 test_utils.VerifyGoogleAccountCredsFilled(self, username, password, 186 test_utils.VerifyGoogleAccountCredsFilled(self, username, password,
189 tab_index=0, windex=0) 187 tab_index=0, windex=0)
190 self.AppendTab(pyauto.GURL(self.URL)) 188 self.AppendTab(pyauto.GURL(self.URL))
191 self._ClickOnLoginPage(0, 1) 189 self._ClickOnLoginPage(0, 1)
192 test_utils.VerifyGoogleAccountCredsFilled(self, username, password, 190 test_utils.VerifyGoogleAccountCredsFilled(self, username, password,
193 tab_index=1, windex=0) 191 tab_index=1, windex=0)
194 test_utils.ClearPasswords(self)
195 192
196 def testLoginCredsNotShownInIncognito(self): 193 def testLoginCredsNotShownInIncognito(self):
197 """Verify login creds are not shown in Incognito mode.""" 194 """Verify login creds are not shown in Incognito mode."""
198 creds = self.GetPrivateInfo()['test_google_account'] 195 creds = self.GetPrivateInfo()['test_google_account']
199 username = creds['username'] 196 username = creds['username']
200 password = creds['password'] 197 password = creds['password']
201 # Disable one-click login infobar for sync. 198 # Disable one-click login infobar for sync.
202 self.SetPrefs(pyauto.kReverseAutologinEnabled, False) 199 self.SetPrefs(pyauto.kReverseAutologinEnabled, False)
203 # Login to Google account. 200 # Login to Google account.
204 test_utils.GoogleAccountsLogin(self, username, password) 201 test_utils.GoogleAccountsLogin(self, username, password)
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 'window.domAutomationController.send("done");') 330 'window.domAutomationController.send("done");')
334 set_focus = ( 331 set_focus = (
335 'document.getElementById("Email").focus(); ' 332 'document.getElementById("Email").focus(); '
336 'window.domAutomationController.send("done");') 333 'window.domAutomationController.send("done");')
337 self.ExecuteJavascript(clear_username_field, 0, 0) 334 self.ExecuteJavascript(clear_username_field, 0, 0)
338 self.ExecuteJavascript(set_focus, 0, 0) 335 self.ExecuteJavascript(set_focus, 0, 0)
339 self._SendCharToPopulateField('t', tab_index=0, windex=0) 336 self._SendCharToPopulateField('t', tab_index=0, windex=0)
340 passwd_value = self.GetDOMValue('document.getElementById("Passwd").value') 337 passwd_value = self.GetDOMValue('document.getElementById("Passwd").value')
341 self.assertFalse(passwd_value, 338 self.assertFalse(passwd_value,
342 msg='Password field not empty for new username.') 339 msg='Password field not empty for new username.')
343 test_utils.ClearPasswords(self)
344 340
345 def testPasswordInfobarShowsForBlockedDomain(self): 341 def testPasswordInfobarShowsForBlockedDomain(self):
346 """Verify that password infobar shows when cookies are blocked. 342 """Verify that password infobar shows when cookies are blocked.
347 343
348 Password infobar should be shown if cookies are blocked for Google 344 Password infobar should be shown if cookies are blocked for Google
349 accounts domain. 345 accounts domain.
350 """ 346 """
351 creds = self.GetPrivateInfo()['test_google_account'] 347 creds = self.GetPrivateInfo()['test_google_account']
352 username = creds['username'] 348 username = creds['username']
353 password = creds['password'] 349 password = creds['password']
354 # Block cookies for Google accounts domain. 350 # Block cookies for Google accounts domain.
355 self.SetPrefs(pyauto.kContentSettingsPatternPairs, 351 self.SetPrefs(pyauto.kContentSettingsPatternPairs,
356 {'https://accounts.google.com/': {'cookies': 2}}) 352 {'https://accounts.google.com/': {'cookies': 2}})
357 test_utils.GoogleAccountsLogin(self, username, password) 353 test_utils.GoogleAccountsLogin(self, username, password)
358 test_utils.WaitForInfobarTypeAndGetIndex(self, self.INFOBAR_TYPE) 354 test_utils.WaitForInfobarTypeAndGetIndex(self, self.INFOBAR_TYPE)
359 355
360 356
361 if __name__ == '__main__': 357 if __name__ == '__main__':
362 pyauto_functional.Main() 358 pyauto_functional.Main()
OLDNEW
« no previous file with comments | « chrome/test/functional/databases.py ('k') | chrome/test/functional/test_utils.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698