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

Side by Side Diff: functional/omnibox.py

Issue 6269001: Fixing omnibox page content search test (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
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 glob
7 import os 7 import os
8 import re 8 import re
9 import shutil 9 import shutil
10 import tempfile 10 import tempfile
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 # Check if the partial URL would get the bookmark. 271 # Check if the partial URL would get the bookmark.
272 split_url = urlparse.urlsplit(url) 272 split_url = urlparse.urlsplit(url)
273 partial_url = self._GetOmniboxMatchesFor(split_url.scheme, windex=windex) 273 partial_url = self._GetOmniboxMatchesFor(split_url.scheme, windex=windex)
274 self._VerifyHasBookmarkResult(partial_url) 274 self._VerifyHasBookmarkResult(partial_url)
275 # Check if the partial title would get the bookmark. 275 # Check if the partial title would get the bookmark.
276 split_title = title.split() 276 split_title = title.split()
277 search_term = split_title[len(split_title) - 1] 277 search_term = split_title[len(split_title) - 1]
278 partial_title = self._GetOmniboxMatchesFor(search_term, windex=windex) 278 partial_title = self._GetOmniboxMatchesFor(search_term, windex=windex)
279 self._VerifyHasBookmarkResult(partial_title) 279 self._VerifyHasBookmarkResult(partial_title)
280 280
281 def _GotNewMatches(self, old_matches_len, search_text): 281 def _GotContentHistory(self, search_text, url):
282 """Determines if omnibox has any new matches""" 282 """Determines if omnibox returns a visited page when searching using page
Nirnimesh 2011/01/14 19:49:57 s/visited/previously visited/
Nirnimesh 2011/01/14 19:49:57 Simplify this sentence. I don't understand it.
283 content"""
283 # Omnibox doesn't change results if searching the same text repeatedly. 284 # Omnibox doesn't change results if searching the same text repeatedly.
284 # So setting '' in omnibox before the next repeated search. 285 # So setting '' in omnibox before the next repeated search.
285 self.SetOmniboxText('') 286 self.SetOmniboxText('')
286 new_matches = self._GetOmniboxMatchesFor(search_text) 287 matches = self._GetOmniboxMatchesFor(search_text)
287 if len(new_matches) > old_matches_len: 288 matches_description = [x for x in matches if x['destination_url'] == url]
288 return True 289 return 1 == len(matches_description)
289 return False
290 290
291 def testContentHistory(self): 291 def testContentHistory(self):
292 """Verify omnibox results when entering page content 292 """Verify omnibox results when entering page content
293 293
294 Test verifies that visited page shows up in omnibox on entering page 294 Test verifies that visited page shows up in omnibox on entering page
295 content. 295 content.
296 """ 296 """
297 search_text = 'British throne' 297 search_text = 'British throne'
sunandt 2011/01/13 02:18:54 You don't need this variable. Pass this value dire
298 old_matches = self._GetOmniboxMatchesFor(search_text)
299 url = self.GetFileURLForPath( 298 url = self.GetFileURLForPath(
300 os.path.join(self.DataDir(), 'find_in_page', 'largepage.html')) 299 os.path.join(self.DataDir(), 'find_in_page', 'largepage.html'))
301 self.AppendTab(pyauto.GURL(url)) 300 self.AppendTab(pyauto.GURL(url))
sunandt 2011/01/13 02:18:54 Why are you opening a new tab?
302 self.assertTrue(self.WaitUntil(lambda: self._GotNewMatches(len(old_matches), 301 self.assertTrue(self.WaitUntil(
303 search_text), timeout=1)) 302 lambda: self._GotContentHistory(search_text, url)))
304 matches = self._GetOmniboxMatchesFor(search_text)
305 matches_description = [x for x in matches if x['destination_url'] == url]
306 self.assertEqual(1, len(matches_description))
307 303
308 def _GotHistoryPageOption(self, search_text): 304 def _GotHistoryPageOption(self, search_text):
309 """Determines if omnibox returns an 'open history page' option for given 305 """Determines if omnibox returns an 'open history page' option for given
310 search text""" 306 search text"""
311 # Omnibox doesn't change results if searching the same text repeatedly. 307 # Omnibox doesn't change results if searching the same text repeatedly.
312 # So setting '' in omnibox before the next repeated search. 308 # So setting '' in omnibox before the next repeated search.
313 self.SetOmniboxText('') 309 self.SetOmniboxText('')
314 matches = self._GetOmniboxMatchesFor(search_text) 310 matches = self._GetOmniboxMatchesFor(search_text)
315 matches_description = [x for x in matches if x['type'] == 311 matches_description = [x for x in matches if x['type'] ==
316 'open-history-page'] 312 'open-history-page']
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 self.NavigateToURL(url, 1, 0) 351 self.NavigateToURL(url, 1, 0)
356 self._CheckBookmarkResultForVariousInputs(url, title, windex=1) 352 self._CheckBookmarkResultForVariousInputs(url, title, windex=1)
357 self.RunCommand(pyauto.IDC_NEW_INCOGNITO_WINDOW) 353 self.RunCommand(pyauto.IDC_NEW_INCOGNITO_WINDOW)
358 self.assertEqual(3, self.GetBrowserWindowCount()) 354 self.assertEqual(3, self.GetBrowserWindowCount())
359 self.NavigateToURL(url, 2, 0) 355 self.NavigateToURL(url, 2, 0)
360 self._CheckBookmarkResultForVariousInputs(url, title, windex=2) 356 self._CheckBookmarkResultForVariousInputs(url, title, windex=2)
361 357
362 358
363 if __name__ == '__main__': 359 if __name__ == '__main__':
364 pyauto_functional.Main() 360 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