예제 #1
0
    def run_once(self, **kwargs):
        # Number of connectivity test runs.
        self._connect_count = kwargs.get('connect_count', 5)

        # Number of seconds to sleep between connect and disconnect operations.
        self._sleep_kludge = kwargs.get('sleep_kludge', 5)

        # URL pattern to fetch data from during each connectivity test run.
        self._fetch_url_pattern = \
            kwargs.get('fetch_url_pattern', network.FETCH_URL_PATTERN_FOR_TEST)

        # Timeout in seconds for connect and disconnect operations, and
        # fetching data from a URL.
        self._connect_timeout = kwargs.get('connect_timeout', 10)
        self._disconnect_timeout = kwargs.get('disconnect_timeout', 10)
        self._fetch_timeout = kwargs.get('fetch_timeout', 120)

        # Number of bytes to fetch during each connectivity test run.
        self._bytes_to_fetch = kwargs.get('bytes_to_fetch', 64 * 1024)

        with backchannel.Backchannel():
            with cell_tools.OtherDeviceShutdownContext('wimax'):
                # TODO(benchan): Replace FlimFlam with ShillProxy.
                self._flim = flimflam.FlimFlam()
                self._flim.SetDebugTags(SHILL_LOG_SCOPES)
                self._service = self._flim.FindWimaxService()
                if not self._service:
                    raise error.TestError('Could not find a WiMAX service.')

                with shill_context.ServiceAutoConnectContext(
                        self._flim.FindWimaxService, False):
                    self._disconnect_service()
                    for _ in xrange(self._connect_count):
                        self._test_connectivity()
    def run_once(self, test_env, ops=30, seed=None):
        self.test_env = test_env
        with test_env, shill_context.ServiceAutoConnectContext(
                test_env.shill.wait_for_cellular_service_object, False):
            self._run_once_internal(ops, seed)

            # Enable device to restore autoconnect settings.
            self._enable()
            test_env.shill.wait_for_cellular_service_object()
예제 #3
0
 def run_once(self, test_env, cycles=3, min=15, max=25):
     with test_env, shill_context.ServiceAutoConnectContext(
             test_env.shill.find_cellular_service_object, False):
         self.device = test_env.shill.find_cellular_device_object()
         for t in xrange(max, min, -1):
             for n in xrange(cycles):
                 # deciseconds are an awesome unit.
                 logging.info('Cycle %d: %f seconds delay.', n, t / 10.0)
                 self._test(t / 10.0)
         logging.info('Done.')
    def run_once(self,
                 test_env,
                 autoconnect,
                 mixed_iterations=2,
                 slow_connect=False):
        self.test_env = test_env
        self.autoconnect = autoconnect

        with test_env:
            self.device = self.test_env.shill.find_cellular_device_object()

            modem_commands = ModemCommands(self.test_env.modem, slow_connect)
            technology_commands = TechnologyCommands(self.test_env.shill,
                                                     modem_commands)
            device_commands = DeviceCommands(self.test_env.shill, self.device,
                                             slow_connect)

            # shill disables autoconnect on any cellular service before a user
            # logs in (CL:851267). To test the autoconnect scenario, we need a
            # user session to run the test.
            chrome_context = chrome.Chrome()

            # Set up the autoconnect context after starting a user session so
            # that we ensure the autoconnect property is set on the cellular
            # service that may be in the user profile.
            autoconnect_context = shill_context.ServiceAutoConnectContext(
                self.test_env.shill.find_cellular_service_object,
                self.autoconnect)

            with contextlib.nested(chrome_context, autoconnect_context):
                # Start with cellular disabled.
                self.test_env.shill.manager.DisableTechnology(
                    shill_proxy.ShillProxy.TECHNOLOGY_CELLULAR)
                self.EnsureDisabled()

                # Run the device commands test first to make sure we have
                # a valid APN needed to connect using the modem commands.
                self.TestCommands(device_commands)
                self.TestCommands(technology_commands)
                self.TestCommands(modem_commands)

                # Run several times using commands mixed from each type
                mixed = MixedRandomCommands(
                    [modem_commands, technology_commands, device_commands])
                for _ in range(mixed_iterations):
                    self.TestCommands(mixed)

                # Ensure cellular is re-enabled in order to restore AutoConnect
                # settings when ServiceAutoConnectContext exits.
                # TODO(benchan): Refactor this logic into
                # ServiceAutoConnectContext and update other users of
                # ServiceAutoConnectContext.
                self.test_env.shill.manager.EnableTechnology(
                    shill_proxy.ShillProxy.TECHNOLOGY_CELLULAR)
                self.EnsureEnabled(check_idle=False)
    def run_once(self,
                 test_env,
                 connect_count=5,
                 sleep_kludge=5,
                 fetch_timeout=120):
        with test_env, shill_context.ServiceAutoConnectContext(
                test_env.shill.find_cellular_service_object, False):
            self.test_env = test_env
            self.connect_count = connect_count
            self.sleep_kludge = sleep_kludge
            self.fetch_timeout = fetch_timeout

            self.run_once_internal()
예제 #6
0
    def run_once(self):
        """Calls by autotest to run this test."""
        self.test_env = test_environment.CellularPseudoMMTestEnvironment(
            pseudomm_args=({
                'family': '3GPP'
            }, ))
        with self.test_env, shill_context.ServiceAutoConnectContext(
                self.test_env.shill.wait_for_cellular_service_object, False):
            self.pseudomm = pm_proxy.PseudoMMProxy.get_proxy()
            self.modem = self.pseudomm.get_modem()

            self._test_provisioned()
            self._test_out_of_credits_at_start()
            self._test_out_of_credits_while_connected()