Chromium Code Reviews| Index: telemetry/telemetry/benchmark_unittest.py |
| diff --git a/telemetry/telemetry/benchmark_unittest.py b/telemetry/telemetry/benchmark_unittest.py |
| index cc04729f7c5f2a9fd1ebc7d6f760a96c95db7994..5fd3dac4472d6a2ba8c1bb97ced752f271007bdb 100644 |
| --- a/telemetry/telemetry/benchmark_unittest.py |
| +++ b/telemetry/telemetry/benchmark_unittest.py |
| @@ -142,7 +142,41 @@ class BenchmarkTest(unittest.TestCase): |
| self.assertIsInstance( |
| b.GetExpectations(), story_module.expectations.StoryExpectations) |
| - def testBenchmarkOwnership(self): |
| + def testGetOwners(self): |
| + @benchmark.Owner(emails=['alice@chromium.org']) |
| + class FooBenchmark(benchmark.Benchmark): |
| + @classmethod |
| + def Name(cls): |
| + return "foo" |
| + |
| + @benchmark.Owner(emails=['bob@chromium.org', 'ben@chromium.org'], |
| + component='xyzzyx') |
| + class BarBenchmark(benchmark.Benchmark): |
| + @classmethod |
| + def Name(cls): |
| + return "bar" |
| + |
| + @benchmark.Owner(component='xyzzyx') |
| + class BazBenchmark(benchmark.Benchmark): |
| + @classmethod |
| + def Name(cls): |
| + return "baz" |
| + |
| + fooOwnersDiagnostic = FooBenchmark(None).GetOwners() |
| + barOwnersDiagnostic = BarBenchmark(None).GetOwners() |
| + bazOwnersDiagnostic = BazBenchmark(None).GetOwners() |
| + |
| + self.assertIsInstance(fooOwnersDiagnostic, histogram.GenericSet) |
| + self.assertIsInstance(barOwnersDiagnostic, histogram.GenericSet) |
| + self.assertIsInstance(bazOwnersDiagnostic, histogram.GenericSet) |
| + |
| + self.assertEqual(fooOwnersDiagnostic.AsDict()['values'], |
| + ['alice@chromium.org']) |
| + self.assertEqual(barOwnersDiagnostic.AsDict()['values'], |
| + ['bob@chromium.org', 'ben@chromium.org']) |
| + self.assertEqual(bazOwnersDiagnostic.AsDict()['values'], []) |
| + |
| + def testGetComponent(self): |
| @benchmark.Owner(emails=['alice@chromium.org']) |
| class FooBenchmark(benchmark.Benchmark): |
| @classmethod |
| @@ -155,16 +189,14 @@ class BenchmarkTest(unittest.TestCase): |
| def Name(cls): |
| return "bar" |
| - fooOwnerDiangostic = FooBenchmark(None).GetOwnership() |
| - barOwnerDiangostic = BarBenchmark(None).GetOwnership() |
| + fooComponentDiagnostic = FooBenchmark(None).GetComponent() |
| + barComponentDiagnostic = BarBenchmark(None).GetComponent() |
| - self.assertIsInstance(fooOwnerDiangostic, histogram.Ownership) |
| - self.assertItemsEqual(fooOwnerDiangostic.emails, ['alice@chromium.org']) |
| - self.assertIsNone(fooOwnerDiangostic.component) |
| + self.assertIsInstance(fooComponentDiagnostic, histogram.GenericSet) |
| + self.assertIsInstance(barComponentDiagnostic, histogram.GenericSet) |
| - self.assertIsInstance(barOwnerDiangostic, histogram.Ownership) |
| - self.assertItemsEqual(barOwnerDiangostic.emails, ['bob@chromium.org']) |
| - self.assertEqual(barOwnerDiangostic.component, 'xyzzyx') |
| + self.assertEqual(fooComponentDiagnostic.AsDict()['values'], []) |
|
benjhayden
2017/07/17 22:08:06
You can get at the values more directly by casting
|
| + self.assertEqual(barComponentDiagnostic.AsDict()['values'], ['xyzzyx']) |
| def testGetTBMOptionsSupportsLegacyName(self): |
| class TbmBenchmark(benchmark.Benchmark): |
| @@ -257,4 +289,3 @@ class BenchmarkTest(unittest.TestCase): |
| self.assertEqual( |
| ['string', 'foo', 'stuff', 'bar'], |
| tbm._tbm_options.config.atrace_config.categories) |
| - |