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

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

Issue 7033039: Add integration tests for instant.py. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 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 | 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
1 #!/usr/bin/python 1 #!/usr/bin/python
2 2
3 # Copyright (c) 2011 The Chromium Authors. All rights reserved. 3 # Copyright (c) 2011 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 import cgi 7 import cgi
8 import os 8 import os
9 9
10 import pyauto_functional # Must be imported before pyauto 10 import pyauto_functional # Must be imported before pyauto
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 self.GetBrowserWindow(0).GetTab(1).Close(True) 185 self.GetBrowserWindow(0).GetTab(1).Close(True)
186 self.assertEqual(self.GetActiveTabTitle(), 'about:blank') 186 self.assertEqual(self.GetActiveTabTitle(), 'about:blank')
187 187
188 def testNewWindowCanDismissInstant(self): 188 def testNewWindowCanDismissInstant(self):
189 """Test that instant preview is dismissed by New Window.""" 189 """Test that instant preview is dismissed by New Window."""
190 self._BringUpInstant() 190 self._BringUpInstant()
191 self.OpenNewBrowserWindow(True) 191 self.OpenNewBrowserWindow(True)
192 self.CloseBrowserWindow(1) 192 self.CloseBrowserWindow(1)
193 self.assertEqual(self.GetActiveTabTitle(), 'about:blank') 193 self.assertEqual(self.GetActiveTabTitle(), 'about:blank')
194 194
195 def testPreFetchInstantURLNotInHistory(self):
196 """Test that pre-fetched URLs are not saved in History."""
197 self._BringUpInstant()
198 history = self.GetHistoryInfo().History()
199 self.assertFalse(history, msg='Pre-feteched URL saved in History')
200
201 def testPreFetchInstantURLGeneratesNoPopups(self):
202 """Test that pre-fetched URL does not generate popups."""
203 file_url = self.GetHttpURLForDataPath(
204 os.path.join('pyauto_private', 'popup_blocker',
Nirnimesh 2011/05/20 04:46:50 os.path.join is not needed. You can do: file_Url
205 'PopupTest1.html'))
206 # Set the preference to allow all sites to show popups.
207 self.SetPrefs(pyauto.kDefaultContentSettings, {u'popups': 1})
208 self.SetOmniboxText(file_url)
209 self.WaitUntilOmniboxQueryDone()
210 self.assertEqual(1, self.GetBrowserWindowCount(),
211 msg='Pre-fetched URL generated popups.')
212
213 def testPreFetchInstantURLSetsNoCookies(self):
214 """Test that pre-fetched URL does not set cookies."""
215 http_url = 'http://www.google.com'
Nirnimesh 2011/05/20 04:46:50 You could use cookie1.html from the data dir. It'l
216 self.SetOmniboxText(http_url)
217 self.WaitUntilOmniboxQueryDone()
218 cookie_data = self.GetCookie(pyauto.GURL(http_url))
219 self.assertFalse(cookie_data, msg='Cookie set for pre-fetched instant URL')
220
195 def _AssertInstantDoesNotDownloadFile(self, path): 221 def _AssertInstantDoesNotDownloadFile(self, path):
196 """Asserts instant does not download the specified file. 222 """Asserts instant does not download the specified file.
197 223
198 Args: 224 Args:
199 path: Path to file. 225 path: Path to file.
200 """ 226 """
201 self.NavigateToURL('chrome://downloads') 227 self.NavigateToURL('chrome://downloads')
202 filepath = self.GetFileURLForDataPath(path) 228 filepath = self.GetFileURLForDataPath(path)
203 self.SetOmniboxText(filepath) 229 self.SetOmniboxText(filepath)
204 self.WaitUntilOmniboxQueryDone() 230 self.WaitUntilOmniboxQueryDone()
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 """Test that instant loads PNG file.""" 266 """Test that instant loads PNG file."""
241 self._AssertInstantLoadsFile(os.path.join('save_page', '1.png')) 267 self._AssertInstantLoadsFile(os.path.join('save_page', '1.png'))
242 268
243 def testInstantLoadsSVG(self): 269 def testInstantLoadsSVG(self):
244 """Test that instant loads SVG file.""" 270 """Test that instant loads SVG file."""
245 self._AssertInstantLoadsFile(os.path.join('circle.svg')) 271 self._AssertInstantLoadsFile(os.path.join('circle.svg'))
246 272
247 273
248 if __name__ == '__main__': 274 if __name__ == '__main__':
249 pyauto_functional.Main() 275 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