Chromium Code Reviews| Index: tools/metrics/ukm/pretty_print_test.py |
| diff --git a/tools/metrics/ukm/pretty_print_test.py b/tools/metrics/ukm/pretty_print_test.py |
| new file mode 100755 |
| index 0000000000000000000000000000000000000000..66d2b251215e34ddde853a7f9176f3fbc47e879a |
| --- /dev/null |
| +++ b/tools/metrics/ukm/pretty_print_test.py |
| @@ -0,0 +1,59 @@ |
| +#!/usr/bin/env python |
| +# Copyright 2017 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. |
| + |
|
rkaplow
2017/03/30 01:26:20
update this file since it's not really testing any
Steven Holte
2017/03/30 22:42:23
Done.
|
| +import unittest |
| + |
| +import pretty_print |
| + |
| + |
| +PRETTY_XML = """ |
| +<!-- Comment1 --> |
| + |
| +<ukm-configuration> |
| + |
| +</ukm-configuration> |
| +""".strip() |
| + |
| +BASIC_METRIC = { |
| + 'comments': [], |
| + 'name': 'Test.Rappor.Metric', |
| + 'type': 'TEST_RAPPOR_TYPE', |
| + 'owners': ['user1@chromium.org', 'user2@chromium.org'], |
| + 'summary': 'A fake metric summary.', |
| + 'flags': [], |
| + 'strings': [], |
| +} |
| + |
| +MULTI_FIELD_METRIC = { |
| + 'comments': [], |
| + 'name': 'Test.Rappor.Metric2', |
| + 'type': 'TEST_RAPPOR_TYPE', |
| + 'owners': ['user1@chromium.org', 'user2@chromium.org'], |
| + 'summary': 'A fake metric summary.', |
| + 'strings': [{ |
| + 'comments': [], |
| + 'name': 'Url', |
| + 'summary': 'The url of the event.', |
| + }], |
| + 'flags': [{ |
| + 'comments': [], |
| + 'name': 'Flags', |
| + 'flags': [ |
| + 'Flag bit #1', |
| + 'Flag bit #2', |
| + ] |
| + }] |
| +} |
| + |
| + |
| +class UkmXmlTest(unittest.TestCase): |
| + |
| + def testIsPretty(self): |
| + result = pretty_print.UpdateXML(PRETTY_XML) |
| + self.assertMultiLineEqual(PRETTY_XML, result.strip()) |
| + |
| + |
| +if __name__ == '__main__': |
| + unittest.main() |