Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 import pyauto_functional | 6 import pyauto_functional |
| 7 import pyauto | 7 import pyauto |
| 8 | 8 |
| 9 | 9 |
| 10 class ChromeosBasic(pyauto.PyUITest): | 10 class ChromeosBasic(pyauto.PyUITest): |
| 11 """Basic tests for ChromeOS. | 11 """Basic tests for ChromeOS. |
| 12 | 12 |
| 13 Requires ChromeOS to be logged in. | 13 Requires ChromeOS to be logged in. |
| 14 """ | 14 """ |
| 15 | 15 |
| 16 def testAppendTabs(self): | 16 def testAppendTabs(self): |
| 17 """Basic test for primary chrome on ChromeOS (named testing interface).""" | 17 """Basic test for primary chrome on ChromeOS (named testing interface).""" |
| 18 self.AppendTab(pyauto.GURL('about:version')) | 18 self.AppendTab(pyauto.GURL('about:version')) |
| 19 self.assertEqual(self.GetTabCount(), 2, msg='Expected 2 tabs') | 19 self.assertEqual(self.GetTabCount(), 2, msg='Expected 2 tabs') |
| 20 | 20 |
| 21 def testRestart(self): | 21 def testRestart(self): |
| 22 """Basic test which involves restarting chrome on ChromeOS.""" | 22 """Basic test which involves restarting chrome on ChromeOS.""" |
| 23 file_url = self.GetFileURLForDataPath('title2.html') | 23 file_url = self.GetFileURLForDataPath('title2.html') |
| 24 self.NavigateToURL(file_url) | 24 self.NavigateToURL(file_url) |
| 25 self.assertEqual(1, len(self.GetHistoryInfo().History())) | 25 self.assertEqual(1, len(self.GetHistoryInfo().History())) |
| 26 self.RestartBrowser(clear_profile=False) | 26 self.RestartBrowser(clear_profile=False) |
| 27 self.assertEqual(1, len(self.GetHistoryInfo().History())) | 27 self.assertEqual(1, len(self.GetHistoryInfo().History())) |
| 28 | 28 |
| 29 def testBatteryInfo(self): | |
|
Nirnimesh
2011/03/29 01:29:39
Please move this test to a new script - chromeos_p
dtu
2011/03/29 02:21:22
Done.
| |
| 30 """Print some information about the battery.""" | |
| 31 result = self.GetBatteryInfo() | |
| 32 self.assertTrue(result) | |
| 33 logging.debug(result) | |
| 34 | |
| 29 def testScreenLocker(self): | 35 def testScreenLocker(self): |
| 30 """Sanity check for screen locker functions.""" | 36 """Sanity check for screen locker functions.""" |
| 31 self.assertFalse(self.GetLoginInfo()['is_screen_locked']) | 37 self.assertFalse(self.GetLoginInfo()['is_screen_locked']) |
| 32 self.LockScreen() | 38 self.LockScreen() |
| 33 self.assertTrue(self.GetLoginInfo()['is_screen_locked']) | 39 self.assertTrue(self.GetLoginInfo()['is_screen_locked']) |
| 34 self.UnlockScreen() | 40 self.UnlockScreen() |
| 35 self.assertFalse(self.GetLoginInfo()['is_screen_locked']) | 41 self.assertFalse(self.GetLoginInfo()['is_screen_locked']) |
| 36 | 42 |
| 37 | 43 |
| 38 if __name__ == '__main__': | 44 if __name__ == '__main__': |
| 39 pyauto_functional.Main() | 45 pyauto_functional.Main() |
| OLD | NEW |