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

Unified 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 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: functional/omnibox.py
===================================================================
--- functional/omnibox.py (revision 69906)
+++ functional/omnibox.py (working copy)
@@ -3,6 +3,7 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+import glob
import os
import re
import shutil
@@ -277,6 +278,47 @@
partial_title = self._GetOmniboxMatchesFor(search_term, windex=windex)
self._VerifyHasBookmarkResult(partial_title)
+ def _GotNewMatches(self, old_matches_len, search_text):
+ """Determines if omnibox has any new matches"""
+ new_matches = self._GetOmniboxMatchesFor(search_text)
+ if len(new_matches) > old_matches_len:
+ return True
+ return False
+
+ def testContentHisotry(self):
+ """Verify omnibox results when entering page content
+
+ Test verifies that visited page shows up in omnibox on entering page
+ content.
+ """
+ search_text = 'British throne'
+ old_matches = self._GetOmniboxMatchesFor(search_text)
+ url = self.GetFileURLForPath(
+ os.path.join(self.DataDir(), 'find_in_page', 'largepage.html'))
+ self.AppendTab(pyauto.GURL(url))
+ self.assertTrue(self.WaitUntil(lambda: self._GotNewMatches(len(old_matches),
+ search_text), timeout=1))
+ matches = self._GetOmniboxMatchesFor(search_text)
+ matches_description = [x for x in matches if x['destination_url'] == url]
+ self.assertEqual(1, len(matches_description))
+
+ def testRecentPageHistory(self):
+ """Verify that omnibox shows recent history option in the visited
+ url list."""
+ search_text = 'file'
+ sites = glob.glob(os.path.join(self.DataDir(), 'find_in_page', '*.html'))
+ for site in sites:
+ self.NavigateToURL(self.GetFileURLForPath(site))
+ old_matches = self._GetOmniboxMatchesFor(search_text)
+ # Using max timeout as 40 seconds, since expected page only shows up
+ # after 40 seconds and default timeout is less than that.
+ self.assertTrue(self.WaitUntil(
+ lambda: self._GotNewMatches(len(old_matches), search_text), timeout=40))
+ matches = self._GetOmniboxMatchesFor(search_text)
+ matches_description = [x for x in matches if x['type'] ==
+ 'open-history-page']
+ self.assertEqual(1, len(matches_description))
+
def _VerifyHasBookmarkResult(self, matches):
"""Verify that we have a bookmark result."""
matches_starred = [result for result in matches if result['starred']]
« 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