def _RunGpuIntegrationTests(self, test_name, extra_args=None):
   extra_args = extra_args or []
   unittest_config = chromium_config.ChromiumConfig(
       top_level_dir=path_util.GetGpuTestDir(),
       benchmark_dirs=[
           os.path.join(path_util.GetGpuTestDir(), 'unittest_data')
       ])
   with binary_manager.TemporarilyReplaceBinaryManager(None), \
        mock.patch.object(gpu_project_config, 'CONFIG', unittest_config):
     # TODO(crbug.com/1103792): Using NamedTemporaryFile() as a generator is
     # causing windows bots to fail. When the issue is fixed with
     # tempfile_ext.NamedTemporaryFile(), put it in the list of generators
     # starting this with block. Also remove the try finally statement
     # below.
     temp_file = tempfile.NamedTemporaryFile(delete=False)
     temp_file.close()
     try:
       test_argv = [
           test_name, '--write-full-results-to=%s' % temp_file.name
       ] + extra_args
       processed_args = run_gpu_integration_test.ProcessArgs(test_argv)
       telemetry_args = browser_test_runner.ProcessConfig(
           unittest_config, processed_args)
       run_browser_tests.RunTests(telemetry_args)
       with open(temp_file.name) as f:
         self._test_result = json.load(f)
     finally:
       temp_file.close()
示例#2
0
 def _RunGpuIntegrationTests(self, test_name, extra_args=None):
     extra_args = extra_args or []
     temp_file = tempfile.NamedTemporaryFile(delete=False)
     temp_file.close()
     test_argv = [test_name,
                  '--write-full-results-to=%s' % temp_file.name
                  ] + extra_args
     unittest_config = chromium_config.ChromiumConfig(
         top_level_dir=path_util.GetGpuTestDir(),
         benchmark_dirs=[
             os.path.join(path_util.GetGpuTestDir(), 'unittest_data')
         ])
     old_manager = binary_manager._binary_manager
     with mock.patch.object(gpu_project_config, 'CONFIG', unittest_config):
         processed_args = run_gpu_integration_test.ProcessArgs(test_argv)
         telemetry_args = browser_test_runner.ProcessConfig(
             unittest_config, processed_args)
         try:
             binary_manager._binary_manager = None
             run_browser_tests.RunTests(telemetry_args)
             with open(temp_file.name) as f:
                 self._test_result = json.load(f)
         finally:
             binary_manager._binary_manager = old_manager
             temp_file.close()