Index: functional/omnibox.py |
=================================================================== |
--- functional/omnibox.py (revision 69073) |
+++ 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 |
@@ -213,7 +214,7 @@ |
self.assertTrue(matches) |
# Verify there are no suggest results |
self.assertFalse([x for x in matches if x['type'] == 'search-suggest']) |
- |
+ |
Nirnimesh
2010/12/22 19:32:51
remove stray whitespace chars
|
def _CheckBookmarkResultForVariousInputs(self, url, title, windex=0): |
"""Check if we get the Bookmark for complete and partial inputs.""" |
# Check if the complete URL would get the bookmark |
@@ -232,6 +233,45 @@ |
partial_title = self._GetOmniboxMatchesFor(search_term, windex=windex) |
self._VerifyHasBookmarkResult(partial_title) |
+ def _CheckMatches(self, old_matches_len, search_text): |
Nirnimesh
2010/12/22 19:32:51
Be more descriptive with the name.
Or at least pro
|
+ 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.WaitUntil(lambda: self._CheckMatches(len(old_matches), search_text)) |
Nirnimesh
2010/12/22 19:32:51
wrap this inside self.assertTrue()
Be aware that
|
+ 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): |
Nirnimesh
2010/12/22 19:32:51
In the interest of saving time it might be useful
|
+ """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.WaitUntil(lambda: self._CheckMatches(len(old_matches), search_text), |
Nirnimesh
2010/12/22 19:32:51
wrap inside self.assertTrue
|
+ 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']] |