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

Unified Diff: third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline_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
« no previous file with comments | « third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline_unittest.py
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline_unittest.py b/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline_unittest.py
index aa3a1dad85b18877ca2aa9b047ec3501c40f99cd..f1a2cb3d3c3cdaba1706b96f7ff413ca1e15ffb7 100644
--- a/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline_unittest.py
+++ b/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline_unittest.py
@@ -1,33 +1,8 @@
-# Copyright (C) 2010 Google Inc. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met:
-#
-# * Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# * Redistributions in binary form must reproduce the above
-# copyright notice, this list of conditions and the following disclaimer
-# in the documentation and/or other materials provided with the
-# distribution.
-# * Neither the name of Google Inc. nor the names of its
-# contributors may be used to endorse or promote products derived from
-# this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+# 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.
import unittest
-import webkitpy.tool.commands.rebaseline
from webkitpy.common.checkout.baselineoptimizer import BaselineOptimizer
from webkitpy.common.checkout.scm.scm_mock import MockSCM
@@ -42,7 +17,7 @@ from webkitpy.tool.commands.rebaseline import *
from webkitpy.tool.mocktool import MockTool, MockOptions
-class _BaseTestCase(unittest.TestCase):
+class BaseTestCase(unittest.TestCase):
MOCK_WEB_RESULT = 'MOCK Web result, convert 404 to None=True'
WEB_PREFIX = 'http://example.com/f/builders/WebKit Mac10.11/results/layout-test-results'
@@ -100,7 +75,7 @@ class _BaseTestCase(unittest.TestCase):
self.command._builder_data[builder] = data
-class TestCopyExistingBaselinesInternal(_BaseTestCase):
+class TestCopyExistingBaselinesInternal(BaseTestCase):
command_constructor = CopyExistingBaselinesInternal
def setUp(self):
@@ -234,7 +209,7 @@ class TestCopyExistingBaselinesInternal(_BaseTestCase):
'original win7 result')
-class TestRebaselineTest(_BaseTestCase):
+class TestRebaselineTest(BaseTestCase):
command_constructor = RebaselineTest # AKA webkit-patch rebaseline-test-internal
def setUp(self):
@@ -335,7 +310,7 @@ Bug(A) [ Debug ] : fast/css/large-list-of-rules-crash.html [ Failure ]
out, '{"add": [], "remove-lines": [{"test": "failures/expected/image.html", "builder": "MOCK Win10"}], "delete": []}\n')
-class TestAbstractParallelRebaselineCommand(_BaseTestCase):
+class TestAbstractParallelRebaselineCommand(BaseTestCase):
command_constructor = AbstractParallelRebaselineCommand
def test_builders_to_fetch_from(self):
@@ -351,7 +326,7 @@ class TestAbstractParallelRebaselineCommand(_BaseTestCase):
self.assertEqual(builders_to_fetch, ["MOCK Win7", "MOCK Win10"])
-class TestRebaselineJson(_BaseTestCase):
+class TestRebaselineJson(BaseTestCase):
command_constructor = RebaselineJson
def setUp(self):
@@ -445,7 +420,7 @@ class TestRebaselineJson(_BaseTestCase):
[['python', 'echo', 'rebaseline-test-internal', '--suffixes', 'txt,png', '--builder', 'MOCK builder', '--test', 'userscripts/first-test.html', '--results-directory', '/tmp', '--verbose']]])
-class TestRebaselineJsonUpdatesExpectationsFiles(_BaseTestCase):
+class TestRebaselineJsonUpdatesExpectationsFiles(BaseTestCase):
command_constructor = RebaselineJson
def setUp(self):
@@ -548,7 +523,7 @@ class TestRebaselineJsonUpdatesExpectationsFiles(_BaseTestCase):
new_expectations, "Bug(x) [ Linux Mac10.10 Mac10.9 Retina Win ] userscripts/first-test.html [ Failure ]\n")
-class TestRebaseline(_BaseTestCase):
+class TestRebaseline(BaseTestCase):
# This command shares most of its logic with RebaselineJson, so these tests just test what is different.
command_constructor = Rebaseline # AKA webkit-patch rebaseline
@@ -613,7 +588,7 @@ class MockLineRemovingExecutive(MockExecutive):
return command_outputs
-class TestRebaselineExpectations(_BaseTestCase):
+class TestRebaselineExpectations(BaseTestCase):
command_constructor = RebaselineExpectations
def setUp(self):
@@ -841,15 +816,7 @@ Bug(foo) [ Linux Win ] fast/dom/prototype-taco.html [ Rebaseline ]
""")
-class _FakeOptimizer(BaselineOptimizer):
-
- def read_results_by_directory(self, baseline_name):
- if baseline_name.endswith('txt'):
- return {'LayoutTests/passes/text.html': '123456'}
- return {}
-
-
-class TestOptimizeBaselines(_BaseTestCase):
+class TestOptimizeBaselines(BaseTestCase):
command_constructor = OptimizeBaselines
def _write_test_file(self, port, path, contents):
@@ -935,33 +902,7 @@ class TestOptimizeBaselines(_BaseTestCase):
test_port.layout_tests_dir(), 'another/test-expected.png')))
-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
- # pylint bug warning about unnecessary lambda? pylint: disable=W0108
- 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'])
-
-
-class TestAutoRebaseline(_BaseTestCase):
+class TestAutoRebaseline(BaseTestCase):
command_constructor = AutoRebaseline
def _write_test_file(self, port, path, contents):
« no previous file with comments | « third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698