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 # If this test is failing, please check these steps. | 6 # If this test is failing, please check these steps. |
7 # | 7 # |
8 # - You introduced a new policy: | 8 # - You introduced a new policy: |
9 # Cool! Edit |policies| in policy_test_cases.py and add an entry for it. | 9 # Cool! Edit |policies| in policy_test_cases.py and add an entry for it. |
10 # See the comment above it for the format. | 10 # See the comment above it for the format. |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 settings_pages += [ | 43 settings_pages += [ |
44 'chrome://settings-frame/accounts', | 44 'chrome://settings-frame/accounts', |
45 ] | 45 ] |
46 | 46 |
47 def setUp(self): | 47 def setUp(self): |
48 policy_base.PolicyTestBase.setUp(self) | 48 policy_base.PolicyTestBase.setUp(self) |
49 if self.IsChromeOS(): | 49 if self.IsChromeOS(): |
50 self.LoginWithTestAccount() | 50 self.LoginWithTestAccount() |
51 | 51 |
52 def IsAnyBannerVisible(self): | 52 def IsAnyBannerVisible(self): |
53 """Returns true if any managed prefs banner is visible in the current page. | 53 """Returns true if any banner (e.g. for managed prefs) is visible.""" |
54 """ | |
55 ret = self.ExecuteJavascript(""" | 54 ret = self.ExecuteJavascript(""" |
56 var visible = false; | 55 var visible = false; |
57 var banners = document.querySelectorAll('.managed-prefs-banner'); | 56 var banners = document.querySelectorAll('.page-banner'); |
58 for (var i=0; i<banners.length; i++) { | 57 for (var i=0; i<banners.length; i++) { |
59 if (banners[i].parentElement.id == 'templates') | 58 if (banners[i].parentElement.id == 'templates') |
60 continue; | 59 continue; |
61 | 60 |
62 if (window.getComputedStyle(banners[i]).display != 'none') | 61 if (window.getComputedStyle(banners[i]).display != 'none') |
63 visible = true; | 62 visible = true; |
64 } | 63 } |
65 domAutomationController.send(visible.toString()); | 64 domAutomationController.send(visible.toString()); |
66 """) | 65 """) |
67 return ret == 'true' | 66 return ret == 'true' |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 | 172 |
174 self.SetUserPolicy(policy_dict) | 173 self.SetUserPolicy(policy_dict) |
175 self.assertTrue(self.IsAnyBannerVisible()) | 174 self.assertTrue(self.IsAnyBannerVisible()) |
176 | 175 |
177 self.SetUserPolicy({}) | 176 self.SetUserPolicy({}) |
178 self.assertFalse(self.IsAnyBannerVisible()) | 177 self.assertFalse(self.IsAnyBannerVisible()) |
179 | 178 |
180 | 179 |
181 if __name__ == '__main__': | 180 if __name__ == '__main__': |
182 pyauto_functional.Main() | 181 pyauto_functional.Main() |
OLD | NEW |