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

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, 11 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) 2010 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
12 def testShortcuts(self):
13 """Verify that shortcuts work fine."""
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)
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 # TODO: Save page as
Nirnimesh 2011/01/07 02:01:30 Remove commented out code
sunandt 2011/02/17 23:35:09 Done.
30 # url = self.GetFileURLForDataPath('title1.html')
31 # self.NavigateToURL(url)
32 # self.ApplyAccelerator(pyauto.IDC_SAVE_PAGE)
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 # TODO: Print.
40 # self.ApplyAccelerator(pyauto.IDC_PRINT)
Nirnimesh 2011/01/07 02:01:30 remove
sunandt 2011/02/17 23:35:09 Done.
41
42 # Always show Bookmark bar.
43 self.ApplyAccelerator(pyauto.IDC_SHOW_BOOKMARK_BAR)
44 self.assertTrue(self.WaitUntil(lambda: self.GetBookmarkBarVisibility()),
45 msg='Bookmark bar not visible.')
46
47 # TODO: Open Task Manager.
48 # self.ApplyAccelerator(pyauto.IDC_TASK_MANAGER)
49 # self.RunCommand(pyauto.IDC_CLOSE_WINDOW, 1)
Nirnimesh 2011/01/07 02:01:30 ditto
sunandt 2011/02/17 23:35:09 Done.
50
51 # TODO: Clear browsing data
52 # self.ApplyAccelerator(pyauto.IDC_CLEAR_BROWSING_DATA)
Nirnimesh 2011/01/07 02:01:30 ditto
sunandt 2011/02/17 23:35:09 Done.
53
54 # View Source.
55 self.ApplyAccelerator(pyauto.IDC_VIEW_SOURCE)
56 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.
57
58 # Open Developer Tools.
59 # Setting the pref to undock devtools so that it can be seen
60 # as a separate window.
61 self.SetPrefs(pyauto.kDevToolsOpenDocked, False)
62 self.ApplyAccelerator(pyauto.IDC_DEV_TOOLS)
63 self.assertEqual(2, self.GetBrowserWindowCount(),
64 msg='DevTools window is not open.')
65 self.RunCommand(pyauto.IDC_CLOSE_WINDOW, 1)
66
67 # Open Javascript Console.
68 self.ApplyAccelerator(pyauto.IDC_DEV_TOOLS_CONSOLE)
69 self.assertEqual(2, self.GetBrowserWindowCount(),
70 msg='DevTools console is not open.')
71 self.RunCommand(pyauto.IDC_CLOSE_WINDOW, 1)
72
73 # Open History.
74 self.RunCommand(pyauto.IDC_SHOW_HISTORY)
75 self.assertEqual('History', self.GetActiveTabTitle(),
76 msg='History page was not opened.')
77 self.RunCommand(pyauto.IDC_CLOSE_TAB)
78
79 # Open Downloads.
80 self.RunCommand(pyauto.IDC_SHOW_DOWNLOADS)
81 self.assertEqual('Downloads', self.GetActiveTabTitle(),
82 msg='Downloads page was not opened.')
83 self.RunCommand(pyauto.IDC_CLOSE_TAB)
84
85 # Open Help page.
86 self.ApplyAccelerator(pyauto.IDC_HELP_PAGE)
87 self.assertTrue(self.WaitUntil(lambda: self.GetActiveTabTitle(),
88 expect_retval='Google Chrome Help'),
89 msg='Google Chrome help page has not opened.')
90 self.RunCommand(pyauto.IDC_CLOSE_TAB)
91
92
93 if __name__ == '__main__':
94 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