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

Unified Diff: tools/telemetry/telemetry/benchmark_runner_unittest.py

Issue 1647513002: Delete tools/telemetry. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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
« no previous file with comments | « tools/telemetry/telemetry/benchmark_runner.py ('k') | tools/telemetry/telemetry/benchmark_unittest.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/telemetry/telemetry/benchmark_runner_unittest.py
diff --git a/tools/telemetry/telemetry/benchmark_runner_unittest.py b/tools/telemetry/telemetry/benchmark_runner_unittest.py
deleted file mode 100644
index 266f87aa17acefab2e02a6f68eeb5fd107390785..0000000000000000000000000000000000000000
--- a/tools/telemetry/telemetry/benchmark_runner_unittest.py
+++ /dev/null
@@ -1,115 +0,0 @@
-# Copyright 2015 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-import unittest
-
-from telemetry import benchmark
-from telemetry import benchmark_runner
-from telemetry.testing import stream
-import mock
-
-
-class BenchmarkFoo(benchmark.Benchmark):
- """ Benchmark Foo for testing."""
-
- @classmethod
- def Name(cls):
- return 'FooBenchmark'
-
-
-class BenchmarkBar(benchmark.Benchmark):
- """ Benchmark Bar for testing long description line."""
-
- @classmethod
- def Name(cls):
- return 'BarBenchmarkkkkk'
-
-class UnusualBenchmark(benchmark.Benchmark):
- @classmethod
- def Name(cls):
- return 'I have a very unusual name'
-
-
-class BenchmarkRunnerUnittest(unittest.TestCase):
- def setUp(self):
- self._stream = stream.TestOutputStream()
- self._mock_possible_browser = mock.MagicMock()
- self._mock_possible_browser.browser_type = 'TestBrowser'
-
- def testPrintBenchmarkListWithNoDisabledBenchmark(self):
- expected_printed_stream = (
- 'Available benchmarks for TestBrowser are:\n'
- ' BarBenchmarkkkkk Benchmark Bar for testing long description line.\n'
- ' FooBenchmark Benchmark Foo for testing.\n'
- 'Pass --browser to list benchmarks for another browser.\n\n')
- with mock.patch('telemetry.benchmark_runner.decorators') as mock_module:
- mock_module.IsEnabled.return_value = (True, None)
- benchmark_runner.PrintBenchmarkList(
- [BenchmarkFoo, BenchmarkBar], self._mock_possible_browser, self._stream)
- self.assertEquals(expected_printed_stream, self._stream.output_data)
-
- def testPrintBenchmarkListWithOneDisabledBenchmark(self):
- expected_printed_stream = (
- 'Available benchmarks for TestBrowser are:\n'
- ' FooBenchmark Benchmark Foo for testing.\n'
- '\n'
- 'Disabled benchmarks for TestBrowser are (force run with -d):\n'
- ' BarBenchmarkkkkk Benchmark Bar for testing long description line.\n'
- 'Pass --browser to list benchmarks for another browser.\n\n')
- with mock.patch('telemetry.benchmark_runner.decorators') as mock_module:
- def FakeIsEnabled(benchmark_class, _):
- if benchmark_class is BenchmarkFoo:
- return True, None
- else:
- return False, 'Only supported BenchmarkFoo'
- mock_module.IsEnabled = FakeIsEnabled
- benchmark_runner.PrintBenchmarkList(
- [BenchmarkFoo, BenchmarkBar], self._mock_possible_browser, self._stream)
- self.assertEquals(expected_printed_stream, self._stream.output_data)
-
- def testShouldDisable(self):
- """Ensure that overridden ShouldDisable class methods are respected."""
- expected_printed_stream = (
- 'Available benchmarks for TestBrowser are:\n'
- ' BarBenchmarkkkkk Benchmark Bar for testing long description line.\n'
- '\n'
- 'Disabled benchmarks for TestBrowser are (force run with -d):\n'
- ' FooBenchmark Benchmark Foo for testing.\n'
- 'Pass --browser to list benchmarks for another browser.\n\n')
- @classmethod
- def FakeShouldDisable(cls, possible_browser):
- del possible_browser # unused
- return cls is BenchmarkFoo
- BenchmarkFoo.ShouldDisable = FakeShouldDisable
- BenchmarkBar.ShouldDisable = FakeShouldDisable
- benchmark_runner.PrintBenchmarkList(
- [BenchmarkFoo, BenchmarkBar], self._mock_possible_browser, self._stream)
- self.assertEquals(expected_printed_stream, self._stream.output_data)
-
- def testShouldDisableComplex(self):
- """Ensure that browser-dependent ShouldDisable overrides are respected."""
- expected_printed_stream = (
- # Expected output for 'TestBrowser':
- 'Available benchmarks for TestBrowser are:\n'
- ' FooBenchmark Benchmark Foo for testing.\n'
- '\n'
- 'Disabled benchmarks for TestBrowser are (force run with -d):\n'
- ' BarBenchmarkkkkk Benchmark Bar for testing long description line.\n'
- 'Pass --browser to list benchmarks for another browser.\n\n'
- # Expected output for 'MockBrowser':
- 'Available benchmarks for MockBrowser are:\n'
- ' BarBenchmarkkkkk Benchmark Bar for testing long description line.\n'
- ' FooBenchmark Benchmark Foo for testing.\n'
- 'Pass --browser to list benchmarks for another browser.\n\n')
- @classmethod
- def FakeShouldDisable(cls, possible_browser):
- return cls is BenchmarkBar and not 'Mock' in possible_browser.browser_type
- BenchmarkFoo.ShouldDisable = FakeShouldDisable
- BenchmarkBar.ShouldDisable = FakeShouldDisable
- benchmark_runner.PrintBenchmarkList(
- [BenchmarkFoo, BenchmarkBar], self._mock_possible_browser, self._stream)
- self._mock_possible_browser.browser_type = 'MockBrowser'
- benchmark_runner.PrintBenchmarkList(
- [BenchmarkFoo, BenchmarkBar], self._mock_possible_browser, self._stream)
- self.assertEquals(expected_printed_stream, self._stream.output_data)
« no previous file with comments | « tools/telemetry/telemetry/benchmark_runner.py ('k') | tools/telemetry/telemetry/benchmark_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698