1# Copyright 2015 The Chromium OS 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
5from autotest_lib.client.cros.audio import audio_test_data
6from autotest_lib.client.cros.chameleon import audio_test_utils
7from autotest_lib.client.cros.chameleon import chameleon_audio_ids
8from autotest_lib.server import utils
9
10AUTHOR = "chromeos-chameleon"
11NAME = "audio_AudioAfterSuspend.internal_speaker"
12PURPOSE = "Remotely controlled internal_speaker AFTER SUSPEND audio test."
13CRITERIA = "This test will fail if the captured audio does not match original file."
14TIME = "SHORT"
15TEST_CATEGORY = "Functional"
16TEST_CLASS = "audio"
17TEST_TYPE = "server"
18ATTRIBUTES = "suite:audio_essential"
19DEPENDENCIES = "audio_box"
20JOB_RETRIES = 2
21
22DOC = """
23This test remotely tests internal_speaker audio function against DUT after suspend.
24"""
25# Plug unplug sequnce
26# (plugged_before_suspend, plugged_after_suspend, plugged_before_resume,
27# plugged_after_resume)
28plug_status = [(False,False,False,False)]
29
30args_dict = utils.args_to_dict(args)
31chameleon_args = hosts.CrosHost.get_chameleon_arguments(args_dict)
32
33def run(machine):
34    host = hosts.create_host(machine, chameleon_args=chameleon_args)
35    expected_internal_mic_node = audio_test_utils.get_internal_mic_node(host)
36    job.run_test("audio_AudioAfterSuspend", host=host,
37                 golden_data=(audio_test_data.SIMPLE_FREQUENCY_SPEAKER_TEST_FILE, 1000),
38                 recorder=chameleon_audio_ids.ChameleonIds.MIC,
39                 source=chameleon_audio_ids.CrosIds.SPEAKER,
40                 audio_nodes=(['INTERNAL_SPEAKER'],
41                              [expected_internal_mic_node]),
42                 plug_status=plug_status, tag = "internal_speaker")
43
44parallel_simple(run, machines)
45