OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2012 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 |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 url = self._https_server_ok.GetURL('google.html').spec() | 98 url = self._https_server_ok.GetURL('google.html').spec() |
99 self.NavigateToURL(url) | 99 self.NavigateToURL(url) |
100 tab_proxy = self.GetBrowserWindow(0).GetTab(0) | 100 tab_proxy = self.GetBrowserWindow(0).GetTab(0) |
101 result_dict = tab_proxy.GetPageType() | 101 result_dict = tab_proxy.GetPageType() |
102 self.assertTrue(result_dict, msg='Could not determine the type of the page') | 102 self.assertTrue(result_dict, msg='Could not determine the type of the page') |
103 page_type_dict = { | 103 page_type_dict = { |
104 pyauto.PAGE_TYPE_INTERSTITIAL: 'interstitial', | 104 pyauto.PAGE_TYPE_INTERSTITIAL: 'interstitial', |
105 pyauto.PAGE_TYPE_ERROR: 'error'} | 105 pyauto.PAGE_TYPE_ERROR: 'error'} |
106 self.assertEqual( | 106 self.assertEqual( |
107 result_dict['page_type'], pyauto.PAGE_TYPE_NORMAL, | 107 result_dict['page_type'], pyauto.PAGE_TYPE_NORMAL, |
108 msg='Cert OK displayed page type: %s, but expected type normal.' | 108 msg='Cert OK did not display page type normal.') |
109 % page_type_dict[result_dict['page_type']]) | |
110 | 109 |
111 def testSSLCertIsExpiredAndCertNameMismatches(self): | 110 def testSSLCertIsExpiredAndCertNameMismatches(self): |
112 """Verify Certificate Expiration and Certificate Mismatched name.""" | 111 """Verify Certificate Expiration and Certificate Mismatched name.""" |
113 for server, cert_status_flag, msg in zip( | 112 for server, cert_status_flag, msg in zip( |
114 (self._https_server_expired, self._https_server_mismatched), | 113 (self._https_server_expired, self._https_server_mismatched), |
115 (pyauto.CERT_STATUS_DATE_INVALID, | 114 (pyauto.CERT_STATUS_DATE_INVALID, |
116 pyauto.CERT_STATUS_COMMON_NAME_INVALID), | 115 pyauto.CERT_STATUS_COMMON_NAME_INVALID), |
117 ('Cert has not expired', 'Cert name does not mismatch')): | 116 ('Cert has not expired', 'Cert name does not mismatch')): |
118 self.NavigateToURL(server.GetURL('google.html').spec()) | 117 self.NavigateToURL(server.GetURL('google.html').spec()) |
119 result_dict = self.GetBrowserWindow(0).GetTab(0).GetSecurityState() | 118 result_dict = self.GetBrowserWindow(0).GetTab(0).GetSecurityState() |
(...skipping 10 matching lines...) Expand all Loading... |
130 result_dict = self.GetBrowserWindow(0).GetTab(0).GetSecurityState() | 129 result_dict = self.GetBrowserWindow(0).GetTab(0).GetSecurityState() |
131 self.assertTrue(result_dict, msg='Could not get security state info') | 130 self.assertTrue(result_dict, msg='Could not get security state info') |
132 self.assertFalse( | 131 self.assertFalse( |
133 result_dict['ssl_cert_status'] & pyauto.uint32_ptr.frompointer( | 132 result_dict['ssl_cert_status'] & pyauto.uint32_ptr.frompointer( |
134 pyauto.CERT_STATUS_AUTHORITY_INVALID).value(), | 133 pyauto.CERT_STATUS_AUTHORITY_INVALID).value(), |
135 msg='Cert OK is invalid') | 134 msg='Cert OK is invalid') |
136 | 135 |
137 | 136 |
138 if __name__ == '__main__': | 137 if __name__ == '__main__': |
139 pyauto_functional.Main() | 138 pyauto_functional.Main() |
OLD | NEW |