Commit 82137afc authored by Charlie Harrison's avatar Charlie Harrison Committed by Commit Bot

PerfBenchmark: Add test for invalid JSON prefs

These prefs are generated at compile-time. Currently, the perf benchmarks
will hard-fail if the JSON is invalid. This CL adds tests for that case.

Bug: 884035
Cq-Include-Trybots: master.tryserver.chromium.perf:obbs_fyi
Change-Id: I58610eb69a4b2610dce72e6de2f8cba2104a29d6
Reviewed-on: https://chromium-review.googlesource.com/1231840Reviewed-by: default avatarNed Nguyen <nednguyen@google.com>
Commit-Queue: Charlie Harrison <csharrison@chromium.org>
Cr-Commit-Position: refs/heads/master@{#592392}
parent c262f5df
...@@ -200,3 +200,20 @@ class PerfBenchmarkTest(unittest.TestCase): ...@@ -200,3 +200,20 @@ class PerfBenchmarkTest(unittest.TestCase):
benchmark.CustomizeBrowserOptions(options.browser_options) benchmark.CustomizeBrowserOptions(options.browser_options)
self._ExpectAdTaggingProfileFiles(options.browser_options, False) self._ExpectAdTaggingProfileFiles(options.browser_options, False)
def testAdTaggingRulesetInvalidJson(self):
self._PopulateGenFiles()
json_path = os.path.join(
self._output_dir, 'gen', 'components', 'subresource_filter', 'tools',
'default_local_state.json')
self.assertTrue(os.path.exists(json_path))
with open(json_path, 'w') as f:
f.write('{some invalid : json, 19')
benchmark = perf_benchmark.PerfBenchmark()
options = options_for_unittests.GetCopy()
options.chromium_output_dir = self._output_dir
# Should fail due to invalid JSON.
with self.assertRaises(ValueError):
benchmark.CustomizeBrowserOptions(options.browser_options)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment