1# Copyright (c) 2013 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 5import logging 6 7from autotest_lib.client.bin import test 8from autotest_lib.client.common_lib import error 9from autotest_lib.client.cros.networking.chrome_testing \ 10 import chrome_networking_test_context as cntc 11from autotest_lib.client.cros.networking.chrome_testing import test_utils 12 13class network_ChromeWifiTDLS(test.test): 14 """ 15 Tests that Shill responds to a Device.PerformTDLSOperation call via the 16 networikingPrivate API. It does not assume that configuration will actually 17 succeed (since that will depend on the environment), just that the call 18 itself succeeds and the callback is invoked. 19 """ 20 version = 1 21 22 def _enable_tdls(self, ip_address): 23 logging.info('enable_tdls') 24 enable = 'true' 25 result = test_utils.call_test_function_check_success( 26 self._chrome_testing, 27 'setWifiTDLSEnabledState', 28 ('"' + ip_address + '"', enable)) 29 logging.info('tdls result: ' + result) 30 31 # Look for a valid result. 32 if (result != 'Connected' and result != 'Disabled' and 33 result != 'Disconnected' and result != 'Nonexistant' and 34 result != 'Unknown'): 35 raise error.TestFail( 36 'Unexpected result for setWifiTDLSEnabledState: ' + result) 37 38 39 def _run_once_internal(self): 40 logging.info('run_once_internal') 41 self._enable_tdls('aa:bb:cc:dd:ee:ff') 42 43 44 def run_once(self): 45 with cntc.ChromeNetworkingTestContext() as testing_context: 46 self._chrome_testing = testing_context 47 self._run_once_internal() 48