summaryrefslogtreecommitdiffstats
path: root/chrome/test/functional/chromeos_cellular_sanity.py
blob: 2f06d48933f07216a5ec89dbc6cd61237002f39b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/env python
# Copyright (c) 2011 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import logging
import os
import sys
import time

import pyauto_functional
import pyauto # pyauto_functional must come before pyauto

class ChromeosCellularSanity(pyauto.PyUITest):
  """Tests for ChromeOS network related functions."""

  assert os.popen('modem status').read(), 'Device needs modem to run test.'

  def testConnectCellularNetwork(self):
    """Connect to the cellular network if present."""

    self.ConnectToCellularNetwork()
    self.assertTrue(self.NetworkScan().get('connected_cellular'),
                   'Failed to connect to cellular network.')
    self.DisconnectFromCellularNetwork()
    self.assertFalse(self.NetworkScan().get('connected_cellular'),
                     'Failed to disconnect from cellular network.')


if __name__ == '__main__':
  pyauto_functional.Main()