diff options
author | chrishenry <chrishenry@google.com> | 2014-12-06 18:58:44 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-12-07 02:59:14 +0000 |
commit | 624aa61a2ca75a04bd2bccba89140fbe8ec33185 (patch) | |
tree | 70f9b9ba5d5b0924ada223f2d77db8fe1857127c | |
parent | c5719b39f12e8ee381dad410f879cdb64c7ed430 (diff) | |
download | chromium_src-624aa61a2ca75a04bd2bccba89140fbe8ec33185.zip chromium_src-624aa61a2ca75a04bd2bccba89140fbe8ec33185.tar.gz chromium_src-624aa61a2ca75a04bd2bccba89140fbe8ec33185.tar.bz2 |
Delete deprecated and unused ValidatePage/MeasurePage in PageTest.
(Cleanup while reading code.)
BUG=439544
Review URL: https://codereview.chromium.org/786563002
Cr-Commit-Position: refs/heads/master@{#307186}
5 files changed, 38 insertions, 24 deletions
diff --git a/tools/telemetry/telemetry/page/page_run_end_to_end_tests.py b/tools/telemetry/telemetry/page/page_run_end_to_end_tests.py index eb61982..0aad2c4 100644 --- a/tools/telemetry/telemetry/page/page_run_end_to_end_tests.py +++ b/tools/telemetry/telemetry/page/page_run_end_to_end_tests.py @@ -39,7 +39,7 @@ SIMPLE_CREDENTIALS_STRING = """ } """ class DummyTest(page_test.PageTest): - def ValidatePage(self, *_): + def ValidateAndMeasurePage(self, *_): pass @@ -118,6 +118,7 @@ class PageRunEndToEndTests(unittest.TestCase): def __init__(self, *args): super(Test, self).__init__(*args) self.run_count = 0 + def RestartBrowserBeforeEachPage(self): old_run_count = self.run_count self.run_count += 1 @@ -125,6 +126,9 @@ class PageRunEndToEndTests(unittest.TestCase): raise exceptions.BrowserGoneException(None) return self._needs_browser_restart_after_each_page + def ValidateAndMeasurePage(self, page, tab, results): + pass + options = options_for_unittests.GetCopy() options.output_formats = ['none'] options.suppress_gtest_report = True @@ -191,7 +195,7 @@ class PageRunEndToEndTests(unittest.TestCase): def DidStartBrowser(self, browser): browser.credentials.AddBackend(self._credentials_backend) - def ValidatePage(self, *_): + def ValidateAndMeasurePage(self, *_): did_run[0] = True test = TestThatInstallsCredentialsBackend(credentials_backend) @@ -215,7 +219,7 @@ class PageRunEndToEndTests(unittest.TestCase): ps.user_agent_type = 'tablet' class TestUserAgent(page_test.PageTest): - def ValidatePage(self, _1, tab, _2): + def ValidateAndMeasurePage(self, _1, tab, _2): actual_user_agent = tab.EvaluateJavaScript('window.navigator.userAgent') expected_user_agent = user_agent.UA_TYPE_MAPPING['tablet'] assert actual_user_agent.strip() == expected_user_agent @@ -253,7 +257,7 @@ class PageRunEndToEndTests(unittest.TestCase): self._browser = browser self._browser.tabs.New() - def ValidatePage(self, *_): + def ValidateAndMeasurePage(self, *_): assert len(self._browser.tabs) == 1 test = TestOneTab() @@ -287,7 +291,7 @@ class PageRunEndToEndTests(unittest.TestCase): assert self._did_call_will_start self._did_call_did_start = True - def ValidatePage(self, *_): + def ValidateAndMeasurePage(self, *_): assert self._did_call_did_start test = TestBeforeLaunch() @@ -345,7 +349,7 @@ class PageRunEndToEndTests(unittest.TestCase): super(Test, self).__init__() self.did_call_clean_up = False - def ValidatePage(self, *_): + def ValidateAndMeasurePage(self, *_): raise exceptions.IntentionalException def CleanUpAfterPage(self, page, tab): @@ -376,7 +380,7 @@ class PageRunEndToEndTests(unittest.TestCase): def CanRunOnBrowser(self, _): return False - def ValidatePage(self, _): + def ValidateAndMeasurePage(self, _): pass class Test(page_test.PageTest): @@ -384,7 +388,7 @@ class PageRunEndToEndTests(unittest.TestCase): super(Test, self).__init__(*args, **kwargs) self.will_navigate_to_page_called = False - def ValidatePage(self, *args): + def ValidateAndMeasurePage(self, *args): pass def WillNavigateToPage(self, _1, _2): @@ -413,7 +417,7 @@ class PageRunEndToEndTests(unittest.TestCase): raise Exception('Test exception') class Test(page_test.PageTest): - def ValidatePage(self, *args): + def ValidateAndMeasurePage(self, *args): pass ps = page_set.PageSet() @@ -457,7 +461,8 @@ class PageRunEndToEndTests(unittest.TestCase): 'file://blank.html', ps, base_dir=util.GetUnittestDataDir())) class Measurement(page_test.PageTest): - pass + def ValidateAndMeasurePage(self, page, tab, results): + pass options = options_for_unittests.GetCopy() options.output_formats = ['none'] diff --git a/tools/telemetry/telemetry/page/page_test.py b/tools/telemetry/telemetry/page/page_test.py index 081ea98..b4e6c3c 100644 --- a/tools/telemetry/telemetry/page/page_test.py +++ b/tools/telemetry/telemetry/page/page_test.py @@ -233,16 +233,7 @@ class PageTest(object): tab: A telemetry.core.Tab instance. results: A telemetry.results.PageTestResults instance. """ - # TODO(chrishenry): Switch to raise NotImplementedError() when - # subclasses no longer override ValidatePage/MeasurePage. - self.ValidatePage(page, tab, results) - - def ValidatePage(self, page, tab, results): - """DEPRECATED: Use ValidateAndMeasurePage instead.""" - self.MeasurePage(page, tab, results) - - def MeasurePage(self, page, tab, results): - """DEPRECATED: Use ValidateAndMeasurePage instead.""" + raise NotImplementedError def RunPage(self, page, tab, results): # Run actions. diff --git a/tools/telemetry/telemetry/page/record_wpr_unittest.py b/tools/telemetry/telemetry/page/record_wpr_unittest.py index ba9cdce..bf4ead6 100644 --- a/tools/telemetry/telemetry/page/record_wpr_unittest.py +++ b/tools/telemetry/telemetry/page/record_wpr_unittest.py @@ -57,8 +57,8 @@ class MockPageTest(page_test.PageTest): def DidRunActions(self, page, tab): self.func_calls.append('DidRunActions') - def ValidatePage(self, page, tab, results): - self.func_calls.append('ValidatePage') + def ValidateAndMeasurePage(self, page, tab, results): + self.func_calls.append('ValidateAndMeasurePage') def WillStartBrowser(self, platform): self.func_calls.append('WillStartBrowser') @@ -120,7 +120,8 @@ class RecordWprUnitTests(tab_test_case.TabTestCase): self.assertEqual(3, len(record_page_test.page_test.func_calls)) self.assertEqual('WillRunActions', record_page_test.page_test.func_calls[0]) self.assertEqual('DidRunActions', record_page_test.page_test.func_calls[1]) - self.assertEqual('ValidatePage', record_page_test.page_test.func_calls[2]) + self.assertEqual('ValidateAndMeasurePage', + record_page_test.page_test.func_calls[2]) @decorators.Disabled('chromeos') # crbug.com/404868. def testWprRecorderWithPageSet(self): diff --git a/tools/telemetry/telemetry/page/shared_page_state_unittest.py b/tools/telemetry/telemetry/page/shared_page_state_unittest.py index 7474ec9..b0d6679 100644 --- a/tools/telemetry/telemetry/page/shared_page_state_unittest.py +++ b/tools/telemetry/telemetry/page/shared_page_state_unittest.py @@ -21,7 +21,7 @@ def SetUpPageRunnerArguments(options): class DummyTest(page_test.PageTest): - def ValidatePage(self, *_): + def ValidateAndMeasurePage(self, *_): pass diff --git a/tools/telemetry/telemetry/user_story/user_story_runner_unittest.py b/tools/telemetry/telemetry/user_story/user_story_runner_unittest.py index e4049a7..a99a4b9 100644 --- a/tools/telemetry/telemetry/user_story/user_story_runner_unittest.py +++ b/tools/telemetry/telemetry/user_story/user_story_runner_unittest.py @@ -79,6 +79,9 @@ class DummyTest(page_test.PageTest): def RunPage(self, *_): pass + def ValidateAndMeasurePage(self, page, tab, results): + pass + class EmptyMetadataForTest(benchmark.BenchmarkMetadata): def __init__(self): @@ -218,12 +221,16 @@ class UserStoryRunnerTest(unittest.TestCase): def __init__(self, *args): super(Test, self).__init__(*args) self.run_count = 0 + def RunPage(self, *_): old_run_count = self.run_count self.run_count += 1 if old_run_count == 0: raise ExpectedException() + def ValidateAndMeasurePage(self, page, tab, results): + pass + us.AddUserStory(user_story.UserStory(TestSharedUserStoryState)) us.AddUserStory(user_story.UserStory(TestSharedUserStoryState)) test = Test() @@ -241,12 +248,16 @@ class UserStoryRunnerTest(unittest.TestCase): def __init__(self, *args): super(Test, self).__init__(*args) self.run_count = 0 + def RunPage(self, *_): old_run_count = self.run_count self.run_count += 1 if old_run_count == 0: raise exceptions.BrowserGoneException() + def ValidateAndMeasurePage(self, page, tab, results): + pass + us.AddUserStory(user_story.UserStory(TestSharedUserStoryState)) us.AddUserStory(user_story.UserStory(TestSharedUserStoryState)) test = Test() @@ -268,6 +279,9 @@ class UserStoryRunnerTest(unittest.TestCase): def RunPage(self, page, _, results): results.AddValue(string.StringValue(page, 'test', 't', page.name)) + def ValidateAndMeasurePage(self, page, tab, results): + pass + results = results_options.CreateResults( EmptyMetadataForTest(), self.options) user_story_runner.Run( @@ -322,6 +336,9 @@ class UserStoryRunnerTest(unittest.TestCase): results.AddValue(scalar.ScalarValue( page, 'metric', 'unit', self.i)) + def ValidateAndMeasurePage(self, page, tab, results): + pass + self.options.page_repeat = 1 self.options.pageset_repeat = 2 self.options.output_formats = ['buildbot'] |