Commit 750b6051 authored by nednguyen's avatar nednguyen Committed by Commit bot

[Telemetry] Remove results param in shared_state.TearDownState().

The results param was needed in shared_state.TearDownState() because of
page_test.DidRunTest hook. Now that hook is removed, we no longer need to
provide access to the results object in this method.

BUG=435757

Review URL: https://codereview.chromium.org/1140143002

Cr-Commit-Position: refs/heads/master@{#329887}
parent 228997b2
...@@ -222,7 +222,7 @@ def Run(test, user_story_set, expectations, finder_options, results, ...@@ -222,7 +222,7 @@ def Run(test, user_story_set, expectations, finder_options, results,
try: try:
# If TearDownState raises, do not catch the exception. # If TearDownState raises, do not catch the exception.
# (The Error was saved as a failure value.) # (The Error was saved as a failure value.)
state.TearDownState(results) state.TearDownState()
finally: finally:
# Later finally-blocks use state, so ensure it is cleared. # Later finally-blocks use state, so ensure it is cleared.
state = None state = None
...@@ -246,7 +246,7 @@ def Run(test, user_story_set, expectations, finder_options, results, ...@@ -246,7 +246,7 @@ def Run(test, user_story_set, expectations, finder_options, results,
if state: if state:
has_existing_exception = sys.exc_info() is not None has_existing_exception = sys.exc_info() is not None
try: try:
state.TearDownState(results) state.TearDownState()
except Exception: except Exception:
if not has_existing_exception: if not has_existing_exception:
raise raise
......
...@@ -64,7 +64,7 @@ class TestSharedState(shared_state.SharedState): ...@@ -64,7 +64,7 @@ class TestSharedState(shared_state.SharedState):
def DidRunUserStory(self, results): def DidRunUserStory(self, results):
pass pass
def TearDownState(self, results): def TearDownState(self):
pass pass
...@@ -250,7 +250,7 @@ class StoryRunnerTest(unittest.TestCase): ...@@ -250,7 +250,7 @@ class StoryRunnerTest(unittest.TestCase):
super(FoozUserStoryState, self).__init__( super(FoozUserStoryState, self).__init__(
test, options, user_story_setz) test, options, user_story_setz)
fooz_init_call_counter[0] += 1 fooz_init_call_counter[0] += 1
def TearDownState(self, _results): def TearDownState(self):
fooz_tear_down_call_counter[0] += 1 fooz_tear_down_call_counter[0] += 1
class BarzUserStoryState(BarUserStoryState): class BarzUserStoryState(BarUserStoryState):
...@@ -258,7 +258,7 @@ class StoryRunnerTest(unittest.TestCase): ...@@ -258,7 +258,7 @@ class StoryRunnerTest(unittest.TestCase):
super(BarzUserStoryState, self).__init__( super(BarzUserStoryState, self).__init__(
test, options, user_story_setz) test, options, user_story_setz)
barz_init_call_counter[0] += 1 barz_init_call_counter[0] += 1
def TearDownState(self, _results): def TearDownState(self):
barz_tear_down_call_counter[0] += 1 barz_tear_down_call_counter[0] += 1
def AssertAndCleanUpFoo(): def AssertAndCleanUpFoo():
self.assertEquals(1, fooz_init_call_counter[0]) self.assertEquals(1, fooz_init_call_counter[0])
...@@ -369,7 +369,7 @@ class StoryRunnerTest(unittest.TestCase): ...@@ -369,7 +369,7 @@ class StoryRunnerTest(unittest.TestCase):
pass pass
class TestTearDownSharedState(TestSharedPageState): class TestTearDownSharedState(TestSharedPageState):
def TearDownState(self, results): def TearDownState(self):
unit_test_events.append('tear-down-state') unit_test_events.append('tear-down-state')
raise DidRunTestError raise DidRunTestError
...@@ -512,7 +512,7 @@ class StoryRunnerTest(unittest.TestCase): ...@@ -512,7 +512,7 @@ class StoryRunnerTest(unittest.TestCase):
def GetTestExpectationAndSkipValue(self, expectations): def GetTestExpectationAndSkipValue(self, expectations):
return 'pass', None return 'pass', None
def TearDownState(self, results): def TearDownState(self):
pass pass
class FailingUserStory(user_story.UserStory): class FailingUserStory(user_story.UserStory):
......
...@@ -267,7 +267,7 @@ class SharedPageState(shared_state.SharedState): ...@@ -267,7 +267,7 @@ class SharedPageState(shared_state.SharedState):
raise page_test.MultiTabTestAppCrashError raise page_test.MultiTabTestAppCrashError
raise raise
def TearDownState(self, results): def TearDownState(self):
self._StopBrowser() self._StopBrowser()
def _StopBrowser(self): def _StopBrowser(self):
......
...@@ -55,7 +55,7 @@ class SharedState(object): ...@@ -55,7 +55,7 @@ class SharedState(object):
""" """
raise NotImplementedError() raise NotImplementedError()
def TearDownState(self, results): def TearDownState(self):
""" Override to do any action after running multiple user stories that """ Override to do any action after running multiple user stories that
share this same state. share this same state.
This method is styled on unittest.TestCase.tearDownClass. This method is styled on unittest.TestCase.tearDownClass.
......
...@@ -68,7 +68,7 @@ class SharedAppState(shared_state.SharedState): ...@@ -68,7 +68,7 @@ class SharedAppState(shared_state.SharedState):
"""This does not apply to android app user stories.""" """This does not apply to android app user stories."""
return 'pass', None return 'pass', None
def TearDownState(self, results): def TearDownState(self):
"""Tear down anything created in the __init__ method that is not needed. """Tear down anything created in the __init__ method that is not needed.
Currently, there is no clean-up needed from SharedAppState.__init__. Currently, there is no clean-up needed from SharedAppState.__init__.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment