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

Unified Diff: third_party/WebKit/Tools/Scripts/webkitpy/common/checkout/baselineoptimizer_unittest.py

Issue 2329263002: Run format-webkitpy and fix long lines. (Closed)
Patch Set: Created 4 years, 3 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/common/checkout/baselineoptimizer_unittest.py
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/common/checkout/baselineoptimizer_unittest.py b/third_party/WebKit/Tools/Scripts/webkitpy/common/checkout/baselineoptimizer_unittest.py
index 33e33128763249be34ddb90a43a671835981da0a..fae2c451d7a88d99ad62878307928154cb50455d 100644
--- a/third_party/WebKit/Tools/Scripts/webkitpy/common/checkout/baselineoptimizer_unittest.py
+++ b/third_party/WebKit/Tools/Scripts/webkitpy/common/checkout/baselineoptimizer_unittest.py
@@ -62,6 +62,7 @@ class ExcludingMockSCM(MockSCM):
class BaselineOptimizerTest(unittest.TestCase):
+ # Protected method _move_baselines is tested below - pylint: disable=protected-access
def test_move_baselines(self):
host = MockHost(scm=ExcludingMockSCM(
['/mock-checkout/third_party/WebKit/LayoutTests/platform/mac/another/test-expected.txt']))
@@ -71,15 +72,18 @@ class BaselineOptimizerTest(unittest.TestCase):
host.filesystem.write_binary_file(
'/mock-checkout/third_party/WebKit/LayoutTests/platform/mac/another/test-expected.txt', 'result A')
host.filesystem.write_binary_file('/mock-checkout/third_party/WebKit/LayoutTests/another/test-expected.txt', 'result B')
- baseline_optimizer = BaselineOptimizer(host, host.port_factory.get(
- ), host.port_factory.all_port_names(), skip_scm_commands=False)
- baseline_optimizer._move_baselines('another/test-expected.txt', {
- '/mock-checkout/third_party/WebKit/LayoutTests/platform/win': 'aaa',
- '/mock-checkout/third_party/WebKit/LayoutTests/platform/mac': 'aaa',
- '/mock-checkout/third_party/WebKit/LayoutTests': 'bbb',
- }, {
- '/mock-checkout/third_party/WebKit/LayoutTests': 'aaa',
- })
+ baseline_optimizer = BaselineOptimizer(
+ host, host.port_factory.get(), host.port_factory.all_port_names(), skip_scm_commands=False)
+ baseline_optimizer._move_baselines(
+ 'another/test-expected.txt',
+ {
+ '/mock-checkout/third_party/WebKit/LayoutTests/platform/win': 'aaa',
+ '/mock-checkout/third_party/WebKit/LayoutTests/platform/mac': 'aaa',
+ '/mock-checkout/third_party/WebKit/LayoutTests': 'bbb',
+ },
+ {
+ '/mock-checkout/third_party/WebKit/LayoutTests': 'aaa',
+ })
self.assertEqual(host.filesystem.read_binary_file(
'/mock-checkout/third_party/WebKit/LayoutTests/another/test-expected.txt'), 'result A')
@@ -94,25 +98,34 @@ class BaselineOptimizerTest(unittest.TestCase):
host.filesystem.write_binary_file('/mock-checkout/third_party/WebKit/LayoutTests/another/test-expected.txt', 'result B')
baseline_optimizer = BaselineOptimizer(host, host.port_factory.get(
), host.port_factory.all_port_names(), skip_scm_commands=True)
- baseline_optimizer._move_baselines('another/test-expected.txt', {
- '/mock-checkout/third_party/WebKit/LayoutTests/platform/win': 'aaa',
- '/mock-checkout/third_party/WebKit/LayoutTests/platform/mac': 'aaa',
- '/mock-checkout/third_party/WebKit/LayoutTests': 'bbb',
- }, {
- '/mock-checkout/third_party/WebKit/LayoutTests/platform/linux': 'bbb',
- '/mock-checkout/third_party/WebKit/LayoutTests': 'aaa',
- })
- self.assertEqual(host.filesystem.read_binary_file(
- '/mock-checkout/third_party/WebKit/LayoutTests/another/test-expected.txt'), 'result A')
-
- self.assertEqual(baseline_optimizer._files_to_delete, [
- '/mock-checkout/third_party/WebKit/LayoutTests/platform/win/another/test-expected.txt',
- ])
-
- self.assertEqual(baseline_optimizer._files_to_add, [
- '/mock-checkout/third_party/WebKit/LayoutTests/another/test-expected.txt',
- '/mock-checkout/third_party/WebKit/LayoutTests/platform/linux/another/test-expected.txt',
- ])
+ baseline_optimizer._move_baselines(
+ 'another/test-expected.txt',
+ {
+ '/mock-checkout/third_party/WebKit/LayoutTests/platform/win': 'aaa',
+ '/mock-checkout/third_party/WebKit/LayoutTests/platform/mac': 'aaa',
+ '/mock-checkout/third_party/WebKit/LayoutTests': 'bbb',
+ },
+ {
+ '/mock-checkout/third_party/WebKit/LayoutTests/platform/linux': 'bbb',
+ '/mock-checkout/third_party/WebKit/LayoutTests': 'aaa',
+ })
+ self.assertEqual(
+ host.filesystem.read_binary_file(
+ '/mock-checkout/third_party/WebKit/LayoutTests/another/test-expected.txt'),
+ 'result A')
+
+ self.assertEqual(
+ baseline_optimizer._files_to_delete,
+ [
+ '/mock-checkout/third_party/WebKit/LayoutTests/platform/win/another/test-expected.txt',
+ ])
+
+ self.assertEqual(
+ baseline_optimizer._files_to_add,
+ [
+ '/mock-checkout/third_party/WebKit/LayoutTests/another/test-expected.txt',
+ '/mock-checkout/third_party/WebKit/LayoutTests/platform/linux/another/test-expected.txt',
+ ])
def _assertOptimization(self, results_by_directory, expected_new_results_by_directory,
baseline_dirname='', expected_files_to_delete=None, host=None):
@@ -149,150 +162,182 @@ class BaselineOptimizerTest(unittest.TestCase):
self.assertEqual(sorted(baseline_optimizer._files_to_delete), sorted(expected_files_to_delete))
def test_linux_redundant_with_win(self):
- self._assertOptimization({
- 'platform/win': '1',
- 'platform/linux': '1',
- }, {
- 'platform/win': '1',
- })
+ self._assertOptimization(
+ {
+ 'platform/win': '1',
+ 'platform/linux': '1',
+ },
+ {
+ 'platform/win': '1',
+ })
def test_covers_mac_win_linux(self):
- self._assertOptimization({
- 'platform/mac': '1',
- 'platform/win': '1',
- 'platform/linux': '1',
- '': None,
- }, {
- '': '1',
- })
+ self._assertOptimization(
+ {
+ 'platform/mac': '1',
+ 'platform/win': '1',
+ 'platform/linux': '1',
+ '': None,
+ },
+ {
+ '': '1',
+ })
def test_overwrites_root(self):
- self._assertOptimization({
- 'platform/mac': '1',
- 'platform/win': '1',
- 'platform/linux': '1',
- '': '2',
- }, {
- '': '1',
- })
+ self._assertOptimization(
+ {
+ 'platform/mac': '1',
+ 'platform/win': '1',
+ 'platform/linux': '1',
+ '': '2',
+ },
+ {
+ '': '1',
+ })
def test_no_new_common_directory(self):
- self._assertOptimization({
- 'platform/mac': '1',
- 'platform/linux': '1',
- '': '2',
- }, {
- 'platform/mac': '1',
- 'platform/linux': '1',
- '': '2',
- })
+ self._assertOptimization(
+ {
+ 'platform/mac': '1',
+ 'platform/linux': '1',
+ '': '2',
+ },
+ {
+ 'platform/mac': '1',
+ 'platform/linux': '1',
+ '': '2',
+ })
def test_local_optimization(self):
- self._assertOptimization({
- 'platform/mac': '1',
- 'platform/linux': '1',
- 'platform/linux-precise': '1',
- }, {
- 'platform/mac': '1',
- 'platform/linux': '1',
- })
+ self._assertOptimization(
+ {
+ 'platform/mac': '1',
+ 'platform/linux': '1',
+ 'platform/linux-precise': '1',
+ },
+ {
+ 'platform/mac': '1',
+ 'platform/linux': '1',
+ })
def test_local_optimization_skipping_a_port_in_the_middle(self):
- self._assertOptimization({
- 'platform/mac-snowleopard': '1',
- 'platform/win': '1',
- 'platform/linux': '1',
- 'platform/linux-precise': '1',
- }, {
- 'platform/mac-snowleopard': '1',
- 'platform/win': '1',
- })
+ self._assertOptimization(
+ {
+ 'platform/mac-snowleopard': '1',
+ 'platform/win': '1',
+ 'platform/linux': '1',
+ 'platform/linux-precise': '1',
+ },
+ {
+ 'platform/mac-snowleopard': '1',
+ 'platform/win': '1',
+ })
def test_baseline_redundant_with_root(self):
- self._assertOptimization({
- 'platform/mac': '1',
- 'platform/win': '2',
- '': '2',
- }, {
- 'platform/mac': '1',
- '': '2',
- })
+ self._assertOptimization(
+ {
+ 'platform/mac': '1',
+ 'platform/win': '2',
+ '': '2',
+ },
+ {
+ 'platform/mac': '1',
+ '': '2',
+ })
def test_root_baseline_unused(self):
- self._assertOptimization({
- 'platform/mac': '1',
- 'platform/win': '2',
- '': '3',
- }, {
- 'platform/mac': '1',
- 'platform/win': '2',
- })
+ self._assertOptimization(
+ {
+ 'platform/mac': '1',
+ 'platform/win': '2',
+ '': '3',
+ },
+ {
+ 'platform/mac': '1',
+ 'platform/win': '2',
+ })
def test_root_baseline_unused_and_non_existant(self):
- self._assertOptimization({
- 'platform/mac': '1',
- 'platform/win': '2',
- }, {
- 'platform/mac': '1',
- 'platform/win': '2',
- })
+ self._assertOptimization(
+ {
+ 'platform/mac': '1',
+ 'platform/win': '2',
+ },
+ {
+ 'platform/mac': '1',
+ 'platform/win': '2',
+ })
def test_virtual_root_redundant_with_actual_root(self):
- self._assertOptimization({
- 'virtual/gpu/fast/canvas': '2',
- 'fast/canvas': '2',
- }, {
- 'virtual/gpu/fast/canvas': None,
- 'fast/canvas': '2',
- }, baseline_dirname='virtual/gpu/fast/canvas')
+ self._assertOptimization(
+ {
+ 'virtual/gpu/fast/canvas': '2',
+ 'fast/canvas': '2',
+ },
+ {
+ 'virtual/gpu/fast/canvas': None,
+ 'fast/canvas': '2',
+ },
+ baseline_dirname='virtual/gpu/fast/canvas')
def test_virtual_root_redundant_with_ancestors(self):
- self._assertOptimization({
- 'virtual/gpu/fast/canvas': '2',
- 'platform/mac/fast/canvas': '2',
- 'platform/win/fast/canvas': '2',
- }, {
- 'virtual/gpu/fast/canvas': None,
- 'fast/canvas': '2',
- }, baseline_dirname='virtual/gpu/fast/canvas')
+ self._assertOptimization(
+ {
+ 'virtual/gpu/fast/canvas': '2',
+ 'platform/mac/fast/canvas': '2',
+ 'platform/win/fast/canvas': '2',
+ },
+ {
+ 'virtual/gpu/fast/canvas': None,
+ 'fast/canvas': '2',
+ },
+ baseline_dirname='virtual/gpu/fast/canvas')
def test_virtual_root_redundant_with_ancestors_skip_scm_commands(self):
- self._assertOptimization({
- 'virtual/gpu/fast/canvas': '2',
- 'platform/mac/fast/canvas': '2',
- 'platform/win/fast/canvas': '2',
- }, {
- 'virtual/gpu/fast/canvas': None,
- 'fast/canvas': '2',
- },
+ self._assertOptimization(
+ {
+ 'virtual/gpu/fast/canvas': '2',
+ 'platform/mac/fast/canvas': '2',
+ 'platform/win/fast/canvas': '2',
+ },
+ {
+ 'virtual/gpu/fast/canvas': None,
+ 'fast/canvas': '2',
+ },
baseline_dirname='virtual/gpu/fast/canvas',
expected_files_to_delete=[
- '/mock-checkout/third_party/WebKit/LayoutTests/virtual/gpu/fast/canvas/mock-baseline-expected.txt',
- '/mock-checkout/third_party/WebKit/LayoutTests/platform/mac/fast/canvas/mock-baseline-expected.txt',
- '/mock-checkout/third_party/WebKit/LayoutTests/platform/win/fast/canvas/mock-baseline-expected.txt',
- ])
+ '/mock-checkout/third_party/WebKit/LayoutTests/virtual/gpu/fast/canvas/mock-baseline-expected.txt',
+ '/mock-checkout/third_party/WebKit/LayoutTests/platform/mac/fast/canvas/mock-baseline-expected.txt',
+ '/mock-checkout/third_party/WebKit/LayoutTests/platform/win/fast/canvas/mock-baseline-expected.txt',
+ ])
def test_virtual_root_redundant_with_ancestors_skip_scm_commands_with_file_not_in_scm(self):
- self._assertOptimization({
- 'virtual/gpu/fast/canvas': '2',
- 'platform/mac/fast/canvas': '2',
- 'platform/win/fast/canvas': '2',
- }, {
- 'virtual/gpu/fast/canvas': None,
- 'fast/canvas': '2',
- },
+ self._assertOptimization(
+ {
+ 'virtual/gpu/fast/canvas': '2',
+ 'platform/mac/fast/canvas': '2',
+ 'platform/win/fast/canvas': '2',
+ },
+ {
+ 'virtual/gpu/fast/canvas': None,
+ 'fast/canvas': '2',
+ },
baseline_dirname='virtual/gpu/fast/canvas',
expected_files_to_delete=[
- '/mock-checkout/third_party/WebKit/LayoutTests/platform/mac/fast/canvas/mock-baseline-expected.txt',
- '/mock-checkout/third_party/WebKit/LayoutTests/platform/win/fast/canvas/mock-baseline-expected.txt',
- ],
- host=MockHost(scm=ExcludingMockSCM(['/mock-checkout/third_party/WebKit/LayoutTests/virtual/gpu/fast/canvas/mock-baseline-expected.txt'])))
+ '/mock-checkout/third_party/WebKit/LayoutTests/platform/mac/fast/canvas/mock-baseline-expected.txt',
+ '/mock-checkout/third_party/WebKit/LayoutTests/platform/win/fast/canvas/mock-baseline-expected.txt',
+ ],
+ host=MockHost(scm=ExcludingMockSCM(
+ ['/mock-checkout/third_party/WebKit/LayoutTests/virtual/gpu/fast/canvas/mock-baseline-expected.txt'])))
def test_virtual_root_not_redundant_with_ancestors(self):
- self._assertOptimization({
- 'virtual/gpu/fast/canvas': '2',
- 'platform/mac/fast/canvas': '1',
- }, {
- 'virtual/gpu/fast/canvas': '2',
- 'platform/mac/fast/canvas': '1',
- }, baseline_dirname='virtual/gpu/fast/canvas')
+ self._assertOptimization(
+ {
+ 'virtual/gpu/fast/canvas': '2',
+ 'platform/mac/fast/canvas': '1',
+ },
+ {
+ 'virtual/gpu/fast/canvas': '2',
+ 'platform/mac/fast/canvas': '1',
+ },
+ baseline_dirname='virtual/gpu/fast/canvas')

Powered by Google App Engine
This is Rietveld 408576698