1# Copyright 2017 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.bin import test 6from autotest_lib.client.common_lib import error 7from autotest_lib.client.common_lib.cros import test_webrtc_peer_connection 8 9 10class video_WebRtcMainFeedSwitching(test.test): 11 """ 12 Tests a simulated Video Call with one main and several small feeds. 13 14 Simulates speaker switching by swapping the source video object between the 15 main feed and one randomly chosen small feed. 16 """ 17 version = 1 18 19 def run_once(self, mode = 'functional'): 20 """ 21 Runs the test. 22 23 @param mode: 'functional' or 'performance' depending on desired mode. 24 """ 25 kwargs = { 26 'own_script': 'main-feed-switching.js', 27 'common_script': 'loopback-peerconnection.js', 28 'bindir': self.bindir, 29 'tmpdir': self.tmpdir, 30 'debugdir': self.debugdir, 31 'num_peer_connections': 5, 32 'iteration_delay_millis': 50 33 } 34 35 if mode == 'functional': 36 test = test_webrtc_peer_connection.WebRtcPeerConnectionTest( 37 title = 'Main Feed Switching', 38 **kwargs) 39 test.run_test() 40 elif mode == 'performance': 41 test = test_webrtc_peer_connection\ 42 .WebRtcPeerConnectionPerformanceTest( 43 title = 'Main Feed Switching Performance Test', 44 **kwargs) 45 test.run_test() 46 test.collector.write_metrics(self.output_perf_value) 47 else: 48 raise error.TestError('mode must be "functional" or "performance"') 49 50