summaryrefslogtreecommitdiffstats
path: root/chrome/test/functional/chromeos_time.py
blob: c5b7d56f7daac2cf911f5c466b19c87046aa7a1c (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
32
33
34
35
36
37
38
#!/usr/bin/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 pyauto_functional  # Must be imported before pyauto
import pyauto

class ChromeosTime(pyauto.PyUITest):
  """Tests for the ChromeOS status area clock and timezone settings."""

  def setUp(self):
    pyauto.PyUITest.setUp(self)
    self._initial_timezone = self.GetTimeInfo()['timezone']

  def tearDown(self):
    self.SetTimezone(self._initial_timezone)
    pyauto.PyUITest.tearDown(self)

  def testTimeInfo(self):
    """Print the the display time, date, and timezone."""
    logging.debug(self.GetTimeInfo())

  def testSetTimezone(self):
    """Sanity test to make sure setting the timezone works."""
    self.SetTimezone('America/Los_Angeles')
    pacific_time = self.GetTimeInfo()['display_time']
    self.SetTimezone('America/New_York')
    eastern_time = self.GetTimeInfo()['display_time']

    self.assertNotEqual(pacific_time, eastern_time,
                        'Time zone changed but display time did not.')


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