| OLD | NEW |
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 import os | 5 import os |
| 6 import StringIO | 6 import StringIO |
| 7 import sys | 7 import sys |
| 8 import unittest | 8 import unittest |
| 9 | 9 |
| 10 from catapult_base import cloud_storage | 10 from catapult_base import cloud_storage |
| (...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 344 self.RunStoryTest(story_set2, 27) | 344 self.RunStoryTest(story_set2, 27) |
| 345 AssertAndCleanUpFoo() | 345 AssertAndCleanUpFoo() |
| 346 self.assertEquals(0, barz_init_call_counter[0]) | 346 self.assertEquals(0, barz_init_call_counter[0]) |
| 347 self.assertEquals(0, barz_tear_down_call_counter[0]) | 347 self.assertEquals(0, barz_tear_down_call_counter[0]) |
| 348 | 348 |
| 349 def testAppCrashExceptionCausesFailureValue(self): | 349 def testAppCrashExceptionCausesFailureValue(self): |
| 350 self.SuppressExceptionFormatting() | 350 self.SuppressExceptionFormatting() |
| 351 story_set = story_module.StorySet() | 351 story_set = story_module.StorySet() |
| 352 class SharedStoryThatCausesAppCrash(TestSharedPageState): | 352 class SharedStoryThatCausesAppCrash(TestSharedPageState): |
| 353 def WillRunStory(self, story): | 353 def WillRunStory(self, story): |
| 354 raise exceptions.AppCrashException(msg='App Foo crashes') | 354 raise exceptions.AppCrashException('App Foo crashes') |
| 355 | 355 |
| 356 story_set.AddStory(DummyLocalStory( | 356 story_set.AddStory(DummyLocalStory( |
| 357 SharedStoryThatCausesAppCrash)) | 357 SharedStoryThatCausesAppCrash)) |
| 358 story_runner.Run( | 358 story_runner.Run( |
| 359 DummyTest(), story_set, self.options, self.results) | 359 DummyTest(), story_set, self.options, self.results) |
| 360 self.assertEquals(1, len(self.results.failures)) | 360 self.assertEquals(1, len(self.results.failures)) |
| 361 self.assertEquals(0, GetNumberOfSuccessfulPageRuns(self.results)) | 361 self.assertEquals(0, GetNumberOfSuccessfulPageRuns(self.results)) |
| 362 self.assertIn('App Foo crashes', self.fake_stdout.getvalue()) | 362 self.assertIn('App Foo crashes', self.fake_stdout.getvalue()) |
| 363 | 363 |
| 364 def testUnknownExceptionIsFatal(self): | 364 def testUnknownExceptionIsFatal(self): |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 402 | 402 |
| 403 class Test(page_test.PageTest): | 403 class Test(page_test.PageTest): |
| 404 def __init__(self, *args): | 404 def __init__(self, *args): |
| 405 super(Test, self).__init__(*args) | 405 super(Test, self).__init__(*args) |
| 406 self.run_count = 0 | 406 self.run_count = 0 |
| 407 | 407 |
| 408 def RunPage(self, *_): | 408 def RunPage(self, *_): |
| 409 old_run_count = self.run_count | 409 old_run_count = self.run_count |
| 410 self.run_count += 1 | 410 self.run_count += 1 |
| 411 if old_run_count == 0: | 411 if old_run_count == 0: |
| 412 raise exceptions.BrowserGoneException( | 412 raise exceptions.BrowserGoneException('i am a browser instance') |
| 413 None, 'i am a browser crash message') | |
| 414 | 413 |
| 415 def ValidateAndMeasurePage(self, page, tab, results): | 414 def ValidateAndMeasurePage(self, page, tab, results): |
| 416 pass | 415 pass |
| 417 | 416 |
| 418 story_set.AddStory(DummyLocalStory(TestSharedPageState)) | 417 story_set.AddStory(DummyLocalStory(TestSharedPageState)) |
| 419 story_set.AddStory(DummyLocalStory(TestSharedPageState)) | 418 story_set.AddStory(DummyLocalStory(TestSharedPageState)) |
| 420 test = Test() | 419 test = Test() |
| 421 story_runner.Run( | 420 story_runner.Run( |
| 422 test, story_set, self.options, self.results) | 421 test, story_set, self.options, self.results) |
| 423 self.assertEquals(2, test.run_count) | 422 self.assertEquals(2, test.run_count) |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 653 num_failing_stories=5, runner_max_failures=3, | 652 num_failing_stories=5, runner_max_failures=3, |
| 654 options_max_failures=None, expected_num_failures=4) | 653 options_max_failures=None, expected_num_failures=4) |
| 655 | 654 |
| 656 def testMaxFailuresOption(self): | 655 def testMaxFailuresOption(self): |
| 657 # Runs up to max_failures+1 failing tests before stopping, since | 656 # Runs up to max_failures+1 failing tests before stopping, since |
| 658 # every tests after max_failures failures have been encountered | 657 # every tests after max_failures failures have been encountered |
| 659 # may all be passing. | 658 # may all be passing. |
| 660 self._testMaxFailuresOptionIsRespectedAndOverridable( | 659 self._testMaxFailuresOptionIsRespectedAndOverridable( |
| 661 num_failing_stories=5, runner_max_failures=3, | 660 num_failing_stories=5, runner_max_failures=3, |
| 662 options_max_failures=1, expected_num_failures=2) | 661 options_max_failures=1, expected_num_failures=2) |
| OLD | NEW |