コード例 #1
0
 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)
コード例 #2
0
 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)
コード例 #3
0
ファイル: passwords.py プロジェクト: rosas/chromium-1
 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)
コード例 #4
0
 def testNeverSavePasswords(self):
     """Verify passwords not saved/deleted when 'never for this site' chosen."""
     creds1 = self.GetPrivateInfo()['test_google_account']
     test_utils.GoogleAccountsLogin(self, creds1['username'],
                                    creds1['password'])
     self.assertTrue(self.WaitForInfobarCount(1))
     self.PerformActionOnInfobar('accept', infobar_index=0)
     self.assertEquals(1, len(self.GetSavedPasswords()))
     self.AppendTab(pyauto.GURL(creds1['logout_url']))
     creds2 = self.GetPrivateInfo()['test_google_account_2']
     test_utils.GoogleAccountsLogin(self,
                                    creds2['username'],
                                    creds2['password'],
                                    tab_index=1)
     self.assertTrue(self.WaitForInfobarCount(1, tab_index=1))
     # Selecting 'Never for this site' option on password infobar.
     self.PerformActionOnInfobar('cancel', infobar_index=0, tab_index=1)
コード例 #5
0
 def _LoginToGoogleAccount(self):
     """Logs in to a testing Google account."""
     creds = self.GetPrivateInfo()['test_google_account']
     test_utils.GoogleAccountsLogin(self, creds['username'],
                                    creds['password'])
     self.assertTrue(
         self.WaitForInfobarCount(1),
         msg='Save password infobar did not appear when logging in.')
     self.NavigateToURL('about:blank')  # Clear the existing tab.
コード例 #6
0
 def testNeverSavePasswords(self):
     """Verify passwords not saved/deleted when 'never for this site' chosen."""
     creds1 = self.GetPrivateInfo()['test_google_account']
     # Disable one-click login infobar for sync.
     self.SetPrefs(pyauto.kReverseAutologinEnabled, False)
     test_utils.GoogleAccountsLogin(self, creds1['username'],
                                    creds1['password'])
     self.PerformActionOnInfobar(
         'accept',
         infobar_index=test_utils.WaitForInfobarTypeAndGetIndex(
             self, self.INFOBAR_TYPE))
     self.assertEquals(1, len(self.GetSavedPasswords()))
     self.AppendTab(pyauto.GURL(creds1['logout_url']))
     creds2 = self.GetPrivateInfo()['test_google_account_2']
     test_utils.GoogleAccountsLogin(self,
                                    creds2['username'],
                                    creds2['password'],
                                    tab_index=1)
     # Selecting 'Never for this site' option on password infobar.
     self.PerformActionOnInfobar(
         'cancel',
         infobar_index=test_utils.WaitForInfobarTypeAndGetIndex(
             self, self.INFOBAR_TYPE, tab_index=1))
コード例 #7
0
 def testInfoBarDisappearByReload(self):
     """Test that Password infobar disappears by the page reload."""
     creds = self.GetPrivateInfo()['test_google_account']
     # Login to Google a/c
     test_utils.GoogleAccountsLogin(self, creds['username'],
                                    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'])
コード例 #8
0
 def testInfoBarDisappearByReload(self):
     """Test that Password infobar disappears by the page reload."""
     creds = self.GetPrivateInfo()['test_google_account']
     # Disable one-click login infobar for sync.
     self.SetPrefs(pyauto.kReverseAutologinEnabled, False)
     # Login to Google a/c
     test_utils.GoogleAccountsLogin(self, creds['username'],
                                    creds['password'])
     self.PerformActionOnInfobar(
         'accept',
         infobar_index=test_utils.WaitForInfobarTypeAndGetIndex(
             self, self.INFOBAR_TYPE))
     self.ReloadTab()
     test_utils.AssertInfobarTypeDoesNotAppear(self, self.INFOBAR_TYPE)
コード例 #9
0
 def testInfoBarDisappearByNavigatingPage(self):
     """Test password infobar is dismissed when navigating to different page."""
     creds = self.GetPrivateInfo()['test_google_account']
     # Login to Google a/c
     test_utils.GoogleAccountsLogin(self, creds['username'],
                                    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'])
コード例 #10
0
ファイル: infobars.py プロジェクト: airekans/chromium
    def _LogIntoGoogleAccount(self, tab_index=0, windex=0):
        """Log into Google account.

    Args:
      tab_index: The tab index, default is 0.
      windex: The window index, default is 0.
    """
        creds = self.GetPrivateInfo()['test_google_account']
        username = creds['username']
        password = creds['password']
        test_utils.GoogleAccountsLogin(self, username, password, tab_index,
                                       windex)
        # TODO(dyu): Use WaitUntilNavigationCompletes after investigating
        # crbug.com/124877
        self.WaitUntil(lambda: self.GetDOMValue('document.readyState'),
                       expect_retval='complete')
コード例 #11
0
    def testPasswordInfobarShowsForBlockedDomain(self):
        """Verify that password infobar shows when cookies are blocked.

    Password infobar should be shown if cookies are blocked for Google
    accounts domain.
    """
        creds = self.GetPrivateInfo()['test_google_account']
        username = creds['username']
        password = creds['password']
        # Block cookies for Google accounts domain.
        self.SetPrefs(pyauto.kContentSettingsPatternPairs,
                      {'https://accounts.google.com/': {
                          'cookies': 2
                      }})
        test_utils.GoogleAccountsLogin(self, username, password)
        test_utils.WaitForInfobarTypeAndGetIndex(self, self.INFOBAR_TYPE)
コード例 #12
0
ファイル: youtube.py プロジェクト: Havok380/chromium-test
 def PlayFAVideo(self):
     """Play and assert FA video playing.
    
 We are using multiple test videos in case any FA video playback fails
 becuase other tests are palying the same video and the test gets the
 simultaneous playback error.
 """
     fa_videos = ('APRpcscmbY0', 'yQqvrED-np0', 'KJuFw6hQdNY',
                  'BeFQbgxr_9g', 'L6JwlOudqA4')
     credentials = self.GetPrivateInfo()['test_fa_account']
     test_utils.GoogleAccountsLogin(self, credentials['username'],
                                    credentials['password'])
     for video in fa_videos:
         result = self.PlayVideoAndAssert(video, ignore_assert=True)
         if result is self.is_playing:
             return
     self.assertTrue(False, msg='Player did not enter the playing state.')
コード例 #13
0
ファイル: passwords.py プロジェクト: rosas/chromium-1
 def testInfoBarDisappearByNavigatingPage(self):
     """Test password infobar is dismissed when navigating to different page."""
     creds = self.GetPrivateInfo()['test_google_account']
     # Disable one-click login infobar for sync.
     self.SetPrefs(pyauto.kReverseAutologinEnabled, False)
     # Login to Google account.
     test_utils.GoogleAccountsLogin(self, creds['username'],
                                    creds['password'])
     self.PerformActionOnInfobar(
         'accept',
         infobar_index=test_utils.WaitForInfobarTypeAndGetIndex(
             self, self.INFOBAR_TYPE))
     self.NavigateToURL('chrome://version')
     self.assertTrue(self.WaitForInfobarCount(0))
     # To make sure user is navigated to Version page.
     self.assertEqual('About Version', self.GetActiveTabTitle())
     test_utils.AssertInfobarTypeDoesNotAppear(self, self.INFOBAR_TYPE)
コード例 #14
0
 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)
コード例 #15
0
    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)
コード例 #16
0
ファイル: passwords.py プロジェクト: rosas/chromium-1
    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)
コード例 #17
0
 def testLoginCredsNotShownInIncognito(self):
     """Verify login creds are not shown in Incognito mode."""
     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 account.
     test_utils.GoogleAccountsLogin(self, username, password)
     self.PerformActionOnInfobar(
         'accept',
         infobar_index=test_utils.WaitForInfobarTypeAndGetIndex(
             self, self.INFOBAR_TYPE))
     self.NavigateToURL(self.URL_LOGOUT)
     self.RunCommand(pyauto.IDC_NEW_INCOGNITO_WINDOW)
     self.NavigateToURL(self.URL, 1, 0)
     email_value = self.GetDOMValue(
         'document.getElementById("Email").value', tab_index=0, windex=1)
     passwd_value = self.GetDOMValue(
         'document.getElementById("Passwd").value', tab_index=0, windex=1)
     self.assertEqual(email_value,
                      '',
                      msg='Email creds displayed %s.' % email_value)
     self.assertEqual(passwd_value, '', msg='Password creds displayed.')
コード例 #18
0
ファイル: passwords.py プロジェクト: blockspacer/chromium-1
 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)