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

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, 9 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
Index: chrome/test/functional/https.py
===================================================================
--- chrome/test/functional/https.py (revision 125203)
+++ chrome/test/functional/https.py (working copy)
@@ -90,6 +90,43 @@
self.assertEqual(self.GetActiveTabTitle(), first_page_title,
msg="Did not go back to previous page correctly.")
+ def testSSLCertOK(self):
+ """Verify Certificate OK does not display interstitial page."""
dennis_jeffrey 2012/03/09 02:07:47 This test is doing more than that; it's actually a
dyu1 2012/03/14 19:00:10 Done.
+ url = self._https_server_ok.GetURL('google.html').spec()
+ self.NavigateToURL(url)
+ tab_proxy = self.GetBrowserWindow(0).GetTab(0)
+ result_dict = tab_proxy.GetPageType()
+ self.assertTrue(result_dict, msg='Could not determine the type of the page')
+ self.assertNotEqual(result_dict['page_type'], pyauto.PAGE_TYPE_INTERSTITIAL,
+ msg="Cert OK displayed interstitial page.")
dennis_jeffrey 2012/03/09 02:07:47 Isn't this assertion redundant? You're already as
dyu1 2012/03/14 19:00:10 Well one is NotEqual and one is Equal. The errors
dennis_jeffrey 2012/03/14 21:55:26 I still don't understand why both assertions are n
dyu1 2012/03/14 22:32:32 Done.
+ self.assertEqual(result_dict['page_type'], pyauto.PAGE_TYPE_NORMAL,
+ msg="Cert OK displayed error page.")
dennis_jeffrey 2012/03/09 02:07:47 Change the error message to say that the page type
dyu1 2012/03/14 19:00:10 If it's not a normal page it will display and erro
dennis_jeffrey 2012/03/14 21:55:26 You're right that if it's not a normal page, it wi
dyu1 2012/03/14 22:32:32 Done.
+ def testSSLCertIsExpiredAndCertNameMismatches(self):
+ """Verify Certificate Expiration and Certificate Mismatched name."""
+ for server, cert_status_flag, msg in zip((self._https_server_expired,
+ self._https_server_mismatched),
+ (pyauto.CERT_STATUS_DATE_INVALID,
+ pyauto.CERT_STATUS_COMMON_NAME_INVALID),
+ ('Cert has not expired', 'Cert name does not mismatch')):
dennis_jeffrey 2012/03/09 02:07:47 nit: I recommend this indentation: for server, ce
dyu1 2012/03/14 19:00:10 Done.
+ self.NavigateToURL(server.GetURL('google.html').spec())
+ result_dict = self.GetBrowserWindow(0).GetTab(0).GetSecurityState()
+ self.assertTrue(result_dict, msg='Could not get security state info')
+ self.assertTrue(
+ result_dict['ssl_cert_status'] & pyauto.uint32_ptr.frompointer(
+ cert_status_flag).value(), msg=msg)
dennis_jeffrey 2012/03/09 02:07:47 nit: move the msg=msg down to the next line, and i
dyu1 2012/03/14 19:00:10 Done.
+
+ def testSSLCertAuthorityOK(self):
+ """Verify Certificate OK is valid."""
+ self.NavigateToURL(
+ self._https_server_mismatched.GetURL('google.html').spec())
+ result_dict = self.GetBrowserWindow(0).GetTab(0).GetSecurityState()
+ self.assertTrue(result_dict, msg='Could not get security state info')
+ self.assertFalse(
+ result_dict['ssl_cert_status'] & pyauto.uint32_ptr.frompointer(
+ pyauto.CERT_STATUS_AUTHORITY_INVALID).value(),
+ msg='Cert OK is invalid')
+
+
if __name__ == '__main__':
pyauto_functional.Main()

Powered by Google App Engine
This is Rietveld 408576698