From 745be9dc8fb77962467f39485984f349aa99ba58 Mon Sep 17 00:00:00 2001 From: "vclarke@chromium.org" Date: Thu, 15 Dec 2011 03:21:22 +0000 Subject: Fix flakiness and re-enable http search in find_in_page.FindMatchTests.testSearchInPDF Add loop to _VerifySearchInPDFURL to try FindInPage 10 times and re-raise the exception on the final loop. This is required because _GetResultFromJSONRequest appears to timeout if called before the PDF has loaded. Add timeout parameter to pyauto.FindInPage to be passed to _GetResultFromJSONRequest to speed up the loop in _VerifySearchInPDFURL from the default of 45 seconds to 1 second. Re-enable test on Mac. BUG=107448, 70927, 93956 Review URL: http://codereview.chromium.org/8913012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@114589 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/test/pyautolib/pyauto.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'chrome/test/pyautolib') diff --git a/chrome/test/pyautolib/pyauto.py b/chrome/test/pyautolib/pyauto.py index 8523e16..4ee0d5b 100755 --- a/chrome/test/pyautolib/pyauto.py +++ b/chrome/test/pyautolib/pyauto.py @@ -2663,7 +2663,7 @@ class PyUITest(pyautolib.PyUITestBase, unittest.TestCase): def FindInPage(self, search_string, forward=True, match_case=False, find_next=False, - tab_index=0, windex=0): + tab_index=0, windex=0, timeout=-1): """Find the match count for the given search string and search parameters. This is equivalent to using the find box. @@ -2673,7 +2673,8 @@ class PyUITest(pyautolib.PyUITestBase, unittest.TestCase): match_case: Boolean to set for case sensitive search. find_next: Boolean to set to continue the search or start from beginning. tab_index: The tab index, default is 0. - window_index: The window index, default is 0. + windex: The window index, default is 0. + timeout: request timeout (in milliseconds), default is -1. Returns: number of matches found for the given search string and parameters @@ -2695,7 +2696,8 @@ class PyUITest(pyautolib.PyUITestBase, unittest.TestCase): 'match_case' : match_case, 'find_next' : find_next, } - return self._GetResultFromJSONRequest(cmd_dict, windex=windex) + return self._GetResultFromJSONRequest(cmd_dict, windex=windex, + timeout=timeout) def ExecuteJavascript(self, js, tab_index=0, windex=0, frame_xpath=''): """Executes a script in the specified frame of a tab. -- cgit v1.1