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

Side by Side Diff: chrome/test/pyautolib/policy_base.py

Issue 9583034: PyAuto tests derived from PolicyTestBase now clear the profile. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 9 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 | chrome/test/pyautolib/pyauto.py » ('j') | chrome/test/pyautolib/pyauto.py » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/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 """Base class for tests that need to update the policies enforced by Chrome. 6 """Base class for tests that need to update the policies enforced by Chrome.
7 7
8 Subclasses can call SetPolicies with a dictionary of policies to install. 8 Subclasses can call SetPolicies with a dictionary of policies to install.
9 SetPolicies can also be used to set the device policies on ChromeOS. 9 SetPolicies can also be used to set the device policies on ChromeOS.
10 10
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 280
281 self._WriteUserPolicyToken(user_dmtoken) 281 self._WriteUserPolicyToken(user_dmtoken)
282 # The browser has to be reloaded to make the user policy token cache 282 # The browser has to be reloaded to make the user policy token cache
283 # reload the file just written. The file can also be written only after 283 # reload the file just written. The file can also be written only after
284 # the cryptohome is mounted, after login. 284 # the cryptohome is mounted, after login.
285 self.RestartBrowser(clear_profile=False) 285 self.RestartBrowser(clear_profile=False)
286 286
287 def tearDown(self): 287 def tearDown(self):
288 """Cleans up the files created by setUp.""" 288 """Cleans up the files created by setUp."""
289 if self.IsChromeOS(): 289 if self.IsChromeOS():
290 self.StopHTTPServer(self._http_server) 290 self.StopHTTPServer(self._http_server)
Nirnimesh 2012/03/03 02:22:01 While you're in this code, could you also move thi
frankf 2012/03/03 03:48:05 Done.
291 pyauto_utils.RemovePath(self._temp_data_dir) 291 pyauto_utils.RemovePath(self._temp_data_dir)
292 pyauto.PyUITest.Logout(self)
dtu 2012/03/03 02:14:41 Kind of surprised this wasn't there before, since
293
292 pyauto.PyUITest.tearDown(self) 294 pyauto.PyUITest.tearDown(self)
293 295
294 def SetPolicies(self, user_policy=None, device_policy=None): 296 def SetPolicies(self, user_policy=None, device_policy=None):
295 """Enforces the policies given in the arguments as dictionaries. 297 """Enforces the policies given in the arguments as dictionaries.
296 298
297 device_policy will be applied on ChromeOS only, and ignored on other 299 device_policy will be applied on ChromeOS only, and ignored on other
298 platforms. 300 platforms.
299 301
300 On other platforms, this call is only available on non-official builds. 302 On other platforms, this call is only available on non-official builds.
301 303
302 This policies will have been installed after this call returns. 304 This policies will have been installed after this call returns.
303 """ 305 """
304 if self.IsChromeOS(): 306 if self.IsChromeOS():
305 self._SetCloudPolicies(user_mandatory=user_policy, device=device_policy) 307 self._SetCloudPolicies(user_mandatory=user_policy, device=device_policy)
306 self.RefreshPolicies() 308 self.RefreshPolicies()
307 elif not self.GetBrowserInfo()['properties']['is_official']: 309 elif not self.GetBrowserInfo()['properties']['is_official']:
308 pyauto.PyUITest.SetPolicies(self, managed_platform=user_policy) 310 pyauto.PyUITest.SetPolicies(self, managed_platform=user_policy)
309 else: 311 else:
310 raise AssertionError('Not available on this platform and build.') 312 raise AssertionError('Not available on this platform and build.')
OLDNEW
« no previous file with comments | « no previous file | chrome/test/pyautolib/pyauto.py » ('j') | chrome/test/pyautolib/pyauto.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698