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

Side by Side Diff: chrome/test/functional/navigation.py

Issue 10891032: Remove the navigation pyauto test. It duplicates existing chrome tests. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 3 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 | « chrome/test/functional/PYAUTO_TESTS ('k') | 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/env 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 os
7
8 import pyauto_functional # Must be imported before pyauto
9 import pyauto
10
11
12 class NavigationTest(pyauto.PyUITest):
13 """TestCase for Navigation."""
14
15 def _ObtainURLList(self):
16 """Get a list of file:// urls for use in this test case."""
17 urls = []
18 for fname in ['title1.html', 'title2.html', 'title3.html']:
19 urls.append(self.GetFileURLForPath(os.path.join(self.DataDir(), fname)))
20 return urls
21
22 def _OpenTabsInWindow(self, urls, windex):
23 """Open, verify given urls in the window at the given index."""
24 for url in self._ObtainURLList():
25 self.AppendTab(pyauto.GURL(url), windex)
26 self.assertEqual(url, self.GetActiveTabURL(windex).spec())
27 self.assertEqual(len(urls) + 1, self.GetTabCount(windex))
28 for i in range(len(urls)):
29 self.ActivateTab(i + 1, windex) # ignore first tab
30 self.assertEqual(self.GetActiveTabURL(windex).spec(), urls[i])
31
32 def testMultipleTabsAndWindows(self):
33 """Verify multiple tabs and windows."""
34 self.assertEqual(1, self.GetBrowserWindowCount())
35 urls = self._ObtainURLList()
36 self._OpenTabsInWindow(urls, 0)
37 more_windows = 3
38 for windex in range(1, more_windows + 1):
39 self.OpenNewBrowserWindow(True)
40 self.assertEqual(1 + windex, self.GetBrowserWindowCount())
41 self._OpenTabsInWindow(urls, windex)
42
43 def testTabsOpenClose(self):
44 """Verify tabs open/close."""
45 urls = self._ObtainURLList()
46 def _OpenCloseTabsInWindow(windex):
47 """Open/close tabs in window at given index."""
48 self.AppendTab(pyauto.GURL(urls[0]), windex)
49 self.assertEqual(2, self.GetTabCount(windex))
50 self.AppendTab(pyauto.GURL(urls[1]), windex)
51 self.assertEqual(3, self.GetTabCount(windex))
52 self.CloseTab(tab_index=2, windex=windex)
53 self.assertEqual(2, self.GetTabCount(windex))
54 self.CloseTab(tab_index=1, windex=windex)
55 self.assertEqual(1, self.GetTabCount(windex))
56 _OpenCloseTabsInWindow(0)
57 self.OpenNewBrowserWindow(True)
58 _OpenCloseTabsInWindow(1)
59
60 def testForwardBackward(self):
61 """Verify forward/backward actions."""
62 urls = self._ObtainURLList()
63 assert len(urls) >= 3, 'Need at least 3 urls.'
64 for url in urls:
65 self.NavigateToURL(url)
66 self.assertEqual(self.GetActiveTabURL().spec(), urls[-1])
67 for i in [-2, -3]:
68 self.TabGoBack()
69 self.assertEqual(self.GetActiveTabURL().spec(), urls[i])
70 for i in [-2, -1]:
71 self.TabGoForward()
72 self.assertEqual(self.GetActiveTabURL().spec(), urls[i])
73
74 def testCanDuplicateTab(self):
75 """Open a page, duplicate it and make sure the new tab was duplicated"""
76 urls = self._ObtainURLList()
77 assert len(urls) >= 3, 'Need at least 3 urls.'
78 self.NavigateToURL(urls[0])
79 self.ApplyAccelerator(pyauto.IDC_DUPLICATE_TAB)
80 self.assertEqual(self.GetTabCount(), 2)
81 self.assertEqual(urls[0], self.GetActiveTabURL().spec())
82
83 def testBrutalTabsAndWindows(self):
84 """Open "many" windows and tabs."""
85 urls = self._ObtainURLList()
86 num_windows = 10
87 orig_num_windows = self.GetBrowserWindowCount()
88 for windex in range(1, num_windows):
89 self.OpenNewBrowserWindow(True)
90 self.assertEqual(orig_num_windows + windex, self.GetBrowserWindowCount())
91 # Open many tabs in 1st window
92 num_tabs = 20
93 orig_num_tabs = self.GetTabCount(windex)
94 for tindex in range(1, num_tabs):
95 self.AppendTab(pyauto.GURL(urls[0]))
96 self.assertEqual(orig_num_tabs + tindex, self.GetTabCount())
97
98
99 if __name__ == '__main__':
100 pyauto_functional.Main()
OLDNEW
« no previous file with comments | « chrome/test/functional/PYAUTO_TESTS ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698