Home | History | Annotate | Download | only in functional
      1 #!/usr/bin/env python
      2 # Copyright (c) 2011 The Chromium Authors. All rights reserved.
      3 # Use of this source code is governed by a BSD-style license that can be
      4 # found in the LICENSE file.
      5 
      6 import pyauto_functional
      7 import pyauto
      8 
      9 
     10 class ChromeosBasic(pyauto.PyUITest):
     11   """Basic tests for ChromeOS.
     12 
     13   Requires ChromeOS to be logged in.
     14   """
     15 
     16   def testAppendTabs(self):
     17     """Basic test for primary chrome on ChromeOS (named testing interface)."""
     18     self.AppendTab(pyauto.GURL('about:version'))
     19     self.assertEqual(self.GetTabCount(), 2, msg='Expected 2 tabs')
     20 
     21   def testRestart(self):
     22     """Basic test which involves restarting chrome on ChromeOS."""
     23     file_url = self.GetFileURLForDataPath('title2.html')
     24     self.NavigateToURL(file_url)
     25     self.assertEqual(1, len(self.GetHistoryInfo().History()))
     26     self.RestartBrowser(clear_profile=False)
     27     self.assertEqual(1, len(self.GetHistoryInfo().History()))
     28 
     29   def testSetDownloadShelfVisible(self):
     30     self.assertFalse(self.IsDownloadShelfVisible())
     31     self.SetDownloadShelfVisible(True)
     32     self.assertTrue(self.IsDownloadShelfVisible())
     33     self.SetDownloadShelfVisible(False)
     34     self.assertFalse(self.IsDownloadShelfVisible())
     35 
     36   def testSetVolume(self):
     37     """Basic test for setting and getting the volume and mute state."""
     38     volume_info = self.GetVolumeInfo()
     39     for mute_setting in (False, True, False):
     40       self.SetMute(mute_setting)
     41       self.assertEqual(mute_setting, self.GetVolumeInfo()['is_mute'])
     42     for volume_setting in (40, 0, 100, 70):
     43       self.SetVolume(volume_setting)
     44       self.assertEqual(volume_setting, round(self.GetVolumeInfo()['volume']))
     45 
     46     self.SetVolume(volume_info['volume'])
     47     self.SetMute(volume_info['is_mute'])
     48     self.assertEqual(volume_info, self.GetVolumeInfo())
     49 
     50 
     51 if __name__ == '__main__':
     52   pyauto_functional.Main()
     53