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

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

Issue 659293003: Switch telemetry over to use typ to run the unit tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@rev_typ_v086
Patch Set: fix merge error in browser_test_case 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/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/browser_test_case.py
diff --git a/tools/telemetry/telemetry/unittest/browser_test_case.py b/tools/telemetry/telemetry/unittest/browser_test_case.py
index ffb58cecabd17552ccde0fb30d6683b30689ca78..c5d6e2da6b969ecfd2f8eb09972b47430decd2dd 100644
--- a/tools/telemetry/telemetry/unittest/browser_test_case.py
+++ b/tools/telemetry/telemetry/unittest/browser_test_case.py
@@ -9,28 +9,49 @@ from telemetry.core import browser_finder
from telemetry.unittest 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.')
+ if not current_browser or (current_browser_options !=
+ options.browser_options):
+ if current_browser:
+ teardown_browser()
- cls._browser = None
- try:
- cls._browser = browser_to_create.Create(options)
- except:
- cls.tearDownClass()
- raise
+ 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
@classmethod
def tearDownClass(cls):
- if cls._browser:
- cls._browser.Close()
- cls._browser = None
+ pass
@classmethod
def CustomizeBrowserOptions(cls, options):
« no previous file with comments | « tools/telemetry/telemetry/decorators.py ('k') | tools/telemetry/telemetry/unittest/json_results.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698