1# Copyright 2020 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. 4import logging 5 6from autotest_lib.client.common_lib import error 7from autotest_lib.server import autotest 8from autotest_lib.server import test 9from autotest_lib.server.cros.cfm.utils import bond_http_api 10 11 12class power_MeetCall(test.test): 13 """Wrapper test to create meet bot and call power_MeetClient.""" 14 version = 1 15 16 # 5 minutes for client test autotests overhead. 17 AUTOTESTS_OVERHEAD = 300 18 19 def run_once(self, host, args): 20 """Create meetbot and call client test.""" 21 bond_api = bond_http_api.BondHttpApi() 22 meet_code = bond_api.CreateConference() 23 logging.info('meet_code: %s', meet_code) 24 25 num_bots = args.get('num_bots', 4) 26 duration = args.get('duration', 180) + self.AUTOTESTS_OVERHEAD 27 28 bots = bond_api.AddBotsRequest(meet_code, num_bots, duration) 29 if len(bots) < num_bots: 30 bond_api.ExecuteScript('@all leave', meet_code) 31 raise error.TestNAError('Can not add meet bots.') 32 33 args['meet_code'] = meet_code 34 if not args['pdash_note']: 35 args['pdash_note'] = meet_code 36 autotest_client = autotest.Autotest(host) 37 autotest_client.run_test('power_MeetClient', **args) 38