| 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 c5d6e2da6b969ecfd2f8eb09972b47430decd2dd..ffb58cecabd17552ccde0fb30d6683b30689ca78 100644
|
| --- a/tools/telemetry/telemetry/unittest/browser_test_case.py
|
| +++ b/tools/telemetry/telemetry/unittest/browser_test_case.py
|
| @@ -9,49 +9,28 @@
|
| 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.')
|
|
|
| - 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):
|
|
|