Chromium Code Reviews| Index: functional/shortcuts.py |
| =================================================================== |
| --- functional/shortcuts.py (revision 0) |
| +++ functional/shortcuts.py (revision 0) |
| @@ -0,0 +1,81 @@ |
| +#!/usr/bin/python |
| +# 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.
|
| +# 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 ShortcutsTest(pyauto.PyUITest): |
| + |
|
Nirnimesh
2011/02/17 23:45:40
Add a docstring
sunandt
2011/02/18 00:12:40
Done.
|
| + def testShortcuts(self): |
| + """Verify that shortcuts work fine.""" |
|
Nirnimesh
2011/02/17 23:45:40
remove 'that' & 'fine'
sunandt
2011/02/18 00:12:40
Done.
|
| + # Open a new tab. |
| + self.RunCommand(pyauto.IDC_NEW_TAB) |
| + self.assertEqual(2, self.GetTabCount()) |
| + 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
|
| + |
| + # Open a new window. |
| + self.RunCommand(pyauto.IDC_NEW_WINDOW) |
| + self.assertEquals(2, self.GetBrowserWindowCount()) |
| + self.RunCommand(pyauto.IDC_CLOSE_WINDOW, 1) |
| + |
| + # Open a new incognito window. |
| + self.RunCommand(pyauto.IDC_NEW_INCOGNITO_WINDOW) |
| + self.assertEqual(2, self.GetBrowserWindowCount()) |
| + self.RunCommand(pyauto.IDC_CLOSE_WINDOW, 1) |
| + |
| + # Open find in box. |
| + self.ApplyAccelerator(pyauto.IDC_FIND) |
| + self.assertTrue(self.WaitUntil(lambda: self.IsFindInPageVisible()), |
| + msg='Find in box is not visible.') |
| + |
| + # Always show Bookmark bar. |
| + self.ApplyAccelerator(pyauto.IDC_SHOW_BOOKMARK_BAR) |
| + self.assertTrue(self.WaitUntil(lambda: self.GetBookmarkBarVisibility()), |
| + msg='Bookmark bar not visible.') |
| + |
| + # View Source. |
| + self.ApplyAccelerator(pyauto.IDC_VIEW_SOURCE) |
| + self.assertEqual(2, self.GetTabCount(), msg='Can\'t View Source.') |
| + self.assertEqual('view-source:about:blank', self.GetActiveTabURL().spec(), |
| + 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.
|
| + |
| + # Open Developer Tools. |
| + # Setting the pref to undock devtools so that it can be seen |
| + # as a separate window. |
| + self.SetPrefs(pyauto.kDevToolsOpenDocked, False) |
| + self.ApplyAccelerator(pyauto.IDC_DEV_TOOLS) |
| + self.assertEqual(2, self.GetBrowserWindowCount(), |
| + msg='DevTools window is not open.') |
| + self.RunCommand(pyauto.IDC_CLOSE_WINDOW, 1) |
| + |
| + # Open Javascript Console. |
| + self.ApplyAccelerator(pyauto.IDC_DEV_TOOLS_CONSOLE) |
| + self.assertEqual(2, self.GetBrowserWindowCount(), |
| + msg='DevTools console is not open.') |
| + 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.
|
| + |
| + # Open History. |
| + self.RunCommand(pyauto.IDC_SHOW_HISTORY) |
| + self.assertEqual('History', self.GetActiveTabTitle(), |
| + msg='History page was not opened.') |
| + self.RunCommand(pyauto.IDC_CLOSE_TAB) |
| + |
| + # Open Downloads. |
| + self.RunCommand(pyauto.IDC_SHOW_DOWNLOADS) |
| + self.assertEqual('Downloads', self.GetActiveTabTitle(), |
| + msg='Downloads page was not opened.') |
| + self.RunCommand(pyauto.IDC_CLOSE_TAB) |
| + |
| + # Open Help page. |
| + self.ApplyAccelerator(pyauto.IDC_HELP_PAGE) |
| + self.assertTrue(self.WaitUntil(lambda: self.GetActiveTabTitle(), |
| + 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.
|
| + msg='Google Chrome help page has not opened.') |
| + 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.
|
| + |
| + |
| +if __name__ == '__main__': |
| + pyauto_functional.Main() |