Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(66)

Side by Side Diff: tools/telemetry/telemetry/internal/story_runner_unittest.py

Issue 1328093006: [Android][telemetry] Break logging deadlock when attempting to log an AppCrashException. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix StoryRunnerTests Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tools/telemetry/telemetry/core/exceptions.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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('App Foo crashes') 354 raise exceptions.AppCrashException(msg='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
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('i am a browser instance') 412 raise exceptions.BrowserGoneException(
413 None, 'i am a browser crash message')
413 414
414 def ValidateAndMeasurePage(self, page, tab, results): 415 def ValidateAndMeasurePage(self, page, tab, results):
415 pass 416 pass
416 417
417 story_set.AddStory(DummyLocalStory(TestSharedPageState)) 418 story_set.AddStory(DummyLocalStory(TestSharedPageState))
418 story_set.AddStory(DummyLocalStory(TestSharedPageState)) 419 story_set.AddStory(DummyLocalStory(TestSharedPageState))
419 test = Test() 420 test = Test()
420 story_runner.Run( 421 story_runner.Run(
421 test, story_set, self.options, self.results) 422 test, story_set, self.options, self.results)
422 self.assertEquals(2, test.run_count) 423 self.assertEquals(2, test.run_count)
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
652 num_failing_stories=5, runner_max_failures=3, 653 num_failing_stories=5, runner_max_failures=3,
653 options_max_failures=None, expected_num_failures=4) 654 options_max_failures=None, expected_num_failures=4)
654 655
655 def testMaxFailuresOption(self): 656 def testMaxFailuresOption(self):
656 # Runs up to max_failures+1 failing tests before stopping, since 657 # Runs up to max_failures+1 failing tests before stopping, since
657 # every tests after max_failures failures have been encountered 658 # every tests after max_failures failures have been encountered
658 # may all be passing. 659 # may all be passing.
659 self._testMaxFailuresOptionIsRespectedAndOverridable( 660 self._testMaxFailuresOptionIsRespectedAndOverridable(
660 num_failing_stories=5, runner_max_failures=3, 661 num_failing_stories=5, runner_max_failures=3,
661 options_max_failures=1, expected_num_failures=2) 662 options_max_failures=1, expected_num_failures=2)
OLDNEW
« no previous file with comments | « tools/telemetry/telemetry/core/exceptions.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698