summaryrefslogtreecommitdiffstats
path: root/chrome/test/functional/chromeos_offline.py
blob: a4120800cbcb55ef408b0e6d8b3704e9deecc95b (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
#!/usr/bin/env python
# Copyright (c) 2012 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 pyauto_functional
import pyauto


class TestOffline(pyauto.PyUITest):
  """Tests the offline detection for ChromeOS."""

  assert pyauto.PyUITest.IsChromeOS(), 'Works on ChromeOS only.'

  def tearDown(self):
    self.RestoreOnline()
    pyauto.PyUITest.tearDown(self)

  def testGoOffline(self):
    """Tests the GoOffline pyauto method."""

    self.GoOffline()
    # Device takes a little bit of time to realize it's offline/online.
    self.assertTrue(self.WaitUntil(
                    lambda: self.NetworkScan().get('offline_mode')),
                    msg='We are not offline.')


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