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

Unified Diff: tools/telemetry/telemetry/unittest_util/browser_test_case.py

Issue 730183003: Revert of Attempt #4 to convert telemetry to the typ framework. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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 | « tools/telemetry/telemetry/decorators.py ('k') | tools/telemetry/telemetry/unittest_util/json_results.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/telemetry/telemetry/unittest_util/browser_test_case.py
diff --git a/tools/telemetry/telemetry/unittest_util/browser_test_case.py b/tools/telemetry/telemetry/unittest_util/browser_test_case.py
index bbecefb029e2247eee8e5d63ac728a409cae0cf7..621c381767591d719b8ff8075cc0e64dcd062c85 100644
--- a/tools/telemetry/telemetry/unittest_util/browser_test_case.py
+++ b/tools/telemetry/telemetry/unittest_util/browser_test_case.py
@@ -9,49 +9,28 @@
from telemetry.unittest_util import options_for_unittests
from telemetry.util import path
-current_browser_options = None
-current_browser = None
-
-
-def teardown_browser():
- global current_browser
- global current_browser_options
-
- if current_browser:
- current_browser.Close()
- current_browser = None
- current_browser_options = None
-
class BrowserTestCase(unittest.TestCase):
@classmethod
def setUpClass(cls):
- global current_browser
- global current_browser_options
+ options = options_for_unittests.GetCopy()
+ cls.CustomizeBrowserOptions(options.browser_options)
+ browser_to_create = browser_finder.FindBrowser(options)
+ if not browser_to_create:
+ raise Exception('No browser found, cannot continue test.')
- options = options_for_unittests.GetCopy()
-
- cls.CustomizeBrowserOptions(options.browser_options)
- if not current_browser or (current_browser_options !=
- options.browser_options):
- if current_browser:
- teardown_browser()
-
- browser_to_create = browser_finder.FindBrowser(options)
- if not browser_to_create:
- raise Exception('No browser found, cannot continue test.')
-
- try:
- current_browser = browser_to_create.Create(options)
- current_browser_options = options.browser_options
- except:
- cls.tearDownClass()
- raise
- cls._browser = current_browser
+ cls._browser = None
+ try:
+ cls._browser = browser_to_create.Create(options)
+ except:
+ cls.tearDownClass()
+ raise
@classmethod
def tearDownClass(cls):
- pass
+ if cls._browser:
+ cls._browser.Close()
+ cls._browser = None
@classmethod
def CustomizeBrowserOptions(cls, options):
« no previous file with comments | « tools/telemetry/telemetry/decorators.py ('k') | tools/telemetry/telemetry/unittest_util/json_results.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698