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 5import logging 6import os 7from autotest_lib.client.bin import utils 8from autotest_lib.client.common_lib import error 9from autotest_lib.client.cros import chrome_binary_test 10 11class video_VideoDecodeAccelerator(chrome_binary_test.ChromeBinaryTest): 12 """ 13 This test is a wrapper of the chrome unittest binary: 14 video_decode_accelerator_unittest. 15 """ 16 17 version = 1 18 binary = 'video_decode_accelerator_unittest' 19 20 21 @chrome_binary_test.nuke_chrome 22 def run_once(self, videos, use_cr_source_dir=True, gtest_filter=''): 23 """ 24 Runs video_decode_accelerator_unittest on the videos. 25 26 @param videos: The test videos for video_decode_accelerator_unittest. 27 @param use_cr_source_dir: Videos are under chrome source directory. 28 @param gtest_filter: gtest_filter parameter for the unittest. 29 30 @raises: error.TestFail for video_decode_accelerator_unittest failures. 31 """ 32 logging.debug('Starting video_VideoDecodeAccelerator: %s', videos) 33 34 if use_cr_source_dir: 35 path = os.path.join(self.cr_source_dir, 'media', 'test', 'data', '') 36 else: 37 path = '' 38 39 last_test_failure = None 40 for video in videos: 41 cmd_line = ('--test_video_data="%s%s"' % (path, video)) 42 43 if gtest_filter: 44 cmd_line = '%s --gtest_filter=%s' % (cmd_line, gtest_filter) 45 46 if utils.is_freon(): 47 cmd_line += ' --ozone-platform=gbm' 48 49 try: 50 self.run_chrome_test_binary(self.binary, cmd_line) 51 except error.TestFail as test_failure: 52 # Continue to run the remaining test videos and raise 53 # the last failure after finishing all videos. 54 logging.error('%s: %s', video, test_failure.message) 55 last_test_failure = test_failure 56 57 if last_test_failure: 58 raise last_test_failure 59