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 13 matching lines...) Expand all Loading... |
24 import policy_base | 24 import policy_base |
25 import pyauto | 25 import pyauto |
26 | 26 |
27 from policy_test_cases import PolicyPrefsTestCases | 27 from policy_test_cases import PolicyPrefsTestCases |
28 | 28 |
29 | 29 |
30 class PolicyPrefsUITest(policy_base.PolicyTestBase): | 30 class PolicyPrefsUITest(policy_base.PolicyTestBase): |
31 """Tests policies and their impact on the prefs UI.""" | 31 """Tests policies and their impact on the prefs UI.""" |
32 | 32 |
33 settings_pages = [ | 33 settings_pages = [ |
34 'chrome://settings/browser', | 34 'chrome://settings-frame', |
35 'chrome://settings/personal', | 35 'chrome://settings-frame/searchEngines', |
36 'chrome://settings/advanced', | 36 'chrome://settings-frame/passwords', |
37 'chrome://settings/searchEngines', | 37 'chrome://settings-frame/autofill', |
38 'chrome://settings/passwords', | 38 'chrome://settings-frame/content', |
39 'chrome://settings/autofill', | 39 'chrome://settings-frame/languages', |
40 'chrome://settings/content', | |
41 'chrome://settings/languages', | |
42 'chrome://settings/extensions', | |
43 ] | 40 ] |
44 if pyauto.PyUITest.IsChromeOS(): | 41 if pyauto.PyUITest.IsChromeOS(): |
45 settings_pages += [ | 42 settings_pages += [ |
46 'chrome://settings/system', | 43 'chrome://settings-frame/accounts', |
47 'chrome://settings/internet', | |
48 'chrome://settings/accounts', | |
49 ] | 44 ] |
50 | 45 |
51 def GetPlatform(self): | 46 def GetPlatform(self): |
52 if self.IsChromeOS(): | 47 if self.IsChromeOS(): |
53 return 'chromeos' | 48 return 'chromeos' |
54 elif self.IsLinux(): | 49 elif self.IsLinux(): |
55 return 'linux' | 50 return 'linux' |
56 elif self.IsMac(): | 51 elif self.IsMac(): |
57 return 'mac' | 52 return 'mac' |
58 elif self.IsWin(): | 53 elif self.IsWin(): |
59 return 'win' | 54 return 'win' |
60 else: | 55 else: |
61 self.fail(msg='Unknown platform') | 56 self.fail(msg='Unknown platform') |
62 | 57 |
63 def IsBannerVisible(self): | 58 def IsBannerVisible(self): |
64 """Returns true if the managed-banner is visible in the current page.""" | 59 """Returns true if the managed-banner is visible in the current page.""" |
| 60 # TODO(csilv): This logic assumes there is only one banner, it needs to be |
| 61 # updated to work with uber page. |
65 ret = self.ExecuteJavascript(""" | 62 ret = self.ExecuteJavascript(""" |
66 var visible = false; | 63 var visible = false; |
67 var banner = document.getElementById('managed-prefs-banner'); | 64 var banner = document.getElementById('managed-prefs-banner'); |
68 if (banner) | 65 if (banner) |
69 visible = !banner.hidden; | 66 visible = !banner.hidden; |
70 domAutomationController.send(visible.toString()); | 67 domAutomationController.send(visible.toString()); |
71 """) | 68 """) |
72 return ret == 'true' | 69 return ret == 'true' |
73 | 70 |
74 def testNoPoliciesNoBanner(self): | 71 def testNoPoliciesNoBanner(self): |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 | 167 |
171 self.SetPolicies(policy_dict) | 168 self.SetPolicies(policy_dict) |
172 self.assertTrue(self.IsBannerVisible()) | 169 self.assertTrue(self.IsBannerVisible()) |
173 | 170 |
174 self.SetPolicies({}) | 171 self.SetPolicies({}) |
175 self.assertFalse(self.IsBannerVisible()) | 172 self.assertFalse(self.IsBannerVisible()) |
176 | 173 |
177 | 174 |
178 if __name__ == '__main__': | 175 if __name__ == '__main__': |
179 pyauto_functional.Main() | 176 pyauto_functional.Main() |
OLD | NEW |