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

Unified Diff: chrome/test/pyautolib/policy_base.py

Issue 10830053: [chromeos] Simplify chromeos device policy tests (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: relogin hack Created 8 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: chrome/test/pyautolib/policy_base.py
diff --git a/chrome/test/pyautolib/policy_base.py b/chrome/test/pyautolib/policy_base.py
index 24c5c4c82fdd99f9994e77001b866700010378d1..b118cb7dae1a7e6c57c13c6bcfbc5cac6410a3a6 100644
--- a/chrome/test/pyautolib/policy_base.py
+++ b/chrome/test/pyautolib/policy_base.py
@@ -102,6 +102,9 @@ class PolicyTestBase(pyauto.PyUITest):
device_id = string.upper(str(uuid.uuid4()))
machine_id = 'CROSTEST'
+ _auth_server = None
+ _dns_server = None
+
@staticmethod
def _Call(command, check=False):
"""Invokes a subprocess and optionally asserts the return value is zero."""
@@ -321,7 +324,8 @@ class PolicyTestBase(pyauto.PyUITest):
cros_ui.stop(allow_fail=True)
# Stop mock GAIA server.
- self._auth_server.stop()
+ if self._auth_server:
+ self._auth_server.stop()
# Reenable TPM if present.
if os.path.exists(TPM_SYSFS_PATH):
@@ -331,7 +335,8 @@ class PolicyTestBase(pyauto.PyUITest):
self._ClearInstallAttributesOnChromeOS()
# Stop mock DNS server.
- self._dns_server.stop()
+ if self._dns_server:
+ self._dns_server.stop()
# Stop mock DMServer.
self.StopHTTPServer(self._http_server)
@@ -357,8 +362,16 @@ class PolicyTestBase(pyauto.PyUITest):
"""
if self.IsChromeOS():
# Perform the remainder of the setup with the device manager stopped.
- self.WaitForSessionManagerRestart(
- self._SetUpWithSessionManagerStopped)
+ try:
+ self.WaitForSessionManagerRestart(
+ self._SetUpWithSessionManagerStopped)
+ except:
+ # Destroy the non re-entrant services.
+ if self._auth_server:
+ self._auth_server.stop()
+ if self._dns_server:
+ self._dns_server.stop()
+ raise
pyauto.PyUITest.setUp(self)
self._branding = self.GetBrowserInfo()['properties']['branding']

Powered by Google App Engine
This is Rietveld 408576698