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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/chrome_tests.gypi ('k') | chrome/test/pyautolib/pyautolib.i » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 import os 6 import os
7 7
8 import pyauto_functional # Must be imported before pyauto 8 import pyauto_functional # Must be imported before pyauto
9 import pyauto 9 import pyauto
10 import pyauto_paths 10 import pyauto_paths
11 11
12 class HTTPSTest(pyauto.PyUITest): 12 class HTTPSTest(pyauto.PyUITest):
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 first_page_title = self.GetActiveTabTitle() 83 first_page_title = self.GetActiveTabTitle()
84 self.NavigateToURL( 84 self.NavigateToURL(
85 server.GetURL('google.html').spec()) 85 server.GetURL('google.html').spec())
86 tab_proxy = self.GetBrowserWindow(0).GetTab(0) 86 tab_proxy = self.GetBrowserWindow(0).GetTab(0)
87 # Equivalent to clicking 'back to safety' button. 87 # Equivalent to clicking 'back to safety' button.
88 self.assertTrue(tab_proxy.TakeActionOnSSLBlockingPage(False), 88 self.assertTrue(tab_proxy.TakeActionOnSSLBlockingPage(False),
89 msg="Was not able to go back from the interstitial page.") 89 msg="Was not able to go back from the interstitial page.")
90 self.assertEqual(self.GetActiveTabTitle(), first_page_title, 90 self.assertEqual(self.GetActiveTabTitle(), first_page_title,
91 msg="Did not go back to previous page correctly.") 91 msg="Did not go back to previous page correctly.")
92 92
93 def testSSLCertOK(self):
94 """Verify Certificate OK does not display interstitial page.
95
96 This test also asserts that the page type is normal.
97 """
98 url = self._https_server_ok.GetURL('google.html').spec()
99 self.NavigateToURL(url)
100 tab_proxy = self.GetBrowserWindow(0).GetTab(0)
101 result_dict = tab_proxy.GetPageType()
102 self.assertTrue(result_dict, msg='Could not determine the type of the page')
103 self.assertEqual(
104 result_dict['page_type'], pyauto.PAGE_TYPE_NORMAL,
105 msg="Cert OK displayed error page %s." % result_dict['page_type'])
dennis_jeffrey 2012/03/14 22:51:21 nit: 'error page' --> 'page type'
dyu1 2012/03/14 22:59:04 Done.
106
107 def testSSLCertIsExpiredAndCertNameMismatches(self):
108 """Verify Certificate Expiration and Certificate Mismatched name."""
109 for server, cert_status_flag, msg in zip(
110 (self._https_server_expired, self._https_server_mismatched),
111 (pyauto.CERT_STATUS_DATE_INVALID,
112 pyauto.CERT_STATUS_COMMON_NAME_INVALID),
113 ('Cert has not expired', 'Cert name does not mismatch')):
114 self.NavigateToURL(server.GetURL('google.html').spec())
115 result_dict = self.GetBrowserWindow(0).GetTab(0).GetSecurityState()
116 self.assertTrue(result_dict, msg='Could not get security state info')
117 self.assertTrue(
118 result_dict['ssl_cert_status'] & pyauto.uint32_ptr.frompointer(
119 cert_status_flag).value(),
120 msg=msg)
121
122 def testSSLCertAuthorityOK(self):
123 """Verify Certificate OK is valid."""
124 self.NavigateToURL(
125 self._https_server_mismatched.GetURL('google.html').spec())
126 result_dict = self.GetBrowserWindow(0).GetTab(0).GetSecurityState()
127 self.assertTrue(result_dict, msg='Could not get security state info')
128 self.assertFalse(
129 result_dict['ssl_cert_status'] & pyauto.uint32_ptr.frompointer(
130 pyauto.CERT_STATUS_AUTHORITY_INVALID).value(),
131 msg='Cert OK is invalid')
132
93 133
94 if __name__ == '__main__': 134 if __name__ == '__main__':
95 pyauto_functional.Main() 135 pyauto_functional.Main()
OLDNEW
« no previous file with comments | « chrome/chrome_tests.gypi ('k') | chrome/test/pyautolib/pyautolib.i » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698