Index: functional/passwords.py |
=================================================================== |
--- functional/passwords.py (revision 68262) |
+++ functional/passwords.py (working copy) |
@@ -3,7 +3,7 @@ |
# Use of this source code is governed by a BSD-style license that can be |
# found in the LICENSE file. |
-import pyauto_functional # Must be imported before pyauto |
+import pyauto_functional |
import pyauto |
import test_utils |
@@ -45,27 +45,64 @@ |
def testDisplayAndSavePasswordInfobar(self): |
"""Verify password infobar displays and able to save password.""" |
+ |
url_https = 'https://www.google.com/accounts/' |
url_logout = 'https://www.google.com/accounts/Logout' |
creds = self.GetPrivateInfo()['test_google_account'] |
- username = creds['username'] |
- password = creds['password'] |
- test_utils.GoogleAccountsLogin(self, ['url'], username, password) |
+ test_utils.GoogleAccountsLogin(self, url_https, creds['username'], |
Nirnimesh
2010/12/21 20:02:11
why not move all args to the next line
|
+ creds['password']) |
# Wait until page completes loading. |
- self.WaitUntil( |
- lambda: self.GetDOMValue('document.readyState'), 'complete') |
+ self.WaitUntil( |
Nirnimesh
2010/12/21 20:02:11
remove stray tab char
|
+ lambda: self.GetDOMValue('document.readyState'), 'complete') |
Nirnimesh
2010/12/21 20:02:11
indent by 4 spaces
|
self.assertTrue(self.WaitForInfobarCount(1), |
- 'Did not get save password infobar') |
+ 'Did not get save password infobar') |
Nirnimesh
2010/12/21 20:02:11
Keep this aligned under self.
|
infobar = self.GetBrowserInfo()['windows'][0]['tabs'][0]['infobars'] |
self.assertEqual(infobar[0]['type'], 'confirm_infobar') |
self.PerformActionOnInfobar('accept', infobar_index=0) |
self.NavigateToURL(url_logout) |
self.NavigateToURL(url_https) |
- test_utils.VerifyGoogleAccountCredsFilled(self, username, password) |
- self.ExecuteJavascript('document.getElementById("gaia_loginform").submit();' |
- 'window.domAutomationController.send("done")') |
+ test_utils.VerifyGoogleAccountCredsFilled(self, creds['username'], |
Nirnimesh
2010/12/21 20:02:11
move all args to next line so that it looks better
|
+ creds['password']) |
+ self.ExecuteJavascript('document.getElementById("gaia_loginform").submit();\ |
+ window.domAutomationController.send("done")') |
test_utils.ClearPasswords(self) |
+ def testInfoBarDisappearByNavigatingPage(self): |
+ """Test that Password infobar is dismissed by navigating to |
+ different page.""" |
Nirnimesh
2010/12/21 20:02:11
align under Test
|
+ url = 'https://www.google.com/accounts/Login?hl=en' |
+ creds = self.GetPrivateInfo()['test_google_account'] |
+ |
+ # Login to Google a/c |
+ test_utils.GoogleAccountsLogin(self, url, creds['username'], |
Nirnimesh
2010/12/21 20:02:11
this fn doesn't take the url arg any more. Please
|
+ creds['password']) |
+ |
+ # Wait for the infobar to appear |
+ self.assertTrue(self.WaitForInfobarCount(1)) |
+ self.assertTrue(self.GetBrowserInfo()['windows'][0]['tabs'][0]['infobars']) |
+ self.NavigateToURL('chrome://history') |
+ self.assertTrue(self.WaitForInfobarCount(0)) |
+ # To make sure user is navigated to History page. |
+ self.assertEqual('History', self.GetActiveTabTitle()) |
+ self.assertFalse(self.GetBrowserInfo()['windows'][0]['tabs'][0]['infobars']) |
+ |
+ def testInfoBarDisappearByReload(self): |
+ """Test that Password infobar disappears by the page reload.""" |
+ |
+ url = 'https://www.google.com/accounts/Login?hl=en' |
+ creds = self.GetPrivateInfo()['test_google_account'] |
+ |
+ # Login to Google a/c |
+ test_utils.GoogleAccountsLogin(self, url, creds['username'], |
Nirnimesh
2010/12/21 20:02:11
ditto
|
+ creds['password']) |
+ |
+ # Wait for the infobar to appear |
+ self.assertTrue(self.WaitForInfobarCount(1)) |
+ self.assertTrue(self.GetBrowserInfo()['windows'][0]['tabs'][0]['infobars']) |
+ self.GetBrowserWindow(0).GetTab(0).Reload() |
+ self.assertTrue(self.WaitForInfobarCount(0)) |
+ self.assertFalse(self.GetBrowserInfo()['windows'][0]['tabs'][0]['infobars']) |
+ |
if __name__ == '__main__': |
pyauto_functional.Main() |