Home | History | Annotate | Download | only in video_VideoDecodeAccelerator
      1 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
      2 # Use of this source code is governed by a BSD-style license that can be
      3 # found in the LICENSE file.
      4 
      5 import logging
      6 import os
      7 from autotest_lib.client.bin import utils
      8 from autotest_lib.client.common_lib import error
      9 from autotest_lib.client.cros import chrome_binary_test
     10 from autotest_lib.client.cros.video import helper_logger
     11 
     12 class video_VideoDecodeAccelerator(chrome_binary_test.ChromeBinaryTest):
     13     """
     14     This test is a wrapper of the chrome unittest binary:
     15     video_decode_accelerator_unittest.
     16     """
     17 
     18     version = 1
     19     binary = 'video_decode_accelerator_unittest'
     20 
     21     @helper_logger.video_log_wrapper
     22     @chrome_binary_test.nuke_chrome
     23     def run_once(self, videos, use_cr_source_dir=True, gtest_filter=None):
     24         """
     25         Runs video_decode_accelerator_unittest on the videos.
     26 
     27         @param videos: The test videos for video_decode_accelerator_unittest.
     28         @param use_cr_source_dir:  Videos are under chrome source directory.
     29         @param gtest_filter: test case filter.
     30 
     31         @raises: error.TestFail for video_decode_accelerator_unittest failures.
     32         """
     33         logging.debug('Starting video_VideoDecodeAccelerator: %s', videos)
     34 
     35         if use_cr_source_dir:
     36             path = os.path.join(self.cr_source_dir, 'media', 'test', 'data', '')
     37         else:
     38             path = ''
     39 
     40         last_test_failure = None
     41         for video in videos:
     42             cmd_line_list = ['--test_video_data="%s%s"' % (path, video)]
     43 
     44             # While thumbnail test fails, write thumbnail image to results
     45             # directory so that it will be accessible to host and packed
     46             # along with test logs.
     47             cmd_line_list.append(
     48                 '--thumbnail_output_dir="%s"' % self.resultsdir)
     49             cmd_line_list.append(helper_logger.chrome_vmodule_flag())
     50             cmd_line_list.append('--ozone-platform=gbm')
     51 
     52             if gtest_filter:
     53                 cmd_line_list.append('--gtest_filter="%s"' % gtest_filter)
     54 
     55             cmd_line = ' '.join(cmd_line_list)
     56             try:
     57                 self.run_chrome_test_binary(self.binary, cmd_line)
     58             except error.TestFail as test_failure:
     59                 # Continue to run the remaining test videos and raise
     60                 # the last failure after finishing all videos.
     61                 logging.error('%s: %s', video, test_failure.message)
     62                 last_test_failure = test_failure
     63 
     64         if last_test_failure:
     65             raise last_test_failure
     66