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

Side by Side Diff: chrome/test/functional/https.py

Issue 10870118: Remove the https pyauto test which is a duplicate of existing tests: (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 3 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/test/functional/PYAUTO_TESTS ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #!/usr/bin/env python
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
4 # found in the LICENSE file.
5
6 import os
7
8 import pyauto_functional # Must be imported before pyauto
9 import pyauto
10 import pyauto_paths
11
12 class HTTPSTest(pyauto.PyUITest):
13 """TestCase for SSL."""
14
15 def Debug(self):
16 """Test method for experimentation.
17
18 This method will not run automatically.
19 Use: python chrome/test/functional/ssl.py ssl.SSLTest.Debug
20 """
21 while True:
22 raw_input('Hit <enter> to dump info.. ')
23 self.pprint(self.GetNavigationInfo())
24
25 def testSSLPageBasic(self):
26 """Verify the navigation state in an https page."""
27 self.NavigateToURL('https://www.google.com')
28 self.assertTrue(self.WaitUntil(
29 lambda: self.GetNavigationInfo()['ssl']['security_style'],
30 expect_retval='SECURITY_STYLE_AUTHENTICATED'))
31 ssl = self.GetNavigationInfo()['ssl']
32 self.assertFalse(ssl['displayed_insecure_content'])
33 self.assertFalse(ssl['ran_insecure_content'])
34
35
36 class SSLTest(pyauto.PyUITest):
37 """TestCase for SSL."""
38
39 def setUp(self):
40 self._https_server_ok = self.StartHttpsServer(
41 pyauto.SSLOptions.CERT_OK,
42 os.path.relpath(os.path.join(self.DataDir(), 'ssl'),
43 pyauto_paths.GetSourceDir()))
44 self._https_server_expired = self.StartHttpsServer(
45 pyauto.SSLOptions.CERT_EXPIRED,
46 os.path.relpath(os.path.join(self.DataDir(), 'ssl'),
47 pyauto_paths.GetSourceDir()))
48 self._https_server_mismatched = self.StartHttpsServer(
49 pyauto.SSLOptions.CERT_MISMATCHED_NAME,
50 os.path.relpath(os.path.join(self.DataDir(), 'ssl'),
51 pyauto_paths.GetSourceDir()))
52 pyauto.PyUITest.setUp(self)
53
54 def tearDown(self):
55 pyauto.PyUITest.tearDown(self)
56 self.StopHttpsServer(self._https_server_mismatched)
57 self.StopHttpsServer(self._https_server_expired)
58 self.StopHttpsServer(self._https_server_ok)
59
60 def testSSLProceed(self):
61 """Verify able to proceed from an interstitial page."""
62 for server in (self._https_server_expired,
63 self._https_server_mismatched):
64 url = server.GetURL('google.html').spec()
65 self.NavigateToURL(url)
66 # Equivalent to clicking 'proceed anyway' button.
67 self.ActionOnSSLBlockingPage(proceed=True)
68 self.assertTrue(
69 'google' in self.GetActiveTabTitle().lower(),
70 msg="Did not correctly proceed from the interstitial page.")
71
72 def testSSLGoBack(self):
73 """Verify able to go back from the interstitial page to the previous site.
74
75 Visits a page with https error and then goes back using Browser::GoBack.
76 """
77 for server in (self._https_server_expired,
78 self._https_server_mismatched):
79 self.NavigateToURL(
80 self.GetHttpURLForDataPath('ssl', 'google.html'))
81 first_page_title = self.GetActiveTabTitle()
82 self.NavigateToURL(
83 server.GetURL('google.html').spec())
84 # Equivalent to clicking 'back to safety' button.
85 self.ActionOnSSLBlockingPage(proceed=False)
86 self.assertEqual(self.GetActiveTabTitle(), first_page_title,
87 msg="Did not go back to previous page correctly.")
88
89 def testSSLCertOK(self):
90 """Verify Certificate OK does not display interstitial page.
91
92 This test also asserts that the page type is normal.
93 """
94 url = self._https_server_ok.GetURL('google.html').spec()
95 self.NavigateToURL(url)
96 result_dict = self.GetNavigationInfo()
97 self.assertTrue(result_dict, msg='Could not determine the type of the page')
98 self.assertEqual(
99 result_dict['page_type'], 'NORMAL_PAGE',
100 msg='Cert OK did not display page type normal (page_type=%s).' %
101 result_dict['page_type'])
102
103 def testSSLCertIsExpiredAndCertNameMismatches(self):
104 """Verify Certificate Expiration and Certificate Mismatched name."""
105 for server, cert_status_flag, msg in zip(
106 (self._https_server_expired, self._https_server_mismatched),
107 (pyauto.CERT_STATUS_DATE_INVALID,
108 pyauto.CERT_STATUS_COMMON_NAME_INVALID),
109 ('Cert has not expired', 'Cert name does not mismatch')):
110 self.NavigateToURL(server.GetURL('google.html').spec())
111 result_dict = self.GetSecurityState()
112 self.assertTrue(result_dict, msg='Could not get security state info')
113 self.assertTrue(
114 result_dict['ssl_cert_status'] & pyauto.uint32_ptr.frompointer(
115 cert_status_flag).value(),
116 msg=msg)
117
118 def testSSLCertAuthorityOK(self):
119 """Verify Certificate OK is valid."""
120 self.NavigateToURL(
121 self._https_server_mismatched.GetURL('google.html').spec())
122 result_dict = self.GetSecurityState()
123 self.assertTrue(result_dict, msg='Could not get security state info')
124 self.assertFalse(
125 result_dict['ssl_cert_status'] & pyauto.uint32_ptr.frompointer(
126 pyauto.CERT_STATUS_AUTHORITY_INVALID).value(),
127 msg='Cert OK is invalid')
128
129
130 if __name__ == '__main__':
131 pyauto_functional.Main()
OLDNEW
« no previous file with comments | « chrome/test/functional/PYAUTO_TESTS ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698