Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(643)

Unified Diff: chrome/test/pyautolib/pyauto.py

Issue 10238014: Fix search engine automation hooks to work with multiple profiles. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/automation/testing_automation_provider.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/pyautolib/pyauto.py
diff --git a/chrome/test/pyautolib/pyauto.py b/chrome/test/pyautolib/pyauto.py
index 683b8a4c75effebee230a7bde1a33ceafed2d139..03b897e191631b793630a53d75cdeaf21454c88f 100755
--- a/chrome/test/pyautolib/pyauto.py
+++ b/chrome/test/pyautolib/pyauto.py
@@ -1202,9 +1202,12 @@ class PyUITest(pyautolib.PyUITestBase, unittest.TestCase):
cmd_dict = {'command': 'GetInstantInfo'}
return self._GetResultFromJSONRequest(cmd_dict)['instant']
- def GetSearchEngineInfo(self):
+ def GetSearchEngineInfo(self, windex=0):
"""Return info about search engines.
+ Args:
+ window_index: The window index, default is 0.
dennis_jeffrey 2012/04/26 20:42:44 'window_index' --> 'windex'
+
Returns:
An ordered list of dictionaries describing info about each search engine.
@@ -1231,11 +1234,13 @@ class PyUITest(pyautolib.PyUITestBase, unittest.TestCase):
u'url': u'http://search.yahoo.com/search?p={searchTerms}'},
"""
# Ensure that the search engine profile is loaded into data model.
- self._GetResultFromJSONRequest({'command': 'LoadSearchEngineInfo'})
+ self._GetResultFromJSONRequest({'command': 'LoadSearchEngineInfo'},
+ windex=windex)
cmd_dict = {'command': 'GetSearchEngineInfo'}
- return self._GetResultFromJSONRequest(cmd_dict)['search_engines']
+ return self._GetResultFromJSONRequest(
+ cmd_dict, windex=windex)['search_engines']
- def AddSearchEngine(self, title, keyword, url):
+ def AddSearchEngine(self, title, keyword, url, windex=0):
"""Add a search engine, as done through the search engines UI.
Args:
@@ -1243,16 +1248,19 @@ class PyUITest(pyautolib.PyUITestBase, unittest.TestCase):
keyword: keyword, used to initiate a custom search from omnibox.
url: url template for this search engine's query.
'%s' is replaced by search query string when used to search.
+ window_index: The window index, default is 0.
dennis_jeffrey 2012/04/26 20:42:44 'window_index' --> 'windex'
"""
# Ensure that the search engine profile is loaded into data model.
- self._GetResultFromJSONRequest({'command': 'LoadSearchEngineInfo'})
+ self._GetResultFromJSONRequest({'command': 'LoadSearchEngineInfo'},
+ windex=windex)
cmd_dict = {'command': 'AddOrEditSearchEngine',
'new_title': title,
'new_keyword': keyword,
'new_url': url}
- self._GetResultFromJSONRequest(cmd_dict)
+ self._GetResultFromJSONRequest(cmd_dict, windex=windex)
- def EditSearchEngine(self, keyword, new_title, new_keyword, new_url):
+ def EditSearchEngine(self, keyword, new_title, new_keyword, new_url,
+ windex=0):
"""Edit info for existing search engine.
Args:
@@ -1260,39 +1268,45 @@ class PyUITest(pyautolib.PyUITestBase, unittest.TestCase):
new_title: new name for this search engine.
new_keyword: new keyword for this search engine.
new_url: new url for this search engine.
+ window_index: The window index, default is 0.
dennis_jeffrey 2012/04/26 20:42:44 'window_index' --> 'windex'
"""
# Ensure that the search engine profile is loaded into data model.
- self._GetResultFromJSONRequest({'command': 'LoadSearchEngineInfo'})
+ self._GetResultFromJSONRequest({'command': 'LoadSearchEngineInfo'},
+ windex=windex)
cmd_dict = {'command': 'AddOrEditSearchEngine',
'keyword': keyword,
'new_title': new_title,
'new_keyword': new_keyword,
'new_url': new_url}
- self._GetResultFromJSONRequest(cmd_dict)
+ self._GetResultFromJSONRequest(cmd_dict, windex=windex)
- def DeleteSearchEngine(self, keyword):
+ def DeleteSearchEngine(self, keyword, windex=0):
"""Delete search engine with given keyword.
Args:
keyword: the keyword string of the search engine to delete.
+ window_index: The window index, default is 0.
dennis_jeffrey 2012/04/26 20:42:44 'window_index' --> 'windex'
"""
# Ensure that the search engine profile is loaded into data model.
- self._GetResultFromJSONRequest({'command': 'LoadSearchEngineInfo'})
+ self._GetResultFromJSONRequest({'command': 'LoadSearchEngineInfo'},
+ windex=windex)
cmd_dict = {'command': 'PerformActionOnSearchEngine', 'keyword': keyword,
'action': 'delete'}
- self._GetResultFromJSONRequest(cmd_dict)
+ self._GetResultFromJSONRequest(cmd_dict, windex=windex)
- def MakeSearchEngineDefault(self, keyword):
+ def MakeSearchEngineDefault(self, keyword, windex=0):
"""Make search engine with given keyword the default search.
Args:
keyword: the keyword string of the search engine to make default.
+ window_index: The window index, default is 0.
dennis_jeffrey 2012/04/26 20:42:44 'window_index' --> 'windex'
"""
# Ensure that the search engine profile is loaded into data model.
- self._GetResultFromJSONRequest({'command': 'LoadSearchEngineInfo'})
+ self._GetResultFromJSONRequest({'command': 'LoadSearchEngineInfo'},
+ windex=windex)
cmd_dict = {'command': 'PerformActionOnSearchEngine', 'keyword': keyword,
'action': 'default'}
- self._GetResultFromJSONRequest(cmd_dict)
+ self._GetResultFromJSONRequest(cmd_dict, windex)
dennis_jeffrey 2012/04/26 20:42:44 windex=windex
def _EnsureProtectorCheck(self):
"""Ensure that Protector check for changed settings has been performed in
« no previous file with comments | « chrome/browser/automation/testing_automation_provider.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698