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

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)
21 self.assertEqual(1, self.GetTabCount())
22
23 # Open a new window.
24 self.RunCommand(pyauto.IDC_NEW_WINDOW)
25 self.assertEquals(2, self.GetBrowserWindowCount())
26
27 # Close a window.
28 self.RunCommand(pyauto.IDC_CLOSE_WINDOW, 1)
29 self.assertEquals(1, self.GetBrowserWindowCount())
30
31 # Open a new incognito window.
32 self.RunCommand(pyauto.IDC_NEW_INCOGNITO_WINDOW)
33 self.assertEqual(2, self.GetBrowserWindowCount())
34 self.CloseBrowserWindow(1)
35
36 # Open find in box.
37 self.ApplyAccelerator(pyauto.IDC_FIND)
38 self.assertTrue(self.WaitUntil(lambda: self.IsFindInPageVisible()),
39 msg='Find in box is not visible.')
40
41 # Always show Bookmark bar.
42 self.ApplyAccelerator(pyauto.IDC_SHOW_BOOKMARK_BAR)
43 self.assertTrue(self.WaitUntil(lambda: self.GetBookmarkBarVisibility()),
44 msg='Bookmark bar not visible.')
45
46 # View Source.
47 self.ApplyAccelerator(pyauto.IDC_VIEW_SOURCE)
48 self.assertEqual(2, self.GetTabCount(), msg='Can\'t View Source.')
49 self.assertEqual('view-source:about:blank', self.GetActiveTabURL().spec(),
50 msg='View Source URL is not correct.')
51 self.GetBrowserWindow(0).GetTab(1).Close()
52
53 # Open Developer Tools.
54 # Setting the pref to undock devtools so that it can be seen
55 # as a separate window.
56 self.SetPrefs(pyauto.kDevToolsOpenDocked, False)
57 self.ApplyAccelerator(pyauto.IDC_DEV_TOOLS)
58 self.assertEqual(2, self.GetBrowserWindowCount(),
59 msg='DevTools window is not open.')
60 self.CloseBrowserWindow(1)
61
62 # Open Javascript Console.
63 self.ApplyAccelerator(pyauto.IDC_DEV_TOOLS_CONSOLE)
64 self.assertEqual(2, self.GetBrowserWindowCount(),
65 msg='DevTools console is not open.')
66 self.CloseBrowserWindow(1)
67
68 # Open History.
69 self.RunCommand(pyauto.IDC_SHOW_HISTORY)
70 self.assertEqual('History', self.GetActiveTabTitle(),
71 msg='History page was not opened.')
72 self.GetBrowserWindow(0).GetTab(1).Close()
73
74 # Open Downloads.
75 self.RunCommand(pyauto.IDC_SHOW_DOWNLOADS)
76 self.assertEqual('Downloads', self.GetActiveTabTitle(),
77 msg='Downloads page was not opened.')
78 self.GetBrowserWindow(0).GetTab(1).Close()
79
80 # Open Help page.
81 self.ApplyAccelerator(pyauto.IDC_HELP_PAGE)
82 self.assertTrue(self.WaitUntil(lambda: self.GetActiveTabTitle(),
83 expect_retval='Google Chrome Help'),
84 msg='Google Chrome help page has not opened.')
85 self.GetBrowserWindow(0).GetTab(1).Close()
86
87
88 if __name__ == '__main__':
89 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