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

Unified Diff: third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/analyze_baselines_unittest.py

Issue 2019243002: Extract analyze-baselines command out of rebaseline.py. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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
Index: third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/analyze_baselines_unittest.py
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/analyze_baselines_unittest.py b/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/analyze_baselines_unittest.py
new file mode 100644
index 0000000000000000000000000000000000000000..addae51211497c7a0e09f5ceea9c01ff5189b859
--- /dev/null
+++ b/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/analyze_baselines_unittest.py
@@ -0,0 +1,42 @@
+# Copyright 2016 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.
+
+from webkitpy.common.checkout.baselineoptimizer import BaselineOptimizer
+from webkitpy.layout_tests.controllers.test_result_writer import TestResultWriter
+from webkitpy.tool.commands.analyze_baselines import AnalyzeBaselines
+from webkitpy.tool.commands.rebaseline_unittest import BaseTestCase
+from webkitpy.tool.mocktool import MockOptions
+
+
+class _FakeOptimizer(BaselineOptimizer):
+
+ def read_results_by_directory(self, baseline_name):
+ if baseline_name.endswith('txt'):
+ return {'LayoutTests/passes/text.html': '123456'}
+ return {}
+
+
+class TestAnalyzeBaselines(BaseTestCase):
+ command_constructor = AnalyzeBaselines
+
+ def setUp(self):
+ super(TestAnalyzeBaselines, self).setUp()
+ self.port = self.tool.port_factory.get('test')
+ self.tool.port_factory.get = (lambda port_name=None, options=None: self.port)
+ self.lines = []
+ self.command._optimizer_class = _FakeOptimizer
+ self.command._write = (lambda msg: self.lines.append(msg))
+
+ def test_default(self):
+ self.command.execute(MockOptions(suffixes='txt', missing=False, platform=None), ['passes/text.html'], self.tool)
+ self.assertEqual(self.lines,
+ ['passes/text-expected.txt:',
+ ' (generic): 123456'])
+
+ def test_missing_baselines(self):
+ self.command.execute(MockOptions(suffixes='png,txt', missing=True, platform=None), ['passes/text.html'], self.tool)
+ self.assertEqual(self.lines,
+ ['passes/text-expected.png: (no baselines found)',
+ 'passes/text-expected.txt:',
+ ' (generic): 123456'])

Powered by Google App Engine
This is Rietveld 408576698