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

Side by Side Diff: functional/omnibox.py

Issue 5115007: Omnibox tests for,... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/chrome/test/
Patch Set: '' Created 10 years, 1 month 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 # 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 glob
6 import os 7 import os
7 import re 8 import re
8 import shutil 9 import shutil
9 import tempfile 10 import tempfile
11 import time
10 12
11 import pyauto_functional # Must be imported before pyauto 13 import pyauto_functional # Must be imported before pyauto
12 import pyauto 14 import pyauto
13 15
14 16
15 class OmniboxTest(pyauto.PyUITest): 17 class OmniboxTest(pyauto.PyUITest):
16 """TestCase for Omnibox.""" 18 """TestCase for Omnibox."""
17 19
18 def Debug(self): 20 def Debug(self):
19 """Test method for experimentation. 21 """Test method for experimentation.
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 self.assertTrue(matches) 208 self.assertTrue(matches)
207 self.assertTrue([x for x in matches if x['type'] == 'search-suggest']) 209 self.assertTrue([x for x in matches if x['type'] == 'search-suggest'])
208 # Disable suggest-service 210 # Disable suggest-service
209 self.SetPrefs(pyauto.kSearchSuggestEnabled, False) 211 self.SetPrefs(pyauto.kSearchSuggestEnabled, False)
210 self.assertFalse(self.GetPrefsInfo().Prefs(pyauto.kSearchSuggestEnabled)) 212 self.assertFalse(self.GetPrefsInfo().Prefs(pyauto.kSearchSuggestEnabled))
211 matches = self._GetOmniboxMatchesFor('apple') 213 matches = self._GetOmniboxMatchesFor('apple')
212 self.assertTrue(matches) 214 self.assertTrue(matches)
213 # Verify there are no suggest results 215 # Verify there are no suggest results
214 self.assertFalse([x for x in matches if x['type'] == 'search-suggest']) 216 self.assertFalse([x for x in matches if x['type'] == 'search-suggest'])
215 217
218 def testContentHisotry(self):
219 """Verify the history page in omnibox based on content
220 of the visited page"""
221 search_text = "British throne"
222 url = self.GetFileURLForPath(
223 os.path.join(self.DataDir(), 'find_in_page', 'largepage.html'))
224 self.AppendTab(pyauto.GURL(url))
225 # To store page content in the history table, Chrome needs at least
226 # 1 sec of delay.
227 time.sleep(1)
Nirnimesh 2010/11/22 19:48:14 no sleep please. use WaitUntil
228 matches = self._GetOmniboxMatchesFor(search_text)
229 matches_description = [x for x in matches if x['destination_url'] == url]
230 self.assertEqual(1, len(matches_description))
231
232 def testRecentPageHistory(self):
233 """Verify that omnibox shows recent history option in the visited
234 url list."""
235 sites = glob.glob(os.path.join(self.DataDir(), 'find_in_page', '*.html'))
236 for site in sites:
237 self.NavigateToURL(self.GetFileURLForPath(site))
238 # Chrome takes around 40 seconds to create the recent history option
239 # in the omnibox visited urls list.
240 time.sleep(40)
Nirnimesh 2010/11/22 19:48:14 no sleep please. Use waitUntil so that you end up
241 matches = self._GetOmniboxMatchesFor("file")
242 matches_description = [x for x in matches if x['type'] ==
243 'open-history-page']
244 self.assertEqual(1, len(matches_description))
245
216 246
217 if __name__ == '__main__': 247 if __name__ == '__main__':
218 pyauto_functional.Main() 248 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