OLD | NEW |
1 # Copyright 2017 The Chromium Authors. All rights reserved. | 1 # Copyright 2017 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 unittest | 5 import unittest |
6 | 6 |
7 from tracing.value import histogram | 7 from tracing.value import histogram |
8 from tracing.value import histogram_set | 8 from tracing.value import histogram_set |
9 from tracing.value.diagnostics import diagnostic_ref | 9 from tracing.value.diagnostics import diagnostic_ref |
10 | 10 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 self.assertEqual(len(c2), 1) | 53 self.assertEqual(len(c2), 1) |
54 c2 = c2[0] | 54 c2 = c2[0] |
55 self.assertEqual(c2.guid, c.guid) | 55 self.assertEqual(c2.guid, c.guid) |
56 self.assertIsNot(c2, c) | 56 self.assertIsNot(c2, c) |
57 | 57 |
58 self.assertIs(b2, rhm2.Get('y')) | 58 self.assertIs(b2, rhm2.Get('y')) |
59 self.assertIs(c2, rhm2.Get('z')) | 59 self.assertIs(c2, rhm2.Get('z')) |
60 | 60 |
61 def testGetSharedDiagnosticsOfType(self): | 61 def testGetSharedDiagnosticsOfType(self): |
62 d0 = histogram.GenericSet(['foo']) | 62 d0 = histogram.GenericSet(['foo']) |
63 d1 = histogram.TelemetryInfo() | 63 d1 = histogram.DateRange(0) |
64 hs = histogram_set.HistogramSet() | 64 hs = histogram_set.HistogramSet() |
65 hs.AddSharedDiagnostic('generic', d0) | 65 hs.AddSharedDiagnostic('generic', d0) |
66 hs.AddSharedDiagnostic('generic', d1) | 66 hs.AddSharedDiagnostic('generic', d1) |
67 diagnostics = hs.GetSharedDiagnosticsOfType(histogram.GenericSet) | 67 diagnostics = hs.GetSharedDiagnosticsOfType(histogram.GenericSet) |
68 self.assertEqual(len(diagnostics), 1) | 68 self.assertEqual(len(diagnostics), 1) |
69 self.assertIsInstance(diagnostics[0], histogram.GenericSet) | 69 self.assertIsInstance(diagnostics[0], histogram.GenericSet) |
70 | 70 |
71 def testImportDicts(self): | 71 def testImportDicts(self): |
72 hist = histogram.Histogram('', 'unitless') | 72 hist = histogram.Histogram('', 'unitless') |
73 hists = histogram_set.HistogramSet([hist]) | 73 hists = histogram_set.HistogramSet([hist]) |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 diag0 = histogram.GenericSet(['shared0']) | 140 diag0 = histogram.GenericSet(['shared0']) |
141 diag1 = histogram.GenericSet(['shared1']) | 141 diag1 = histogram.GenericSet(['shared1']) |
142 hists.AddSharedDiagnostic('generic0', diag0) | 142 hists.AddSharedDiagnostic('generic0', diag0) |
143 | 143 |
144 guid0 = diag0.guid | 144 guid0 = diag0.guid |
145 guid1 = diag1.guid | 145 guid1 = diag1.guid |
146 | 146 |
147 hists.ReplaceSharedDiagnostic(guid0, diag1) | 147 hists.ReplaceSharedDiagnostic(guid0, diag1) |
148 | 148 |
149 self.assertIsNotNone(hists.LookupDiagnostic(guid1)) | 149 self.assertIsNotNone(hists.LookupDiagnostic(guid1)) |
OLD | NEW |