Chromium Code Reviews| 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 import logging | 7 import logging |
| 8 | 8 |
| 9 import pyauto_functional # Must be imported before pyauto | 9 import pyauto_functional # Must be imported before pyauto |
| 10 import pyauto | 10 import pyauto |
| 11 | 11 |
| 12 | 12 |
| 13 class CookiesTest(pyauto.PyUITest): | 13 class CookiesTest(pyauto.PyUITest): |
| 14 """Tests for Cookies.""" | 14 """Tests for Cookies.""" |
| 15 | 15 |
| 16 def __init__(self, methodName='runTest'): | 16 def __init__(self, methodName='runTest'): |
| 17 super(CookiesTest, self).__init__(methodName) | 17 super(CookiesTest, self).__init__(methodName) |
| 18 self.test_host = os.environ.get('COOKIES_TEST_HOST', 'www.google.com') | 18 self.test_host = os.environ.get('COOKIES_TEST_HOST', 'google.com') |
|
jochen (gone - plz use gerrit)
2012/05/24 11:04:03
www.google.com sets cookies for google.com. We'll
| |
| 19 | 19 |
| 20 def setUp(self): | 20 def setUp(self): |
| 21 pyauto.PyUITest.setUp(self); | 21 pyauto.PyUITest.setUp(self); |
| 22 # Set the startup preference to "open the new tab page", if the startup | 22 # Set the startup preference to "open the new tab page", if the startup |
| 23 # preference is "continue where I left off", session cookies will be saved. | 23 # preference is "continue where I left off", session cookies will be saved. |
| 24 self.SetPrefs(pyauto.kRestoreOnStartup, 5); | 24 self.SetPrefs(pyauto.kRestoreOnStartup, 5); |
| 25 | 25 |
| 26 def _CookieCheckIncognitoWindow(self, url, cookies_enabled=True): | 26 def _CookieCheckIncognitoWindow(self, url, cookies_enabled=True): |
| 27 """Check the cookie for the given URL in an incognito window.""" | 27 """Check the cookie for the given URL in an incognito window.""" |
| 28 # Navigate to the URL in an incognito window and verify no cookie is set. | 28 # Navigate to the URL in an incognito window and verify no cookie is set. |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 241 # Restart the browser to check that the cookie doesn't persist. | 241 # Restart the browser to check that the cookie doesn't persist. |
| 242 # (This fails on ChromeOS because kRestoreOnStartup is ignored and | 242 # (This fails on ChromeOS because kRestoreOnStartup is ignored and |
| 243 # the startup preference is always "continue where I left off.") | 243 # the startup preference is always "continue where I left off.") |
| 244 if not self.IsChromeOS(): | 244 if not self.IsChromeOS(): |
| 245 self.RestartBrowser(clear_profile=False) | 245 self.RestartBrowser(clear_profile=False) |
| 246 self.assertFalse(self.GetCookie(pyauto.GURL(http_url)), | 246 self.assertFalse(self.GetCookie(pyauto.GURL(http_url)), |
| 247 msg='Cookie persisted after restarting session.') | 247 msg='Cookie persisted after restarting session.') |
| 248 | 248 |
| 249 if __name__ == '__main__': | 249 if __name__ == '__main__': |
| 250 pyauto_functional.Main() | 250 pyauto_functional.Main() |
| OLD | NEW |