Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(41)

Side by Side Diff: functional/shortcuts.py

Issue 6018010: Adding pyauto tests for checking Chrome shortcuts. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/chrome/test/
Patch Set: '' Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #!/usr/bin/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 ShortcutsTest(pyauto.PyUITest):
11 """Test for browser shortcuts."""
12
13 def testShortcuts(self):
14 """Verify shortcuts work."""
15 # Open a new tab.
16 self.RunCommand(pyauto.IDC_NEW_TAB)
17 self.assertEqual(2, self.GetTabCount())
18
19 # Close a tab.
20 self.RunCommand(pyauto.IDC_CLOSE_TAB)
Nirnimesh 2011/02/18 00:15:16 you don't verify anything after closing this tab!
sunandt 2011/02/18 00:32:28 Added a check here and after closing a window as w
21
22 # Open a new window.
23 self.RunCommand(pyauto.IDC_NEW_WINDOW)
24 self.assertEquals(2, self.GetBrowserWindowCount())
25
26 # Close a window.
27 self.RunCommand(pyauto.IDC_CLOSE_WINDOW, 1)
28
29 # Open a new incognito window.
30 self.RunCommand(pyauto.IDC_NEW_INCOGNITO_WINDOW)
31 self.assertEqual(2, self.GetBrowserWindowCount())
32 self.CloseBrowserWindow(1)
33
34 # Open find in box.
35 self.ApplyAccelerator(pyauto.IDC_FIND)
36 self.assertTrue(self.WaitUntil(lambda: self.IsFindInPageVisible()),
37 msg='Find in box is not visible.')
38
39 # Always show Bookmark bar.
40 self.ApplyAccelerator(pyauto.IDC_SHOW_BOOKMARK_BAR)
41 self.assertTrue(self.WaitUntil(lambda: self.GetBookmarkBarVisibility()),
42 msg='Bookmark bar not visible.')
43
44 # View Source.
45 self.ApplyAccelerator(pyauto.IDC_VIEW_SOURCE)
46 self.assertEqual(2, self.GetTabCount(), msg='Can\'t View Source.')
47 self.assertEqual('view-source:about:blank', self.GetActiveTabURL().spec(),
48 msg='View Source URL is not correct.')
49 self.GetBrowserWindow(0).GetTab(1).Close()
50
51 # Open Developer Tools.
52 # Setting the pref to undock devtools so that it can be seen
53 # as a separate window.
54 self.SetPrefs(pyauto.kDevToolsOpenDocked, False)
55 self.ApplyAccelerator(pyauto.IDC_DEV_TOOLS)
56 self.assertEqual(2, self.GetBrowserWindowCount(),
57 msg='DevTools window is not open.')
58 self.CloseBrowserWindow(1)
59
60 # Open Javascript Console.
61 self.ApplyAccelerator(pyauto.IDC_DEV_TOOLS_CONSOLE)
62 self.assertEqual(2, self.GetBrowserWindowCount(),
63 msg='DevTools console is not open.')
64 self.CloseBrowserWindow(1)
65
66 # Open History.
67 self.RunCommand(pyauto.IDC_SHOW_HISTORY)
68 self.assertEqual('History', self.GetActiveTabTitle(),
69 msg='History page was not opened.')
70 self.GetBrowserWindow(0).GetTab(1).Close()
71
72 # Open Downloads.
73 self.RunCommand(pyauto.IDC_SHOW_DOWNLOADS)
74 self.assertEqual('Downloads', self.GetActiveTabTitle(),
75 msg='Downloads page was not opened.')
76 self.GetBrowserWindow(0).GetTab(1).Close()
77
78 # Open Help page.
79 self.ApplyAccelerator(pyauto.IDC_HELP_PAGE)
80 self.assertTrue(self.WaitUntil(lambda: self.GetActiveTabTitle(),
81 expect_retval='Google Chrome Help'),
82 msg='Google Chrome help page has not opened.')
83 self.GetBrowserWindow(0).GetTab(1).Close()
84
85
86 if __name__ == '__main__':
87 pyauto_functional.Main()
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698