Chromium Code Reviews| Index: functional/omnibox.py |
| =================================================================== |
| --- functional/omnibox.py (revision 66899) |
| +++ functional/omnibox.py (working copy) |
| @@ -3,10 +3,12 @@ |
| # 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 |
| import tempfile |
| +import time |
| import pyauto_functional # Must be imported before pyauto |
| import pyauto |
| @@ -213,6 +215,34 @@ |
| # Verify there are no suggest results |
| self.assertFalse([x for x in matches if x['type'] == 'search-suggest']) |
| + def testContentHisotry(self): |
| + """Verify the history page in omnibox based on content |
| + of the visited page""" |
| + search_text = "British throne" |
| + url = self.GetFileURLForPath( |
| + os.path.join(self.DataDir(), 'find_in_page', 'largepage.html')) |
| + self.AppendTab(pyauto.GURL(url)) |
| + # To store page content in the history table, Chrome needs at least |
| + # 1 sec of delay. |
| + time.sleep(1) |
|
Nirnimesh
2010/11/22 19:48:14
no sleep please. use WaitUntil
|
| + 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.""" |
| + sites = glob.glob(os.path.join(self.DataDir(), 'find_in_page', '*.html')) |
| + for site in sites: |
| + self.NavigateToURL(self.GetFileURLForPath(site)) |
| + # Chrome takes around 40 seconds to create the recent history option |
| + # in the omnibox visited urls list. |
| + time.sleep(40) |
|
Nirnimesh
2010/11/22 19:48:14
no sleep please. Use waitUntil so that you end up
|
| + matches = self._GetOmniboxMatchesFor("file") |
| + matches_description = [x for x in matches if x['type'] == |
| + 'open-history-page'] |
| + self.assertEqual(1, len(matches_description)) |
| + |
| + |
| if __name__ == '__main__': |
| pyauto_functional.Main() |