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 | 10 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 msg='There should be no cookies for %s' % https_url) | 73 msg='There should be no cookies for %s' % https_url) |
74 # Incognito window | 74 # Incognito window |
75 self._CookieCheckIncognitoWindow(https_url) | 75 self._CookieCheckIncognitoWindow(https_url) |
76 # Regular window | 76 # Regular window |
77 self.NavigateToURL(https_url) | 77 self.NavigateToURL(https_url) |
78 cookie_data = self.GetCookie(pyauto.GURL(https_url)) | 78 cookie_data = self.GetCookie(pyauto.GURL(https_url)) |
79 self.assertTrue(cookie_data, | 79 self.assertTrue(cookie_data, |
80 msg='Cookie did not exist after loading %s' % https_url) | 80 msg='Cookie did not exist after loading %s' % https_url) |
81 # Restart and verify that the cookie persists. | 81 # Restart and verify that the cookie persists. |
82 self.RestartBrowser(clear_profile=False) | 82 self.RestartBrowser(clear_profile=False) |
83 self.assertTrue(cookie_data, self.GetCookie(pyauto.GURL(https_url)), | 83 self.assertEqual(cookie_data, self.GetCookie(pyauto.GURL(https_url)), |
84 msg='Cookie did not persist after restarting session.') | 84 msg='Cookie did not persist after restarting session.') |
85 | 85 |
86 def testCookiesFile(self): | 86 def testCookiesFile(self): |
87 """Test cookies set from file:// url for incognito and regular windows.""" | 87 """Test cookies set from file:// url for incognito and regular windows.""" |
88 file_url = self.GetFileURLForDataPath('setcookie.html') | 88 file_url = self.GetFileURLForDataPath('setcookie.html') |
89 self.assertFalse(self.GetCookie(pyauto.GURL(file_url)), | 89 self.assertFalse(self.GetCookie(pyauto.GURL(file_url)), |
90 msg='There should be no cookie for file url %s' % file_url) | 90 msg='There should be no cookie for file url %s' % file_url) |
91 # Incognito window | 91 # Incognito window |
92 self._CookieCheckIncognitoWindow(file_url) | 92 self._CookieCheckIncognitoWindow(file_url) |
93 # Regular window | 93 # Regular window |
94 self.NavigateToURL(file_url) | 94 self.NavigateToURL(file_url) |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 self.NavigateToURL(http_url) | 224 self.NavigateToURL(http_url) |
225 self.assertTrue(self.GetCookie(pyauto.GURL(http_url)), | 225 self.assertTrue(self.GetCookie(pyauto.GURL(http_url)), |
226 msg='Cookies are not set for the exception.') | 226 msg='Cookies are not set for the exception.') |
227 # Restart the browser to check that the cookie doesn't persist. | 227 # Restart the browser to check that the cookie doesn't persist. |
228 self.RestartBrowser(clear_profile=False) | 228 self.RestartBrowser(clear_profile=False) |
229 self.assertFalse(self.GetCookie(pyauto.GURL(http_url)), | 229 self.assertFalse(self.GetCookie(pyauto.GURL(http_url)), |
230 msg='Cookie persisted after restarting session.') | 230 msg='Cookie persisted after restarting session.') |
231 | 231 |
232 if __name__ == '__main__': | 232 if __name__ == '__main__': |
233 pyauto_functional.Main() | 233 pyauto_functional.Main() |
OLD | NEW |