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

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

Issue 1702010: Add 2 tests for history. (Closed)
Patch Set: update Created 10 years, 7 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
« no previous file with comments | « chrome/test/functional/downloads.py ('k') | chrome/test/pyautolib/pyauto.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 # Copyright (c) 2010 The Chromium Authors. All rights reserved. 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 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 import os 6 import os
7 7
8 import pyauto_functional # Must be imported before pyauto 8 import pyauto_functional # Must be imported before pyauto
9 import pyauto 9 import pyauto
10 10
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 self.AppendTab(pyauto.GURL(urls[1]), 0) # window 0, tab 1 134 self.AppendTab(pyauto.GURL(urls[1]), 0) # window 0, tab 1
135 self.AppendTab(pyauto.GURL(urls[2]), 1) # window 1 135 self.AppendTab(pyauto.GURL(urls[2]), 1) # window 1
136 self.AppendTab(pyauto.GURL(urls[3]), 1) # window 1 136 self.AppendTab(pyauto.GURL(urls[3]), 1) # window 1
137 137
138 history = self.GetHistoryInfo().History() 138 history = self.GetHistoryInfo().History()
139 self.assertEqual(num_urls, len(history)) 139 self.assertEqual(num_urls, len(history))
140 # The history should be ordered most recent first. 140 # The history should be ordered most recent first.
141 for i in range(num_urls): 141 for i in range(num_urls):
142 self.assertEqual(urls[-1 - i], history[i]['url']) 142 self.assertEqual(urls[-1 - i], history[i]['url'])
143 143
144 def testDownloadNoHistory(self):
145 """Downloaded URLs should not show up in history."""
146 assert not self.GetHistoryInfo().History(), 'Expecting clean history.'
147 file_url = self.GetFileURLForPath(os.path.join(self.DataDir(), 'downloads',
148 'a_zip_file.zip'))
149 downloaded_file = os.path.join(self.GetDownloadDirectory().value(),
150 'a_zip_file.zip')
151 os.path.exists(downloaded_file) and os.remove(downloaded_file)
152 self.DownloadAndWaitForStart(file_url)
153 self.WaitForAllDownloadsToComplete()
154 os.path.exists(downloaded_file) and os.remove(downloaded_file)
155 # We shouldn't have any history
156 history = self.GetHistoryInfo().History()
157 self.assertEqual(0, len(history))
158
159 def testRedirectHistory(self):
160 """HTTP meta-refresh redirects should have separate history entries."""
161 assert not self.GetHistoryInfo().History(), 'Expecting clean history.'
162 test_dir = os.path.join(os.path.abspath(self.DataDir()), 'history')
163 file_url = self.GetFileURLForPath(os.path.join(test_dir, 'redirector.html'))
164 landing_url = self.GetFileURLForPath(os.path.join(test_dir, 'landing.html'))
165 tab = self.GetBrowserWindow(0).GetTab(0)
166 tab.NavigateToURLBlockUntilNavigationsComplete(pyauto.GURL(file_url), 2)
167 self.assertEqual(landing_url, self.GetActiveTabURL().spec())
168 # We should have two history items
169 history = self.GetHistoryInfo().History()
170 self.assertEqual(2, len(history))
171 self.assertEqual(landing_url, history[0]['url'])
172
144 173
145 if __name__ == '__main__': 174 if __name__ == '__main__':
146 pyauto_functional.Main() 175 pyauto_functional.Main()
OLDNEW
« no previous file with comments | « chrome/test/functional/downloads.py ('k') | chrome/test/pyautolib/pyauto.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698