• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.
4import logging, pickle, time
5
6from autotest_lib.client.bin import test, utils
7from autotest_lib.client.common_lib import error
8from autotest_lib.client.cros import backchannel, http_speed, network
9
10from autotest_lib.client.cros.cellular import cellular, cell_tools, environment
11
12from autotest_lib.client.cros import flimflam_test_path
13import flimflam
14
15
16class cellular_Throughput(test.test):
17    version = 1
18
19    def run_once(self, config, technology):
20        with environment.DefaultCellularTestContext(config) as c:
21            env = c.env
22            flim = flimflam.FlimFlam()
23            env.StartDefault(technology)
24            network.ResetAllModems(flim)
25            cell_tools.PrepareModemForTechnology('', technology)
26
27            # TODO(rochberg): Figure out why this is necessary
28            time.sleep(10)
29
30            # Clear all errors before we start.
31            # Resetting the modem above may have caused some errors on the
32            # 8960 (eg. lost connection, etc).
33            env.emulator.ClearErrors()
34
35            service = env.CheckedConnectToCellular()
36
37            # TODO(rochberg): Factor this and the counts stuff out
38            # so that individual tests don't have to care.
39            env.emulator.LogStats()
40            env.emulator.ResetDataCounters()
41
42            perf = http_speed.HttpSpeed(
43                env.config.cell['perfserver']['download_url_format_string'],
44                env.config.cell['perfserver']['upload_url'])
45
46
47            # TODO(rochberg):  Can/should we these values into the
48            # write_perf_keyval dictionary?  Now we just log them.
49            env.emulator.GetDataCounters()
50
51            env.CheckedDisconnectFromCellular(service)
52
53            self.write_perf_keyval(perf)
54