summaryrefslogtreecommitdiffstats
path: root/chrome/test/functional
diff options
context:
space:
mode:
authorivankr@chromium.org <ivankr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-01-25 19:14:32 +0000
committerivankr@chromium.org <ivankr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-01-25 19:14:32 +0000
commit135494bd600172940ea911a2c203305e55ffda08 (patch)
tree95d79f638cfeb8407488cee02adf821ee6a2af6c /chrome/test/functional
parent035ff7a8dab0d71e218527a15588e642d56116dd (diff)
downloadchromium_src-135494bd600172940ea911a2c203305e55ffda08.zip
chromium_src-135494bd600172940ea911a2c203305e55ffda08.tar.gz
chromium_src-135494bd600172940ea911a2c203305e55ffda08.tar.bz2
Added Protector functional test for default search engine edited by user while showing the bubble.
BUG=None TEST=functional:protector.py Review URL: http://codereview.chromium.org/9129018 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@119097 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test/functional')
-rw-r--r--chrome/test/functional/protector.py43
1 files changed, 32 insertions, 11 deletions
diff --git a/chrome/test/functional/protector.py b/chrome/test/functional/protector.py
index f5e2c4f..42862a4 100644
--- a/chrome/test/functional/protector.py
+++ b/chrome/test/functional/protector.py
@@ -23,9 +23,9 @@ class ProtectorTest(pyauto.PyUITest):
self.assertTrue(profiles['profiles'])
self._profile_path = profiles['profiles'][0]['path']
self.assertTrue(self._profile_path)
- # Set to the name of the new default search engine after a successful
+ # Set to the keyword of the new default search engine after a successful
# _GetDefaultSearchEngine call.
- self._new_default_search_name = None
+ self._new_default_search_keyword = None
def _GetDefaultSearchEngine(self):
"""Returns the default search engine, if any; None otherwise.
@@ -93,8 +93,8 @@ class ProtectorTest(pyauto.PyUITest):
def _ChangeDefaultSearchEngine(self):
"""Replaces the default search engine in Web Data database with another one.
- Name of the new default search engine is saved to
- self._new_default_search_name.
+ Keywords of the new default search engine is saved to
+ self._new_default_search_keyword.
"""
web_database = self._OpenDatabase('Web Data')
default_id = int(self._FetchSingleValue(
@@ -111,12 +111,12 @@ class ProtectorTest(pyauto.PyUITest):
self._UpdateSingleRow(web_database,
'UPDATE meta SET value = ? WHERE key = ?',
(new_default_id, self._default_search_id_key))
- self._new_default_search_name = self._FetchSingleValue(
+ self._new_default_search_keyword = self._FetchSingleValue(
web_database,
- 'SELECT short_name FROM keywords WHERE id = ?',
+ 'SELECT keyword FROM keywords WHERE id = ?',
(new_default_id,))
logging.info('Update default search ID: %d -> %d (%s)' %
- (default_id, new_default_id, self._new_default_search_name))
+ (default_id, new_default_id, self._new_default_search_keyword))
web_database.close()
def testNoChangeOnCleanProfile(self):
@@ -140,9 +140,9 @@ class ProtectorTest(pyauto.PyUITest):
# Now the search engine must have changed to the new one.
default_search = self._GetDefaultSearchEngine()
self.assertNotEqual(old_default_search, default_search)
- self.assertEqual(self._new_default_search_name,
- default_search['short_name'])
- # No longer showing the change:
+ self.assertEqual(self._new_default_search_keyword,
+ default_search['keyword'])
+ # No longer showing the change.
self.assertFalse(self.GetProtectorState()['showing_change'])
def testDetectSearchEngineChangeAndDiscard(self):
@@ -162,7 +162,28 @@ class ProtectorTest(pyauto.PyUITest):
# Old search engine remains active.
default_search = self._GetDefaultSearchEngine()
self.assertEqual(old_default_search, default_search)
- # No longer showing the change:
+ # No longer showing the change.
+ self.assertFalse(self.GetProtectorState()['showing_change'])
+
+ def testSearchEngineChangeDismissedOnEdit(self):
+ """Test that default search engine change is dismissed when default search
+ engine is changed by user.
+ """
+ # Get current search engine.
+ old_default_search = self._GetDefaultSearchEngine()
+ self.assertTrue(old_default_search)
+ # Close browser, change the search engine and start it again.
+ self.RestartBrowser(clear_profile=False,
+ pre_launch_hook=self._ChangeDefaultSearchEngine)
+ # The change must be detected by Protector.
+ self.assertTrue(self.GetProtectorState()['showing_change'])
+ # Change default search engine.
+ self.MakeSearchEngineDefault(self._new_default_search_keyword)
+ # Change is successful.
+ default_search = self._GetDefaultSearchEngine()
+ self.assertEqual(self._new_default_search_keyword,
+ default_search['keyword'])
+ # No longer showing the change.
self.assertFalse(self.GetProtectorState()['showing_change'])