Home | History | Annotate | Download | only in ap_configurators
      1 # Copyright (c) 2013 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 import netgear_single_band_configurator
      6 from netgear_single_band_configurator import *
      7 
      8 import ap_spec
      9 
     10 class Netgear1000APConfigurator(netgear_single_band_configurator.
     11                                 NetgearSingleBandAPConfigurator):
     12     """Derived class to control Netgear WNR1000v3 router."""
     13 
     14 
     15     def set_mode(self, mode):
     16         # The mode popup changes based on the security mode.  Set to no
     17         # security to get the right popup.
     18         self.add_item_to_command_list(self._set_security_disabled, (), 1, 799)
     19         self.add_item_to_command_list(self._set_mode, (mode, ), 1, 800)
     20 
     21 
     22     def _set_mode(self, mode):
     23         if mode == ap_spec.MODE_G:
     24             mode = 'Up to 54 Mbps'
     25         elif mode == ap_spec.MODE_N:
     26             mode = 'Up to 150 Mbps'
     27         else:
     28             raise RuntimeError('Unsupported mode passed.')
     29         xpath = '//select[@name="opmode"]'
     30         self.select_item_from_popup_by_xpath(mode, xpath)
     31