OLD | NEW |
---|---|
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. |
dennis_jeffrey
2012/03/09 02:07:47
2011 --> 2012
dyu1
2012/03/14 19:00:10
Done.
| |
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 Loading... | |
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.""" | |
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.
| |
95 url = self._https_server_ok.GetURL('google.html').spec() | |
96 self.NavigateToURL(url) | |
97 tab_proxy = self.GetBrowserWindow(0).GetTab(0) | |
98 result_dict = tab_proxy.GetPageType() | |
99 self.assertTrue(result_dict, msg='Could not determine the type of the page') | |
100 self.assertNotEqual(result_dict['page_type'], pyauto.PAGE_TYPE_INTERSTITIAL, | |
101 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.
| |
102 self.assertEqual(result_dict['page_type'], pyauto.PAGE_TYPE_NORMAL, | |
103 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.
| |
104 | |
105 def testSSLCertIsExpiredAndCertNameMismatches(self): | |
106 """Verify Certificate Expiration and Certificate Mismatched name.""" | |
107 for server, cert_status_flag, msg in zip((self._https_server_expired, | |
108 self._https_server_mismatched), | |
109 (pyauto.CERT_STATUS_DATE_INVALID, | |
110 pyauto.CERT_STATUS_COMMON_NAME_INVALID), | |
111 ('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.
| |
112 self.NavigateToURL(server.GetURL('google.html').spec()) | |
113 result_dict = self.GetBrowserWindow(0).GetTab(0).GetSecurityState() | |
114 self.assertTrue(result_dict, msg='Could not get security state info') | |
115 self.assertTrue( | |
116 result_dict['ssl_cert_status'] & pyauto.uint32_ptr.frompointer( | |
117 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.
| |
118 | |
119 def testSSLCertAuthorityOK(self): | |
120 """Verify Certificate OK is valid.""" | |
121 self.NavigateToURL( | |
122 self._https_server_mismatched.GetURL('google.html').spec()) | |
123 result_dict = self.GetBrowserWindow(0).GetTab(0).GetSecurityState() | |
124 self.assertTrue(result_dict, msg='Could not get security state info') | |
125 self.assertFalse( | |
126 result_dict['ssl_cert_status'] & pyauto.uint32_ptr.frompointer( | |
127 pyauto.CERT_STATUS_AUTHORITY_INVALID).value(), | |
128 msg='Cert OK is invalid') | |
129 | |
93 | 130 |
94 if __name__ == '__main__': | 131 if __name__ == '__main__': |
95 pyauto_functional.Main() | 132 pyauto_functional.Main() |
OLD | NEW |