From 465ef4fdb56d933c00c9939aebfe891ae6c8ec79 Mon Sep 17 00:00:00 2001 From: "nirnimesh@chromium.org" Date: Thu, 23 Dec 2010 22:34:18 +0000 Subject: Setting omnibox string to '' for WaitUntil waiting Review URL: http://codereview.chromium.org/6038003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@70109 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/test/functional/omnibox.py | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/chrome/test/functional/omnibox.py b/chrome/test/functional/omnibox.py index 548030d..fa716ca 100644 --- a/chrome/test/functional/omnibox.py +++ b/chrome/test/functional/omnibox.py @@ -280,14 +280,19 @@ class OmniboxTest(pyauto.PyUITest): def _GotNewMatches(self, old_matches_len, search_text): """Determines if omnibox has any new matches""" - new_matches = self._GetOmniboxMatchesFor(search_text) + # On Windows, omnibox doesn't change results if searching the same text + # repeatedly. So setting '' in omnibox before any search for non-Mac + # platforms. + if not self.IsMac(): + self.SetOmniboxText('') + new_matches = self._GetOmniboxMatchesFor(search_text) if len(new_matches) > old_matches_len: return True return False - def testContentHisotry(self): + def testContentHistory(self): """Verify omnibox results when entering page content - + Test verifies that visited page shows up in omnibox on entering page content. """ @@ -306,14 +311,16 @@ class OmniboxTest(pyauto.PyUITest): """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')) + 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. + # Using max timeout as 60 seconds, since expected page only shows up + # after 60 seconds and default timeout is less than that. + # TODO (Nirnimesh): design an api using which we can push history changes to + # omnibox results. self.assertTrue(self.WaitUntil( - lambda: self._GotNewMatches(len(old_matches), search_text), timeout=40)) + lambda: self._GotNewMatches(len(old_matches), search_text), timeout=60)) matches = self._GetOmniboxMatchesFor(search_text) matches_description = [x for x in matches if x['type'] == 'open-history-page'] -- cgit v1.1