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

Unified Diff: chrome/test/functional/https.py

Issue 9535022: Exposed GetSecurityState and GetPageType to pyAuto. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/test/pyautolib/pyautolib.i » ('j') | chrome/test/pyautolib/pyautolib.i » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/functional/https.py
===================================================================
--- chrome/test/functional/https.py (revision 124219)
+++ chrome/test/functional/https.py (working copy)
@@ -69,7 +69,7 @@
msg="Did not proceed from the interstitial page.")
self.assertTrue(
'google' in self.GetActiveTabTitle().lower(),
- msg="Did not correctly proceed from the interstitial page.")
+ msg='Did not correctly proceed from the interstitial page.')
def testSSLGoBack(self):
"""Verify able to go back from the interstitial page to the previous site.
@@ -86,10 +86,70 @@
tab_proxy = self.GetBrowserWindow(0).GetTab(0)
# Equivalent to clicking 'back to safety' button.
self.assertTrue(tab_proxy.TakeActionOnSSLBlockingPage(False),
- msg="Was not able to go back from the interstitial page.")
+ msg='Was not able to go back from the interstitial page.')
self.assertEqual(self.GetActiveTabTitle(), first_page_title,
- msg="Did not go back to previous page correctly.")
+ msg='Did not go back to previous page correctly.')
+ def testSSLCertOK(self):
+ """Verifiy certificate OK does not display interstitial page."""
+ url = self._https_server_ok.GetURL('google.html').spec()
+ self.NavigateToURL(url)
+ tab_proxy = self.GetBrowserWindow(0).GetTab(0)
+ success, page_type = tab_proxy.GetPageType()
+ self.assertTrue(success, msg='Could not determine the page type.')
+ self.assertNotEqual(page_type, pyauto.PAGE_TYPE_INTERSTITIAL,
+ msg='Cert OK displayed interstitial page.')
+ self.assertEqual(page_type, pyauto.PAGE_TYPE_NORMAL,
+ msg='Cert OK displayed error page.')
+ def testSSLCertIsExpired(self):
anantha 2012/02/29 22:30:02 testSSLCertIsExpired and remaining two functions a
dyu1 2012/03/05 19:16:46 I re-factored pyautolib.i so the tests have change
+ """Verify certificate expired is expired."""
+ url = self._https_server_expired.GetURL('google.html').spec()
+ self.NavigateToURL(url)
+ tab_proxy = self.GetBrowserWindow(0).GetTab(0)
+ security_style = pyauto.intp()
+ ssl_cert_status = pyauto.uint32p()
+ insecure_content_status = pyauto.intp()
+ success = tab_proxy.GetSecurityState(
+ security_style, ssl_cert_status, insecure_content_status)
+ self.assertTrue(success, msg='Could not get security state info')
+ self.assertTrue(ssl_cert_status.value() &
+ pyauto.uint32p.frompointer(
+ pyauto.CERT_STATUS_DATE_INVALID).value(),
+ msg='Cert has not expired')
+
+ def testSSLNameMismatches(self):
+ """Verify certificate mismatched has mismatched name."""
+ url = self._https_server_mismatched.GetURL('google.html').spec()
+ self.NavigateToURL(url)
+ tab_proxy = self.GetBrowserWindow(0).GetTab(0)
+ security_style = pyauto.intp()
+ ssl_cert_status = pyauto.uint32p()
+ insecure_content_status = pyauto.intp()
+ success = tab_proxy.GetSecurityState(
+ security_style, ssl_cert_status, insecure_content_status)
+ self.assertTrue(success, msg='Could not get security state info')
+ self.assertTrue(ssl_cert_status.value() &
+ pyauto.uint32p.frompointer(
+ pyauto.CERT_STATUS_COMMON_NAME_INVALID).value(),
+ msg='Cert name does not mismatch')
+
+ def testSSLCertAuthorityOK(self):
+ """Verify certificate OK is valid."""
+ url = self._https_server_mismatched.GetURL('google.html').spec()
+ self.NavigateToURL(url)
+ tab_proxy = self.GetBrowserWindow(0).GetTab(0)
+ security_style = pyauto.intp()
+ ssl_cert_status = pyauto.uint32p()
+ insecure_content_status = pyauto.intp()
+ success = tab_proxy.GetSecurityState(
+ security_style, ssl_cert_status, insecure_content_status)
dennis_jeffrey 2012/02/29 23:37:13 two of the arguments here aren't used. maybe we c
dyu1 2012/03/05 19:16:46 Re-wrote the tests. This is now N/A. On 2012/02/2
+ self.assertTrue(success, msg='Could not get security state info')
+ self.assertFalse(ssl_cert_status.value() &
+ pyauto.uint32p.frompointer(
+ pyauto.CERT_STATUS_AUTHORITY_INVALID).value(),
dennis_jeffrey 2012/02/29 23:37:13 indent the above 2 lines by 1 more space each.
dyu1 2012/03/05 19:16:46 Done.
+ msg='Cert OK is invalid')
+
+
if __name__ == '__main__':
pyauto_functional.Main()
« no previous file with comments | « no previous file | chrome/test/pyautolib/pyautolib.i » ('j') | chrome/test/pyautolib/pyautolib.i » ('J')

Powered by Google App Engine
This is Rietveld 408576698