Chromium Code Reviews| Index: functional/shortcuts.py |
| =================================================================== |
| --- functional/shortcuts.py (revision 0) |
| +++ functional/shortcuts.py (revision 0) |
| @@ -0,0 +1,94 @@ |
| +#!/usr/bin/python |
| +# Copyright (c) 2010 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 pyauto_functional |
| +import pyauto |
| + |
| + |
| +class ShortcutsTest(pyauto.PyUITest): |
| + |
| + def testShortcuts(self): |
| + """Verify that shortcuts work fine.""" |
| + # Open a new tab. |
| + self.RunCommand(pyauto.IDC_NEW_TAB) |
| + self.assertEqual(2, self.GetTabCount()) |
| + self.RunCommand(pyauto.IDC_CLOSE_TAB) |
| + |
| + # 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) |
| + |
| + # TODO: Save page as |
|
Nirnimesh
2011/01/07 02:01:30
Remove commented out code
sunandt
2011/02/17 23:35:09
Done.
|
| + # url = self.GetFileURLForDataPath('title1.html') |
| + # self.NavigateToURL(url) |
| + # self.ApplyAccelerator(pyauto.IDC_SAVE_PAGE) |
| + |
| + # Open find in box. |
| + self.ApplyAccelerator(pyauto.IDC_FIND) |
| + self.assertTrue(self.WaitUntil(lambda: self.IsFindInPageVisible()), |
| + msg='Find in box is not visible.') |
| + |
| + # TODO: Print. |
| + # self.ApplyAccelerator(pyauto.IDC_PRINT) |
|
Nirnimesh
2011/01/07 02:01:30
remove
sunandt
2011/02/17 23:35:09
Done.
|
| + |
| + # Always show Bookmark bar. |
| + self.ApplyAccelerator(pyauto.IDC_SHOW_BOOKMARK_BAR) |
| + self.assertTrue(self.WaitUntil(lambda: self.GetBookmarkBarVisibility()), |
| + msg='Bookmark bar not visible.') |
| + |
| + # TODO: Open Task Manager. |
| + # self.ApplyAccelerator(pyauto.IDC_TASK_MANAGER) |
| + # self.RunCommand(pyauto.IDC_CLOSE_WINDOW, 1) |
|
Nirnimesh
2011/01/07 02:01:30
ditto
sunandt
2011/02/17 23:35:09
Done.
|
| + |
| + # TODO: Clear browsing data |
| + # self.ApplyAccelerator(pyauto.IDC_CLEAR_BROWSING_DATA) |
|
Nirnimesh
2011/01/07 02:01:30
ditto
sunandt
2011/02/17 23:35:09
Done.
|
| + |
| + # View Source. |
| + self.ApplyAccelerator(pyauto.IDC_VIEW_SOURCE) |
| + self.assertEqual(2, self.GetTabCount(), msg='Can\'t View Source.') |
|
Nirnimesh
2011/01/07 02:01:30
Also check tab url begins with view-source:
sunandt
2011/02/17 23:35:09
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) |
| + |
| + # 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'), |
| + msg='Google Chrome help page has not opened.') |
| + self.RunCommand(pyauto.IDC_CLOSE_TAB) |
| + |
| + |
| +if __name__ == '__main__': |
| + pyauto_functional.Main() |