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

Unified Diff: tools/telemetry/telemetry/results/gtest_test_results_unittest.py

Issue 338633002: Remove the inheritance from PageTestResults to unittest.TestResult. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address Ken's comment Created 6 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: tools/telemetry/telemetry/results/gtest_test_results_unittest.py
diff --git a/tools/telemetry/telemetry/results/gtest_test_results_unittest.py b/tools/telemetry/telemetry/results/gtest_test_results_unittest.py
index 7175f10aa5de3b1806f736500b22023f7013b198..b7ad5a85ea23cd8f3c6476ef5cb4121d7423e4b8 100644
--- a/tools/telemetry/telemetry/results/gtest_test_results_unittest.py
+++ b/tools/telemetry/telemetry/results/gtest_test_results_unittest.py
@@ -86,6 +86,18 @@ class GTestTestResultsTest(
'1 FAILED TEST\n\n' % exception_trace)
self.assertEquals(expected, ''.join(results.output_data))
+ def testSingleSkippedPage(self):
+ test_page_set = _MakePageSet()
+ results = SummaryGtestTestResults()
+ results.StartTest(test_page_set.pages[0])
+ self._mock_timer.SetTime(0.007)
+ results.AddSkip(test_page_set.pages[0], 'Page skipped for testing reason')
+ results.PrintSummary()
+ expected = ('[ RUN ] http://www.foo.com/\n'
+ '[ OK ] http://www.foo.com/ (7 ms)\n'
+ '[ PASSED ] 0 tests.\n\n')
+ self.assertEquals(expected, ''.join(results.output_data))
+
def testPassAndFailedPages(self):
test_page_set = _MakePageSet()
results = SummaryGtestTestResults()
@@ -126,5 +138,27 @@ class GTestTestResultsTest(
'2 FAILED TESTS\n\n' % (exception_trace, exception_trace))
self.assertEquals(expected, ''.join(results.output_data))
+ def testStreamingResults(self):
+ test_page_set = _MakePageSet()
+ results = SummaryGtestTestResults()
+ exception = self.CreateException()
+
+ results.StartTest(test_page_set.pages[0])
+ self._mock_timer.SetTime(0.007)
+ results.AddSuccess(test_page_set.pages[0])
+ expected = ('[ RUN ] http://www.foo.com/\n'
+ '[ OK ] http://www.foo.com/ (7 ms)\n')
+ self.assertEquals(expected, ''.join(results.output_data))
+
+ results.StartTest(test_page_set.pages[1])
+ self._mock_timer.SetTime(0.009)
+ exception_trace = ''.join(traceback.format_exception(*exception))
+ results.AddError(test_page_set.pages[1], exception)
+ expected = ('[ RUN ] http://www.foo.com/\n'
+ '[ OK ] http://www.foo.com/ (7 ms)\n'
+ '[ RUN ] http://www.bar.com/\n'
+ '%s\n'
+ '[ FAILED ] http://www.bar.com/ (2 ms)\n' % exception_trace)
+
def tearDown(self):
gtest_test_results.time.time = self._real_gtest_time_time
« no previous file with comments | « tools/telemetry/telemetry/results/gtest_test_results.py ('k') | tools/telemetry/telemetry/results/page_test_results.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698