1# Copyright (c) 2012 The Chromium 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 5"""Subclass of the LinksysAPConfigurator.""" 6 7import ap_spec 8import linksys_ap_configurator 9 10 11class LinksysAP15Configurator(linksys_ap_configurator.LinksysAPConfigurator): 12 """Derived class to control Linksys WRT54G2 1.5 router.""" 13 14 def _set_mode(self, mode): 15 # Create the mode to popup item mapping 16 mode_mapping = {ap_spec.MODE_B: 'B-Only', ap_spec.MODE_G: 'G-Only', 17 ap_spec.MODE_B | ap_spec.MODE_G: 'Mixed', 18 'Disabled': 'Disabled'} 19 mode_name = mode_mapping.get(mode) 20 if not mode_name: 21 raise RuntimeError('The mode selected %d is not supported by router' 22 ' %s.', hex(mode), self.name) 23 xpath = ('//select[@name="wl_net_mode"]') 24 self.select_item_from_popup_by_xpath(mode_name, xpath) 25 26 27 def _set_visibility(self, visible=True): 28 self._set_radio(enabled=True) 29 int_value = 0 if visible else 1 30 xpath = ('//input[@value="%d" and @name="wl_closed"]' % int_value) 31 self.click_button_by_xpath(xpath) 32