• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2018 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"""A test which verifies the function of hardware JPEG encode accelerator."""
6
7import logging
8import os
9from autotest_lib.client.common_lib import file_utils
10from autotest_lib.client.cros import chrome_binary_test
11from autotest_lib.client.cros.video import helper_logger
12
13DOWNLOAD_BASE = 'http://commondatastorage.googleapis.com/chromiumos-test-assets-public/'
14TEST_IMAGE_PATH = 'jpeg_test/bali_640x360_P420.yuv'
15
16class video_JpegEncodeAccelerator(chrome_binary_test.ChromeBinaryTest):
17    """
18    This test is a wrapper of the chrome unittest binary:
19    jpeg_encode_accelerator_unittest.
20    """
21
22    version = 1
23    binary = 'jpeg_encode_accelerator_unittest'
24
25    @helper_logger.video_log_wrapper
26    @chrome_binary_test.nuke_chrome
27    def run_once(self, gtest_filter=None):
28        """
29        Runs jpeg_encode_accelerator_unittest on the device.
30
31        @param gtest_filter: test case filter.
32
33        @raises: error.TestFail for jpeg_encode_accelerator_unittest failures.
34        """
35        url = DOWNLOAD_BASE + TEST_IMAGE_PATH
36        local_path = os.path.join(self.bindir, os.path.basename(TEST_IMAGE_PATH))
37        file_utils.download_file(url, local_path)
38
39        cmd_line_list = [helper_logger.chrome_vmodule_flag()]
40        if gtest_filter:
41            cmd_line_list.append('--gtest_filter="%s"' % gtest_filter)
42
43        cmd_line = ' '.join(cmd_line_list)
44        self.run_chrome_test_binary(self.binary, cmd_line)
45