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

Unified Diff: chrome/test/kasko/py/kasko/util.py

Issue 2621363002: Remove Kasko! (Closed)
Patch Set: Rebase Created 3 years, 11 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
« no previous file with comments | « chrome/test/kasko/py/kasko/report.py ('k') | chrome/test/kasko/syzyasan_integration_test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/kasko/py/kasko/util.py
diff --git a/chrome/test/kasko/py/kasko/util.py b/chrome/test/kasko/py/kasko/util.py
deleted file mode 100755
index 4189157fae87dce628080c665c0cda08a309cb4e..0000000000000000000000000000000000000000
--- a/chrome/test/kasko/py/kasko/util.py
+++ /dev/null
@@ -1,77 +0,0 @@
-#!/usr/bin/env python
-# Copyright 2016 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-"""Various utilities useful for performing Kasko integration tests."""
-
-import logging
-import os
-import shutil
-import tempfile
-
-
-_LOGGER = logging.getLogger(os.path.basename(__file__))
-
-
-class ScopedTempDir(object):
- """A class that creates a scoped temporary directory."""
-
- def __init__(self):
- self.path_ = None
-
- def __enter__(self):
- """Creates the temporary directory and initializes |path|."""
- self.path_ = tempfile.mkdtemp(prefix='kasko_integration_')
- return self
-
- def __exit__(self, *args, **kwargs):
- """Destroys the temporary directory."""
- if self.path_ is None:
- return
- shutil.rmtree(self.path_)
-
- @property
- def path(self):
- return self.path_
-
- def release(self):
- path = self.path_
- self.path_ = None
- return path
-
-
-class ScopedStartStop(object):
- """Utility class for calling 'start' and 'stop' within a scope."""
-
- def __init__(self, service, start=None, stop=None):
- self.service_ = service
-
- if start is None:
- self.start_ = lambda x: x.start()
- else:
- self.start_ = start
-
- if stop is None:
- self.stop_ = lambda x: x.stop()
- else:
- self.stop_ = stop
-
- def __enter__(self):
- self.start_(self.service_)
- return self
-
- def __exit__(self, *args, **kwargs):
- if self.service_:
- self.stop_(self.service_)
-
- @property
- def service(self):
- """Returns the encapsulated service, retaining ownership."""
- return self.service_
-
- def release(self):
- """Relinquishes ownership of the encapsulated service and returns it."""
- service = self.service_
- self.service_ = None
- return service
« no previous file with comments | « chrome/test/kasko/py/kasko/report.py ('k') | chrome/test/kasko/syzyasan_integration_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698