# Copyright 2017 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from autotest_lib.server.cros.cfm.configurable_test.dsl import *
from autotest_lib.server import utils

AUTHOR = "kerl@google.com, chromeos-meetings@google.com"
NAME = "enterprise_CFM_ConfigurableCfmTestSanity.join_leave"
PURPOSE = "Verifies the configurable CfM test infra with a simple scenario"
CRITERIA = "No errors occur"
ATTRIBUTES = "suite:hotrod, suite:bluestreak-pre-cq"
TIME = "SHORT"
TEST_CATEGORY = "Functional"
TEST_TYPE = "server"
DEPENDENCIES="meet_app"

DOC = """
Verifies that we can specify and run a configurable cfm test.
"""

cfm_test = CfmTest(
    scenario=Scenario(
        RebootDut(restart_chrome_for_cfm=True),
        CreateMeeting(),
        RepeatTimes(5, Scenario(
            MuteMicrophone(),
            UnmuteMicrophone()
        )),
        LeaveMeeting()
    ),
    configuration=Configuration(
        run_test_only = False
    )
)

def run_test(machine):
    job.run_test("enterprise_CFM_ConfigurableCfmTestSanity",
                 cfm_test = cfm_test,
                 tag = 'join_leave',
                 host = hosts.create_host(machine))

parallel_simple(run_test, machines)