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

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 | « no previous file | chrome/test/pyautolib/pyautolib.i » ('j') | chrome/test/pyautolib/pyautolib.i » ('J')
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) 2011 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 for server in (self._https_server_expired, 62 for server in (self._https_server_expired,
63 self._https_server_mismatched): 63 self._https_server_mismatched):
64 url = server.GetURL('google.html').spec() 64 url = server.GetURL('google.html').spec()
65 self.NavigateToURL(url) 65 self.NavigateToURL(url)
66 tab_proxy = self.GetBrowserWindow(0).GetTab(0) 66 tab_proxy = self.GetBrowserWindow(0).GetTab(0)
67 # Equivalent to clicking 'proceed anyway' button. 67 # Equivalent to clicking 'proceed anyway' button.
68 self.assertTrue(tab_proxy.TakeActionOnSSLBlockingPage(True), 68 self.assertTrue(tab_proxy.TakeActionOnSSLBlockingPage(True),
69 msg="Did not proceed from the interstitial page.") 69 msg="Did not proceed from the interstitial page.")
70 self.assertTrue( 70 self.assertTrue(
71 'google' in self.GetActiveTabTitle().lower(), 71 'google' in self.GetActiveTabTitle().lower(),
72 msg="Did not correctly proceed from the interstitial page.") 72 msg='Did not correctly proceed from the interstitial page.')
73 73
74 def testSSLGoBack(self): 74 def testSSLGoBack(self):
75 """Verify able to go back from the interstitial page to the previous site. 75 """Verify able to go back from the interstitial page to the previous site.
76 76
77 Visits a page with https error and then goes back using Browser::GoBack. 77 Visits a page with https error and then goes back using Browser::GoBack.
78 """ 78 """
79 for server in (self._https_server_expired, 79 for server in (self._https_server_expired,
80 self._https_server_mismatched): 80 self._https_server_mismatched):
81 self.NavigateToURL( 81 self.NavigateToURL(
82 self.GetHttpURLForDataPath('ssl', 'google.html')) 82 self.GetHttpURLForDataPath('ssl', 'google.html'))
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
93 def testSSLCertOK(self):
94 """Verifiy certificate OK does not display interstitial page."""
95 url = self._https_server_ok.GetURL('google.html').spec()
96 self.NavigateToURL(url)
97 tab_proxy = self.GetBrowserWindow(0).GetTab(0)
98 success, page_type = tab_proxy.GetPageType()
99 self.assertTrue(success, msg='Could not determine the page type.')
100 self.assertNotEqual(page_type, pyauto.PAGE_TYPE_INTERSTITIAL,
101 msg='Cert OK displayed interstitial page.')
102 self.assertEqual(page_type, pyauto.PAGE_TYPE_NORMAL,
103 msg='Cert OK displayed error page.')
104
105 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
106 """Verify certificate expired is expired."""
107 url = self._https_server_expired.GetURL('google.html').spec()
108 self.NavigateToURL(url)
109 tab_proxy = self.GetBrowserWindow(0).GetTab(0)
110 security_style = pyauto.intp()
111 ssl_cert_status = pyauto.uint32p()
112 insecure_content_status = pyauto.intp()
113 success = tab_proxy.GetSecurityState(
114 security_style, ssl_cert_status, insecure_content_status)
115 self.assertTrue(success, msg='Could not get security state info')
116 self.assertTrue(ssl_cert_status.value() &
117 pyauto.uint32p.frompointer(
118 pyauto.CERT_STATUS_DATE_INVALID).value(),
119 msg='Cert has not expired')
120
121 def testSSLNameMismatches(self):
122 """Verify certificate mismatched has mismatched name."""
123 url = self._https_server_mismatched.GetURL('google.html').spec()
124 self.NavigateToURL(url)
125 tab_proxy = self.GetBrowserWindow(0).GetTab(0)
126 security_style = pyauto.intp()
127 ssl_cert_status = pyauto.uint32p()
128 insecure_content_status = pyauto.intp()
129 success = tab_proxy.GetSecurityState(
130 security_style, ssl_cert_status, insecure_content_status)
131 self.assertTrue(success, msg='Could not get security state info')
132 self.assertTrue(ssl_cert_status.value() &
133 pyauto.uint32p.frompointer(
134 pyauto.CERT_STATUS_COMMON_NAME_INVALID).value(),
135 msg='Cert name does not mismatch')
136
137 def testSSLCertAuthorityOK(self):
138 """Verify certificate OK is valid."""
139 url = self._https_server_mismatched.GetURL('google.html').spec()
140 self.NavigateToURL(url)
141 tab_proxy = self.GetBrowserWindow(0).GetTab(0)
142 security_style = pyauto.intp()
143 ssl_cert_status = pyauto.uint32p()
144 insecure_content_status = pyauto.intp()
145 success = tab_proxy.GetSecurityState(
146 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
147 self.assertTrue(success, msg='Could not get security state info')
148 self.assertFalse(ssl_cert_status.value() &
149 pyauto.uint32p.frompointer(
150 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.
151 msg='Cert OK is invalid')
92 152
93 153
94 if __name__ == '__main__': 154 if __name__ == '__main__':
95 pyauto_functional.Main() 155 pyauto_functional.Main()
OLDNEW
« 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