Chromium Code Reviews| Index: content/test/gpu/gpu_tests/gpu_integration_test_unittest.py |
| diff --git a/content/test/gpu/gpu_tests/gpu_integration_test_unittest.py b/content/test/gpu/gpu_tests/gpu_integration_test_unittest.py |
| index 90f54f92b10bae0c693a560e56c221a2dd43e202..ed49f36399099399a104cbfa55b5796ef8413966 100644 |
| --- a/content/test/gpu/gpu_tests/gpu_integration_test_unittest.py |
| +++ b/content/test/gpu/gpu_tests/gpu_integration_test_unittest.py |
| @@ -78,12 +78,6 @@ class SimpleIntegrationUnittest(gpu_integration_test.GpuIntegrationTest): |
| def RunActualGpuTest(self, file_path, *args): |
| if file_path == 'failure.html': |
| self.fail('Expected failure') |
| - elif file_path == 'restart.html': |
| - try: |
| - # This will fail because the browser is already started |
| - self.StartBrowser() |
| - finally: |
| - self.StopBrowser() |
| elif file_path == 'flaky.html': |
| if self.__class__._num_flaky_runs_to_fail > 0: |
| self.__class__._num_flaky_runs_to_fail -= 1 |
| @@ -92,22 +86,23 @@ class SimpleIntegrationUnittest(gpu_integration_test.GpuIntegrationTest): |
| raise Exception('Expected exception') |
| -# TODO(eyaich@): add the actual unittest for start-up retrying logic. |
| class BrowserStartFailureIntegrationUnittest( |
| gpu_integration_test.GpuIntegrationTest): |
| - # Must be class-scoped since instances aren't reused across runs. |
| - _num_restart_failures = 0 |
| + |
| + _num_browser_crashes = 0 |
| @classmethod |
| def setUpClass(cls): |
| - finder_options = fakes.CreateBrowserFinderOptions() |
| - finder_options.browser_options.platform = fakes.FakeLinuxPlatform() |
| - finder_options.output_formats = ['none'] |
| - finder_options.suppress_gtest_report = True |
| - finder_options.output_dir = None |
| - finder_options .upload_bucket = 'public' |
| - finder_options .upload_results = False |
| - cls._finder_options = finder_options |
| + cls._fake_browser_options = \ |
| + fakes.CreateBrowserFinderOptions(execute_on_startup=cls.CrashOnStart) |
| + cls._fake_browser_options.browser_options.platform = \ |
| + fakes.FakeLinuxPlatform() |
| + cls._fake_browser_options.output_formats = ['none'] |
| + cls._fake_browser_options.suppress_gtest_report = True |
| + cls._fake_browser_options.output_dir = None |
| + cls._fake_browser_options .upload_bucket = 'public' |
| + cls._fake_browser_options .upload_results = False |
| + cls._finder_options = cls._fake_browser_options |
| cls.platform = None |
| cls.browser = None |
| cls.SetBrowserOptions(cls._finder_options) |
| @@ -122,6 +117,12 @@ class BrowserStartFailureIntegrationUnittest( |
| return expectations |
| @classmethod |
| + def CrashOnStart(cls): |
|
nednguyen
2016/08/08 15:04:30
nit: also probably keep the counter on how many ti
eyaich
2016/08/08 16:01:32
Done.
|
| + if cls._num_browser_crashes < 2: |
| + cls._num_browser_crashes += 1 |
| + raise |
| + |
| + @classmethod |
| def Name(cls): |
| return 'browser_start_failure_integration_unittest' |
| @@ -131,12 +132,10 @@ class BrowserStartFailureIntegrationUnittest( |
| yield ('restart', 'restart.html', ()) |
| def RunActualGpuTest(self, file_path, *args): |
| - if file_path == 'restart.html': |
| - try: |
| - # This will fail because the browser is already started |
| - self.StartBrowser() |
| - finally: |
| - self.StopBrowser() |
| + # The logic of this test is run when the browser starts, it fails twice |
| + # and then succeeds on the third time so we are just testing that this |
| + # is successful based on the parameters. |
| + pass |
| class GpuIntegrationTestUnittest(unittest.TestCase): |
| @@ -156,7 +155,9 @@ class GpuIntegrationTestUnittest(unittest.TestCase): |
| def testIntegrationUnittestWithBrowserFailure( |
| self, mockInitDependencyManager): |
| self._RunIntegrationTest( |
| - 'browser_start_failure_integration_unittest', ['restart'], []) |
| + 'browser_start_failure_integration_unittest', [], ['restart']) |
| + self.assertEquals( \ |
| + BrowserStartFailureIntegrationUnittest._num_browser_crashes, 2) |
| def _RunIntegrationTest(self, test_name, failures, successes): |
| options = browser_test_runner.TestRunOptions() |