Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 #!/usr/bin/python | |
| 2 # Copyright (c) 2010 The Chromium Authors. All rights reserved. | |
|
Nirnimesh
2011/02/17 23:45:40
2011
sunandt
2011/02/18 00:12:40
Done.
| |
| 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 ShortcutsTest(pyauto.PyUITest): | |
| 11 | |
|
Nirnimesh
2011/02/17 23:45:40
Add a docstring
sunandt
2011/02/18 00:12:40
Done.
| |
| 12 def testShortcuts(self): | |
| 13 """Verify that shortcuts work fine.""" | |
|
Nirnimesh
2011/02/17 23:45:40
remove 'that' & 'fine'
sunandt
2011/02/18 00:12:40
Done.
| |
| 14 # Open a new tab. | |
| 15 self.RunCommand(pyauto.IDC_NEW_TAB) | |
| 16 self.assertEqual(2, self.GetTabCount()) | |
| 17 self.RunCommand(pyauto.IDC_CLOSE_TAB) | |
|
Nirnimesh
2011/02/17 23:45:40
close without the accelerator
sunandt
2011/02/18 00:12:40
We have a shortcut to close a tab. Separating, so
| |
| 18 | |
| 19 # Open a new window. | |
| 20 self.RunCommand(pyauto.IDC_NEW_WINDOW) | |
| 21 self.assertEquals(2, self.GetBrowserWindowCount()) | |
| 22 self.RunCommand(pyauto.IDC_CLOSE_WINDOW, 1) | |
| 23 | |
| 24 # Open a new incognito window. | |
| 25 self.RunCommand(pyauto.IDC_NEW_INCOGNITO_WINDOW) | |
| 26 self.assertEqual(2, self.GetBrowserWindowCount()) | |
| 27 self.RunCommand(pyauto.IDC_CLOSE_WINDOW, 1) | |
| 28 | |
| 29 # Open find in box. | |
| 30 self.ApplyAccelerator(pyauto.IDC_FIND) | |
| 31 self.assertTrue(self.WaitUntil(lambda: self.IsFindInPageVisible()), | |
| 32 msg='Find in box is not visible.') | |
| 33 | |
| 34 # Always show Bookmark bar. | |
| 35 self.ApplyAccelerator(pyauto.IDC_SHOW_BOOKMARK_BAR) | |
| 36 self.assertTrue(self.WaitUntil(lambda: self.GetBookmarkBarVisibility()), | |
| 37 msg='Bookmark bar not visible.') | |
| 38 | |
| 39 # View Source. | |
| 40 self.ApplyAccelerator(pyauto.IDC_VIEW_SOURCE) | |
| 41 self.assertEqual(2, self.GetTabCount(), msg='Can\'t View Source.') | |
| 42 self.assertEqual('view-source:about:blank', self.GetActiveTabURL().spec(), | |
| 43 msg='View Source URL is not correct.') | |
|
Nirnimesh
2011/02/17 23:45:40
close this tab?
sunandt
2011/02/18 00:12:40
Done.
| |
| 44 | |
| 45 # Open Developer Tools. | |
| 46 # Setting the pref to undock devtools so that it can be seen | |
| 47 # as a separate window. | |
| 48 self.SetPrefs(pyauto.kDevToolsOpenDocked, False) | |
| 49 self.ApplyAccelerator(pyauto.IDC_DEV_TOOLS) | |
| 50 self.assertEqual(2, self.GetBrowserWindowCount(), | |
| 51 msg='DevTools window is not open.') | |
| 52 self.RunCommand(pyauto.IDC_CLOSE_WINDOW, 1) | |
| 53 | |
| 54 # Open Javascript Console. | |
| 55 self.ApplyAccelerator(pyauto.IDC_DEV_TOOLS_CONSOLE) | |
| 56 self.assertEqual(2, self.GetBrowserWindowCount(), | |
| 57 msg='DevTools console is not open.') | |
| 58 self.RunCommand(pyauto.IDC_CLOSE_WINDOW, 1) | |
|
Nirnimesh
2011/02/17 23:45:40
use CloseBrowserWindow(). you're not checking the
sunandt
2011/02/18 00:12:40
Done.
| |
| 59 | |
| 60 # Open History. | |
| 61 self.RunCommand(pyauto.IDC_SHOW_HISTORY) | |
| 62 self.assertEqual('History', self.GetActiveTabTitle(), | |
| 63 msg='History page was not opened.') | |
| 64 self.RunCommand(pyauto.IDC_CLOSE_TAB) | |
| 65 | |
| 66 # Open Downloads. | |
| 67 self.RunCommand(pyauto.IDC_SHOW_DOWNLOADS) | |
| 68 self.assertEqual('Downloads', self.GetActiveTabTitle(), | |
| 69 msg='Downloads page was not opened.') | |
| 70 self.RunCommand(pyauto.IDC_CLOSE_TAB) | |
| 71 | |
| 72 # Open Help page. | |
| 73 self.ApplyAccelerator(pyauto.IDC_HELP_PAGE) | |
| 74 self.assertTrue(self.WaitUntil(lambda: self.GetActiveTabTitle(), | |
| 75 expect_retval='Google Chrome Help'), | |
|
Nirnimesh
2011/02/17 23:45:40
what happens on Chromium?
sunandt
2011/02/18 00:12:40
Same text.
| |
| 76 msg='Google Chrome help page has not opened.') | |
| 77 self.RunCommand(pyauto.IDC_CLOSE_TAB) | |
|
Nirnimesh
2011/02/17 23:45:40
close tab without the accelerator
sunandt
2011/02/18 00:12:40
Done.
| |
| 78 | |
| 79 | |
| 80 if __name__ == '__main__': | |
| 81 pyauto_functional.Main() | |
| OLD | NEW |