diff options
Diffstat (limited to 'chrome/test/functional/omnibox.py')
-rw-r--r-- | chrome/test/functional/omnibox.py | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/chrome/test/functional/omnibox.py b/chrome/test/functional/omnibox.py index ad4e989..548030d 100644 --- a/chrome/test/functional/omnibox.py +++ b/chrome/test/functional/omnibox.py @@ -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 @@ class OmniboxTest(pyauto.PyUITest): 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']] |