當前位置: 首頁>>代碼示例>>Python>>正文


Python baselineoptimizer.BaselineOptimizer類代碼示例

本文整理匯總了Python中webkitpy.common.checkout.baselineoptimizer.BaselineOptimizer的典型用法代碼示例。如果您正苦於以下問題:Python BaselineOptimizer類的具體用法?Python BaselineOptimizer怎麽用?Python BaselineOptimizer使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了BaselineOptimizer類的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: _assertOptimization

    def _assertOptimization(self, results_by_directory, expected_new_results_by_directory, baseline_dirname='', expected_files_to_delete=None, host=None):
        if not host:
            host = MockHost()
        fs = host.filesystem
        webkit_base = WebKitFinder(fs).webkit_base()
        baseline_name = 'mock-baseline-expected.txt'

        for dirname, contents in results_by_directory.items():
            path = fs.join(webkit_base, 'LayoutTests', dirname, baseline_name)
            fs.write_binary_file(path, contents)

        baseline_optimizer = BaselineOptimizer(host, host.port_factory.all_port_names(), skip_scm_commands=expected_files_to_delete is not None)
        self.assertTrue(baseline_optimizer.optimize(fs.join(baseline_dirname, baseline_name)))

        for dirname, contents in expected_new_results_by_directory.items():
            path = fs.join(webkit_base, 'LayoutTests', dirname, baseline_name)
            if contents is None:
                self.assertTrue(not fs.exists(path) or path in baseline_optimizer._files_to_delete)
            else:
                self.assertEqual(fs.read_binary_file(path), contents)

        # Check that the files that were in the original set have been deleted where necessary.
        for dirname in results_by_directory:
            path = fs.join(webkit_base, 'LayoutTests', dirname, baseline_name)
            if not dirname in expected_new_results_by_directory:
                self.assertTrue(not fs.exists(path) or path in baseline_optimizer._files_to_delete)

        if expected_files_to_delete:
            self.assertEqual(baseline_optimizer._files_to_delete, expected_files_to_delete)
開發者ID:darktears,項目名稱:blink-crosswalk,代碼行數:29,代碼來源:baselineoptimizer_unittest.py

示例2: test_move_baselines_skip_scm_commands

 def test_move_baselines_skip_scm_commands(self):
     host = MockHost()
     host.filesystem.write_text_file('/mock-checkout/third_party/WebKit/LayoutTests/VirtualTestSuites', '[]')
     host.filesystem.write_binary_file(
         '/mock-checkout/third_party/WebKit/LayoutTests/platform/win/another/test-expected.txt', 'result A')
     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())
     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')
開發者ID:mirror,項目名稱:chromium,代碼行數:25,代碼來源:baselineoptimizer_unittest.py

示例3: test_move_baselines

 def test_move_baselines(self):
     host = MockHost()
     host.filesystem.write_binary_file('/mock-checkout/LayoutTests/platform/mac-lion/another/test-expected.txt', 'result A')
     host.filesystem.write_binary_file('/mock-checkout/LayoutTests/platform/mac-lion-wk2/another/test-expected.txt', 'result A')
     host.filesystem.write_binary_file('/mock-checkout/LayoutTests/platform/mac/another/test-expected.txt', 'result B')
     baseline_optimizer = BaselineOptimizer(host, host.port_factory.all_port_names())
     baseline_optimizer._move_baselines('another/test-expected.txt', {
         'LayoutTests/platform/mac-lion': 'aaa',
         'LayoutTests/platform/mac-lion-wk2': 'aaa',
         'LayoutTests/platform/mac': 'bbb',
     }, {
         'LayoutTests/platform/mac': 'aaa',
     })
     self.assertEqual(host.filesystem.read_binary_file('/mock-checkout/LayoutTests/platform/mac/another/test-expected.txt'), 'result A')
開發者ID:ZeusbaseWeb,項目名稱:webkit,代碼行數:14,代碼來源:baselineoptimizer_unittest.py

示例4: test_move_baselines

 def test_move_baselines(self):
     host = MockHost(scm=ExcludingMockSCM(['/mock-checkout/third_party/WebKit/LayoutTests/platform/mac/another/test-expected.txt']))
     host.filesystem.write_binary_file('/mock-checkout/third_party/WebKit/LayoutTests/platform/win/another/test-expected.txt', 'result A')
     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.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')
開發者ID:darktears,項目名稱:blink-crosswalk,代碼行數:14,代碼來源:baselineoptimizer_unittest.py

示例5: test_move_baselines

 def test_move_baselines(self):
     fs = MockFileSystem()
     fs.write_binary_file("/mock-checkout/LayoutTests/platform/chromium-win/another/test-expected.txt", "result A")
     fs.write_binary_file(
         "/mock-checkout/LayoutTests/platform/chromium-cg-mac/another/test-expected.txt", "result A"
     )
     fs.write_binary_file("/mock-checkout/LayoutTests/platform/chromium/another/test-expected.txt", "result B")
     baseline_optimizer = BaselineOptimizer(MockSCM(), fs)
     baseline_optimizer._move_baselines(
         "another/test-expected.txt",
         {
             "LayoutTests/platform/chromium-win": "aaa",
             "LayoutTests/platform/chromium-cg-mac": "aaa",
             "LayoutTests/platform/chromium": "bbb",
         },
         {"LayoutTests/platform/chromium": "aaa"},
     )
     self.assertEqual(
         fs.read_binary_file("/mock-checkout/LayoutTests/platform/chromium/another/test-expected.txt"), "result A"
     )
開發者ID:nizovn,項目名稱:luna-sysmgr,代碼行數:20,代碼來源:baselineoptimizer_unittest.py

示例6: _assertOptimization

    def _assertOptimization(self, results_by_directory, expected_new_results_by_directory,
                            baseline_dirname='', host=None):
        if not host:
            host = MockHost()
        fs = host.filesystem
        webkit_base = WebKitFinder(fs).webkit_base()
        baseline_name = 'mock-baseline-expected.txt'
        fs.write_text_file(fs.join(webkit_base, 'LayoutTests', 'VirtualTestSuites'),
                           '[{"prefix": "gpu", "base": "fast/canvas", "args": ["--foo"]}]')

        for dirname, contents in results_by_directory.items():
            path = fs.join(webkit_base, 'LayoutTests', dirname, baseline_name)
            fs.write_binary_file(path, contents)

        baseline_optimizer = BaselineOptimizer(host, host.port_factory.get(
        ), host.port_factory.all_port_names())
        self.assertTrue(baseline_optimizer.optimize(fs.join(baseline_dirname, baseline_name)))

        for dirname, contents in expected_new_results_by_directory.items():
            path = fs.join(webkit_base, 'LayoutTests', dirname, baseline_name)
            if contents is not None:
                self.assertEqual(fs.read_binary_file(path), contents)
開發者ID:mirror,項目名稱:chromium,代碼行數:22,代碼來源:baselineoptimizer_unittest.py

示例7: __init__

 def __init__(self, mock_results_by_directory):
     host = MockHost()
     BaselineOptimizer.__init__(self, host, host.port_factory.all_port_names())
     self._mock_results_by_directory = mock_results_by_directory
開發者ID:ZeusbaseWeb,項目名稱:webkit,代碼行數:4,代碼來源:baselineoptimizer_unittest.py

示例8: __init__

 def __init__(self, mock_results_by_directory):
     BaselineOptimizer.__init__(self, MockSCM(), MockFileSystem())
     self._mock_results_by_directory = mock_results_by_directory
開發者ID:nizovn,項目名稱:luna-sysmgr,代碼行數:3,代碼來源:baselineoptimizer_unittest.py


注:本文中的webkitpy.common.checkout.baselineoptimizer.BaselineOptimizer類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。