Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(78)

Side by Side Diff: chrome/test/functional/policy.py

Issue 10828419: Delete the testBookmarkBarPolicy pyauto test since it's redundant with PolicyTest.BookmarkBarEnable… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 149
150 self.assertTrue(self._IsBlocked('http://news.google.com/')) 150 self.assertTrue(self._IsBlocked('http://news.google.com/'))
151 self.assertFalse(self._IsBlocked('http://www.google.com/')) 151 self.assertFalse(self._IsBlocked('http://www.google.com/'))
152 self.assertFalse(self._IsBlocked('http://google.com/')) 152 self.assertFalse(self._IsBlocked('http://google.com/'))
153 153
154 self.assertTrue(self._IsBlocked('http://chromium.org/')) 154 self.assertTrue(self._IsBlocked('http://chromium.org/'))
155 self.assertTrue(self._IsBlocked('http://www.chromium.org/')) 155 self.assertTrue(self._IsBlocked('http://www.chromium.org/'))
156 self.assertFalse(self._IsBlocked('http://dev.chromium.org/')) 156 self.assertFalse(self._IsBlocked('http://dev.chromium.org/'))
157 self.assertFalse(self._IsBlocked('http://chromium.org/chromium-os/testing')) 157 self.assertFalse(self._IsBlocked('http://chromium.org/chromium-os/testing'))
158 158
159 def testBookmarkBarPolicy(self):
160 """Tests the BookmarkBarEnabled policy."""
161 self.NavigateToURL('about:blank')
162 self.assertFalse(self.GetBookmarkBarVisibility())
163 self.assertFalse(self.IsBookmarkBarDetached())
164
165 # It should be visible in detached state, in the NTP.
166 self.NavigateToURL('chrome://newtab')
167 self.assertFalse(self.GetBookmarkBarVisibility())
168 self.assertTrue(self.IsBookmarkBarDetached())
169
170 policy = {
171 'BookmarkBarEnabled': True
172 }
173 self.SetUserPolicy(policy)
174
175 self.assertTrue(self.WaitForBookmarkBarVisibilityChange(True))
176 self.assertTrue(self.GetBookmarkBarVisibility())
177 self.assertFalse(self.IsBookmarkBarDetached())
178 # The accelerator should be disabled by the policy.
179 self.assertRaises(
180 pyauto_errors.JSONInterfaceError,
181 lambda: self.ApplyAccelerator(pyauto.IDC_SHOW_BOOKMARK_BAR))
182 self.assertTrue(self.WaitForBookmarkBarVisibilityChange(True))
183 self.assertTrue(self.GetBookmarkBarVisibility())
184 self.assertFalse(self.IsBookmarkBarDetached())
185
186 policy['BookmarkBarEnabled'] = False
187 self.SetUserPolicy(policy)
188
189 self.assertTrue(self.WaitForBookmarkBarVisibilityChange(False))
190 self.assertFalse(self.GetBookmarkBarVisibility())
191 self.assertRaises(
192 pyauto_errors.JSONInterfaceError,
193 lambda: self.ApplyAccelerator(pyauto.IDC_SHOW_BOOKMARK_BAR))
194 self.assertTrue(self.WaitForBookmarkBarVisibilityChange(False))
195 self.assertFalse(self.GetBookmarkBarVisibility())
196 # When disabled by policy, it should never be displayed at all,
197 # not even on the NTP.
198 self.assertFalse(self.IsBookmarkBarDetached())
199
200 def testJavascriptPolicies(self): 159 def testJavascriptPolicies(self):
201 """Tests the Javascript policies.""" 160 """Tests the Javascript policies."""
202 # The navigation to about:blank after each policy reset is to reset the 161 # The navigation to about:blank after each policy reset is to reset the
203 # content settings state. 162 # content settings state.
204 policy = {} 163 policy = {}
205 self.SetUserPolicy(policy) 164 self.SetUserPolicy(policy)
206 self.assertTrue(self._IsJavascriptEnabled()) 165 self.assertTrue(self._IsJavascriptEnabled())
207 self.assertTrue(self.IsMenuCommandEnabled(pyauto.IDC_DEV_TOOLS)) 166 self.assertTrue(self.IsMenuCommandEnabled(pyauto.IDC_DEV_TOOLS))
208 self.assertTrue(self.IsMenuCommandEnabled(pyauto.IDC_DEV_TOOLS_CONSOLE)) 167 self.assertTrue(self.IsMenuCommandEnabled(pyauto.IDC_DEV_TOOLS_CONSOLE))
209 168
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after
691 'ClearSiteDataOnExit': True 650 'ClearSiteDataOnExit': True
692 }) 651 })
693 self.RestartBrowser(clear_profile=False) 652 self.RestartBrowser(clear_profile=False)
694 self.assertFalse( 653 self.assertFalse(
695 self.GetCookie(pyauto.GURL(cookie_url)), 654 self.GetCookie(pyauto.GURL(cookie_url)),
696 msg='Cookie present on ' + cookie_url + '.'); 655 msg='Cookie present on ' + cookie_url + '.');
697 656
698 657
699 if __name__ == '__main__': 658 if __name__ == '__main__':
700 pyauto_functional.Main() 659 pyauto_functional.Main()
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698