| OLD | NEW |
| 1 # Copyright (C) 2011 Google Inc. All rights reserved. | 1 # Copyright (C) 2011 Google Inc. All rights reserved. |
| 2 # | 2 # |
| 3 # Redistribution and use in source and binary forms, with or without | 3 # Redistribution and use in source and binary forms, with or without |
| 4 # modification, are permitted provided that the following conditions are | 4 # modification, are permitted provided that the following conditions are |
| 5 # met: | 5 # met: |
| 6 # | 6 # |
| 7 # * Redistributions of source code must retain the above copyright | 7 # * Redistributions of source code must retain the above copyright |
| 8 # notice, this list of conditions and the following disclaimer. | 8 # notice, this list of conditions and the following disclaimer. |
| 9 # * Redistributions in binary form must reproduce the above | 9 # * Redistributions in binary form must reproduce the above |
| 10 # copyright notice, this list of conditions and the following disclaimer | 10 # copyright notice, this list of conditions and the following disclaimer |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 21 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 22 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 22 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 23 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 23 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 24 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 24 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 25 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 25 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 26 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 26 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 27 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 27 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 28 | 28 |
| 29 import hashlib | 29 import hashlib |
| 30 import sys | 30 import sys |
| 31 import unittest2 as unittest | 31 from webkitpy.thirdparty import unittest2 as unittest |
| 32 | 32 |
| 33 from webkitpy.common.checkout.baselineoptimizer import BaselineOptimizer | 33 from webkitpy.common.checkout.baselineoptimizer import BaselineOptimizer |
| 34 from webkitpy.common.system.filesystem_mock import MockFileSystem | 34 from webkitpy.common.system.filesystem_mock import MockFileSystem |
| 35 from webkitpy.common.host_mock import MockHost | 35 from webkitpy.common.host_mock import MockHost |
| 36 | 36 |
| 37 | 37 |
| 38 class TestBaselineOptimizer(BaselineOptimizer): | 38 class TestBaselineOptimizer(BaselineOptimizer): |
| 39 def __init__(self, mock_results_by_directory, create_mock_files, baseline_na
me): | 39 def __init__(self, mock_results_by_directory, create_mock_files, baseline_na
me): |
| 40 host = MockHost() | 40 host = MockHost() |
| 41 BaselineOptimizer.__init__(self, host, host.port_factory.all_port_names(
)) | 41 BaselineOptimizer.__init__(self, host, host.port_factory.all_port_names(
)) |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 }, expected_result, baseline_name, create_mock_files=True) | 234 }, expected_result, baseline_name, create_mock_files=True) |
| 235 | 235 |
| 236 def test_virtual_root_not_redundant_with_ancestors(self): | 236 def test_virtual_root_not_redundant_with_ancestors(self): |
| 237 baseline_name = self.VIRTUAL_DIRECTORY + '/mock-baseline.png' | 237 baseline_name = self.VIRTUAL_DIRECTORY + '/mock-baseline.png' |
| 238 hash_of_two = hashlib.sha1('2').hexdigest() | 238 hash_of_two = hashlib.sha1('2').hexdigest() |
| 239 expected_result = [{'LayoutTests/virtual/softwarecompositing': hash_of_t
wo}, {'LayoutTests/platform/mac': hash_of_two}] | 239 expected_result = [{'LayoutTests/virtual/softwarecompositing': hash_of_t
wo}, {'LayoutTests/platform/mac': hash_of_two}] |
| 240 self._assertOneLevelOptimization({ | 240 self._assertOneLevelOptimization({ |
| 241 'LayoutTests/' + self.VIRTUAL_DIRECTORY: '2', | 241 'LayoutTests/' + self.VIRTUAL_DIRECTORY: '2', |
| 242 'LayoutTests/platform/mac': '2', | 242 'LayoutTests/platform/mac': '2', |
| 243 }, expected_result, baseline_name, create_mock_files=True) | 243 }, expected_result, baseline_name, create_mock_files=True) |
| OLD | NEW |