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 logging | 6 import logging |
7 import os | 7 import os |
8 | 8 |
9 import pyauto_functional # must come before pyauto. | 9 import pyauto_functional # must come before pyauto. |
10 import policy_base | 10 import policy_base |
(...skipping 610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
621 self.SetUserPolicy({ | 621 self.SetUserPolicy({ |
622 'ExtensionInstallForcelist': [self._SCREEN_CAPTURE_CRX_ID], | 622 'ExtensionInstallForcelist': [self._SCREEN_CAPTURE_CRX_ID], |
623 }) | 623 }) |
624 # Give the system 30 seconds to go get this extension. We are not sure how | 624 # Give the system 30 seconds to go get this extension. We are not sure how |
625 # long it will take the policy to take affect and download the extension. | 625 # long it will take the policy to take affect and download the extension. |
626 self.assertTrue(self.WaitUntil(lambda: | 626 self.assertTrue(self.WaitUntil(lambda: |
627 self._CheckForExtensionByID(self._SCREEN_CAPTURE_CRX_ID), | 627 self._CheckForExtensionByID(self._SCREEN_CAPTURE_CRX_ID), |
628 expect_retval=True), | 628 expect_retval=True), |
629 msg='The force install extension was never installed.') | 629 msg='The force install extension was never installed.') |
630 | 630 |
631 def testClearSiteDataOnExit(self): | |
632 """Verify the ClearSiteDataOnExit policy is taking effect. | |
633 | |
634 Install a cookie and make sure the cookie gets removed on browser restart | |
635 when the policy is set. | |
636 """ | |
637 cookie_url = 'http://example.com' | |
638 cookie_val = 'ponies=unicorns' | |
639 self.SetCookie(pyauto.GURL(cookie_url), | |
640 cookie_val + ';expires=Wed Jan 01 3000 00:00:00 GMT') | |
641 | |
642 # Cookie should be kept over restarts. | |
643 self.RestartBrowser(clear_profile=False) | |
644 self.assertEqual( | |
645 cookie_val, self.GetCookie(pyauto.GURL(cookie_url)), | |
646 msg='Cookie on ' + cookie_url + ' does not match ' + cookie_val + '.'); | |
647 | |
648 # With the policy set, the cookie should be gone after a restart. | |
649 self.SetUserPolicy({ | |
650 'ClearSiteDataOnExit': True | |
651 }) | |
652 self.RestartBrowser(clear_profile=False) | |
653 self.assertFalse( | |
654 self.GetCookie(pyauto.GURL(cookie_url)), | |
655 msg='Cookie present on ' + cookie_url + '.'); | |
656 | |
657 | 631 |
658 if __name__ == '__main__': | 632 if __name__ == '__main__': |
659 pyauto_functional.Main() | 633 pyauto_functional.Main() |
OLD | NEW |