def testSavedPasswordInTabsAndWindows(self): """Verify saved username/password shows in window and tab.""" creds = self.GetPrivateInfo()['test_google_account'] username = creds['username'] password = creds['password'] # Disable one-click login infobar for sync. self.SetPrefs(pyauto.kReverseAutologinEnabled, False) # Login to Google a/c test_utils.GoogleAccountsLogin(self, username, password) self.PerformActionOnInfobar( 'accept', infobar_index=test_utils.WaitForInfobarTypeAndGetIndex( self, self.INFOBAR_TYPE)) self.NavigateToURL(self.URL_LOGOUT) self.NavigateToURL(self.URL) self._ClickOnLoginPage(0, 0) test_utils.VerifyGoogleAccountCredsFilled(self, username, password, tab_index=0, windex=0) self.AppendTab(pyauto.GURL(self.URL)) self._ClickOnLoginPage(0, 1) test_utils.VerifyGoogleAccountCredsFilled(self, username, password, tab_index=1, windex=0)
def testDisplayAndSavePasswordInfobar(self): """Verify password infobar displays and able to save password.""" test_utils.ClearPasswords(self) creds = self.GetPrivateInfo()['test_google_account'] username = creds['username'] password = creds['password'] # Disable one-click login infobar for sync. self.SetPrefs(pyauto.kReverseAutologinEnabled, False) test_utils.GoogleAccountsLogin(self, username, password) # Wait until page completes loading. self.WaitUntil(lambda: self.GetDOMValue('document.readyState'), expect_retval='complete') self.PerformActionOnInfobar( 'accept', infobar_index=test_utils.WaitForInfobarTypeAndGetIndex( self, self.INFOBAR_TYPE)) self.NavigateToURL(self.URL_LOGOUT) self.NavigateToURL(self.URL_HTTPS) self._ClickOnLoginPage(0, 0) test_utils.VerifyGoogleAccountCredsFilled(self, username, password, tab_index=0, windex=0) test_utils.ClearPasswords(self)
def testDisplayAndSavePasswordInfobar(self): """Verify password infobar displays and able to save password.""" test_utils.ClearPasswords(self) url_https = 'https://www.google.com/accounts/Login' url_logout = 'https://www.google.com/accounts/Logout' creds = self.GetPrivateInfo()['test_google_account'] username = creds['username'] password = creds['password'] test_utils.GoogleAccountsLogin(self, username, password) # Wait until page completes loading. self.WaitUntil(lambda: self.GetDOMValue('document.readyState'), expect_retval='complete') self.assertTrue(self.WaitForInfobarCount(1), 'Save password infobar did not appear.') 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) self._ClickOnLoginPage(0, 0) test_utils.VerifyGoogleAccountCredsFilled(self, username, password, tab_index=0, windex=0) test_utils.ClearPasswords(self)
def testSavedPasswordInTabsAndWindows(self): """Verify saved username/password displays in Regular/Incognito Window and NTP""" username = '******' password = '******' password_dict = { u'action_target': u'https://www.google.com/accounts/ServiceLoginAuth', u'blacklist': False, u'origin_url': u'https://www.google.com/accounts/ServiceLogin', u'password_element': u'Passwd', u'password_value': u'test12345', u'signon_realm': u'https://www.google.com/', u'submit_element': u'', u'time': 1280939865.0, u'username_element': u'Email', u'username_value': u'test' } url = 'https://www.google.com/accounts/ServiceLogin' self.AddSavedPassword(password_dict) self.NavigateToURL(url) test_utils.VerifyGoogleAccountCredsFilled(self, username, password, tab_index=0, windex=0) self.AppendTab(pyauto.GURL(url)) test_utils.VerifyGoogleAccountCredsFilled(self, username, password, tab_index=1, windex=0) self.RunCommand(pyauto.IDC_NEW_INCOGNITO_WINDOW) self.NavigateToURL(url, 1, 0) test_utils.VerifyGoogleAccountCredsFilled(self, username, password, tab_index=0, windex=1) test_utils.ClearPasswords(self)
def testSavedPasswordInTabsAndWindows(self): """Verify saved username/password shows in regular/incognito Window, NTP""" url = 'https://www.google.com/accounts/ServiceLogin' url_logout = 'https://www.google.com/accounts/Logout' creds = self.GetPrivateInfo()['test_google_account'] username = creds['username'] password = creds['password'] # Login to Google a/c test_utils.GoogleAccountsLogin(self, username, password) # Wait for the infobar to appear self.assertTrue(self.WaitForInfobarCount(1)) self.assertTrue( self.GetBrowserInfo()['windows'][0]['tabs'][0]['infobars']) self.PerformActionOnInfobar('accept', infobar_index=0) self.NavigateToURL(url_logout) self.NavigateToURL(url) self._ClickOnLoginPage(0, 0) test_utils.VerifyGoogleAccountCredsFilled(self, username, password, tab_index=0, windex=0) self.AppendTab(pyauto.GURL(url)) self._ClickOnLoginPage(0, 1) test_utils.VerifyGoogleAccountCredsFilled(self, username, password, tab_index=1, windex=0) self.RunCommand(pyauto.IDC_NEW_INCOGNITO_WINDOW) self.NavigateToURL(url, 1, 0) self._ClickOnLoginPage(1, 0) test_utils.VerifyGoogleAccountCredsFilled(self, username, password, tab_index=0, windex=1) test_utils.ClearPasswords(self)
def testClearFetchedCredForNewUserName(self): """Verify that the fetched credentials are cleared for a new username. This test requires sending key events rather than pasting a new username into the Email field. """ url = 'https://www.google.com/accounts/ServiceLogin' url_logout = 'https://www.google.com/accounts/Logout' creds = self.GetPrivateInfo()['test_google_account'] username = creds['username'] password = creds['password'] # Login to Google a/c test_utils.GoogleAccountsLogin(self, username, password) # Wait for the infobar to appear self.assertTrue(self.WaitForInfobarCount(1)) self.assertTrue( self.GetBrowserInfo()['windows'][0]['tabs'][0]['infobars']) self.PerformActionOnInfobar('accept', infobar_index=0) self.NavigateToURL(url_logout) self.NavigateToURL(url) self._ClickOnLoginPage(0, 0) test_utils.VerifyGoogleAccountCredsFilled(self, username, password, tab_index=0, windex=0) clear_username_field = ('document.getElementById("Email").value = ""; ' 'window.domAutomationController.send("done");') set_focus = ('document.getElementById("Email").focus(); ' 'window.domAutomationController.send("done");') self.ExecuteJavascript(clear_username_field, 0, 0) self.ExecuteJavascript(set_focus, 0, 0) self._SendCharToPopulateField('t', tab_index=0, windex=0) passwd_value = self.GetDOMValue( 'document.getElementById("Passwd").value') self.assertFalse(passwd_value, msg='Password field not empty for new username.') test_utils.ClearPasswords(self)
def testClearFetchedCredForNewUserName(self): """Verify that the fetched credentials are cleared for a new username. This test requires sending key events rather than pasting a new username into the Email field. """ creds = self.GetPrivateInfo()['test_google_account'] username = creds['username'] password = creds['password'] # Disable one-click login infobar for sync. self.SetPrefs(pyauto.kReverseAutologinEnabled, False) # Login to Google a/c test_utils.GoogleAccountsLogin(self, username, password) self.PerformActionOnInfobar( 'accept', infobar_index=test_utils.WaitForInfobarTypeAndGetIndex( self, self.INFOBAR_TYPE)) self.NavigateToURL(self.URL_LOGOUT) self.NavigateToURL(self.URL) self._ClickOnLoginPage(0, 0) test_utils.VerifyGoogleAccountCredsFilled(self, username, password, tab_index=0, windex=0) clear_username_field = ('document.getElementById("Email").value = ""; ' 'window.domAutomationController.send("done");') set_focus = ('document.getElementById("Email").focus(); ' 'window.domAutomationController.send("done");') self.ExecuteJavascript(clear_username_field, 0, 0) self.ExecuteJavascript(set_focus, 0, 0) self._SendCharToPopulateField('t', tab_index=0, windex=0) passwd_value = self.GetDOMValue( 'document.getElementById("Passwd").value') self.assertFalse(passwd_value, msg='Password field not empty for new username.') test_utils.ClearPasswords(self)
def testDisplayAndSavePasswordInfobar(self): """Verify password infobar displays and able to save password.""" test_utils.ClearPasswords(self) 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, username, password) # Wait until page completes loading. self.WaitUntil(lambda: self.GetDOMValue('document.readyState'), 'complete') self.assertTrue(self.WaitForInfobarCount(1), 'Did not get save password infobar') 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.ClearPasswords(self)