summaryrefslogtreecommitdiffstats
path: root/chrome/test/functional
diff options
context:
space:
mode:
authornirnimesh@chromium.org <nirnimesh@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-22 23:45:28 +0000
committernirnimesh@chromium.org <nirnimesh@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-22 23:45:28 +0000
commit89b5be66796464834f9fef22017a99a2c1ccc814 (patch)
tree6caa12bc4adc4d3f984ce214dd23167877d3afe1 /chrome/test/functional
parent88f3d9b066a57b983ebfce4f0eaa4bfe8cd0d71e (diff)
downloadchromium_src-89b5be66796464834f9fef22017a99a2c1ccc814.zip
chromium_src-89b5be66796464834f9fef22017a99a2c1ccc814.tar.gz
chromium_src-89b5be66796464834f9fef22017a99a2c1ccc814.tar.bz2
Omnibox tests for recent pages and content history
Review URL: http://codereview.chromium.org/5115007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@70002 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test/functional')
-rw-r--r--chrome/test/functional/omnibox.py42
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']]