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


Python BaselineOptimizer.optimize方法代碼示例

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


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

示例1: _assertOptimization

# 需要導入模塊: from webkitpy.common.checkout.baselineoptimizer import BaselineOptimizer [as 別名]
# 或者: from webkitpy.common.checkout.baselineoptimizer.BaselineOptimizer import optimize [as 別名]
    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,代碼行數:31,代碼來源:baselineoptimizer_unittest.py

示例2: _assertOptimization

# 需要導入模塊: from webkitpy.common.checkout.baselineoptimizer import BaselineOptimizer [as 別名]
# 或者: from webkitpy.common.checkout.baselineoptimizer.BaselineOptimizer import optimize [as 別名]
    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,代碼行數:24,代碼來源:baselineoptimizer_unittest.py


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