Index: chrome/test/functional/instant.py |
diff --git a/chrome/test/functional/instant.py b/chrome/test/functional/instant.py |
index 66817f5c74821ff56d1c669926b7c483d201d8bd..48829aab4e5983fb4b1ba4d32682df8c5fe84f53 100755 |
--- a/chrome/test/functional/instant.py |
+++ b/chrome/test/functional/instant.py |
@@ -9,7 +9,6 @@ import os |
import pyauto_functional # Must be imported before pyauto |
import pyauto |
- |
class InstantSettingsTest(pyauto.PyUITest): |
"""Test Chrome Instant settings.""" |
@@ -18,19 +17,21 @@ class InstantSettingsTest(pyauto.PyUITest): |
Check if the setting can be enabled and disabled.""" |
self.assertFalse(self.GetPrefsInfo().Prefs(pyauto.kInstantEnabled), |
msg='Instant is enabled by default.') |
- # Enable instant. |
- self.AppendSwitchASCIIToCommandLine('instant-field-trial', 'instant'); |
+ |
+ # Enable Instant. |
self.SetPrefs(pyauto.kInstantEnabled, True) |
self.assertTrue(self.GetPrefsInfo().Prefs(pyauto.kInstantEnabled), |
msg='Instant is not enabled.') |
+ |
+ # Make sure Instant works. |
self.SetOmniboxText('google') |
self.assertTrue(self.WaitUntil( |
lambda: self.GetInstantInfo().get('current') and not |
self.GetInstantInfo().get('loading'))) |
title = self.GetInstantInfo()['title'] |
self.assertEqual('Google', title, msg='Instant did not load.') |
+ |
# Disable Instant. |
- self.AppendSwitchASCIIToCommandLine('instant-field-trial', 'disabled'); |
self.SetPrefs(pyauto.kInstantEnabled, False) |
self.assertFalse(self.GetInstantInfo()['enabled'], |
msg='Instant is not disabled.') |
@@ -41,7 +42,6 @@ class InstantTest(pyauto.PyUITest): |
def setUp(self): |
pyauto.PyUITest.setUp(self) |
- self.AppendSwitchASCIIToCommandLine('instant-field-trial', 'instant'); |
self.SetPrefs(pyauto.kInstantEnabled, True) |
def _DoneLoading(self): |
@@ -64,9 +64,9 @@ class InstantTest(pyauto.PyUITest): |
return True |
return False |
- def testInstantNavigation(self): |
- """Test that instant navigates based on omnibox input.""" |
- # Initiate instant search (at default google.com). |
+ def testInstantLoadsSearchResults(self): |
+ """Test that Instant loads search results based on omnibox input.""" |
+ # Initiate Instant search (at default google.com). |
self.SetOmniboxText('chrome instant') |
self.assertTrue(self.WaitUntil(self._DoneLoading)) |
location = self.GetInstantInfo()['location'] |
@@ -74,74 +74,74 @@ class InstantTest(pyauto.PyUITest): |
msg='No google.com in %s' % location) |
def testInstantCaseSensitivity(self): |
- """Verify that Chrome Instant results case insensitive.""" |
+ """Verify that Chrome Instant results are case insensitive.""" |
# Text in lowercase letters. |
self.SetOmniboxText('google') |
self.assertTrue(self.WaitUntil(self._DoneLoading)) |
lowercase_instant_info = self.GetInstantInfo() |
+ |
# Text in uppercase letters. |
self.SetOmniboxText('GOOGLE') |
self.assertTrue(self.WaitUntil(self._DoneLoading)) |
uppercase_instant_info = self.GetInstantInfo() |
+ |
# Check lowercase and uppercase text results are same. |
self.assertEquals(lowercase_instant_info, uppercase_instant_info, |
- msg='Lowercase and Uppercase instant info doesn\'t match') |
+ msg='Lowercase and uppercase Instant info do not match.') |
+ |
# Text in mixed case letters. |
self.SetOmniboxText('GooGle') |
self.assertTrue(self.WaitUntil(self._DoneLoading)) |
mixedcase_instant_info = self.GetInstantInfo() |
+ |
# Check mixedcase and uppercase text results are same. |
self.assertEquals(mixedcase_instant_info, uppercase_instant_info, |
- msg='Mixedcase and Uppercase instant info doesn\'t match') |
+ msg='Mixedcase and uppercase Instant info do not match.') |
- def testInstantWithSearchEngineOtherThanGoogle(self): |
- """Verify that Instant is inactive for search engines other than Google.""" |
- # Check with Yahoo!. |
+ def testInstantWithNonInstantSearchEngine(self): |
+ """Verify that Instant is inactive for non-Instant search engines.""" |
+ # Check with Yahoo!, which doesn't support Instant yet. |
self.MakeSearchEngineDefault('yahoo.com') |
self.assertFalse(self.GetInstantInfo()['active'], |
msg='Instant is active for Yahoo!') |
- # Check with Bing. |
+ |
+ # Check with Bing, which doesn't support Instant yet. |
self.MakeSearchEngineDefault('bing.com') |
self.assertFalse(self.GetInstantInfo()['active'], |
msg='Instant is active for Bing.') |
def testInstantDisabledInIncognito(self): |
- """Test that instant is disabled in Incognito mode.""" |
+ """Test that Instant is disabled in incognito mode.""" |
self.RunCommand(pyauto.IDC_NEW_INCOGNITO_WINDOW) |
self.SetOmniboxText('google', windex=1) |
self.assertFalse(self.GetInstantInfo()['active'], |
- 'Instant enabled in Incognito mode.') |
- |
- def testInstantOverlayNotStoredInHistory(self): |
- """Test that instant overlay page is not stored in history.""" |
- self.SetOmniboxText('google') |
- self.assertTrue(self.WaitUntil(self._DoneLoading)) |
- history = self.GetHistoryInfo().History() |
- self.assertEqual(0, len(history)) |
+ 'Instant enabled in incognito mode.') |
def testInstantDisabledForURLs(self): |
- """Test that instant is disabled for non-search URLs.""" |
+ """Test that Instant is disabled for non-search URLs.""" |
self.SetOmniboxText('http://www.google.com/') |
self.WaitUntilOmniboxQueryDone() |
self.assertFalse(self.GetInstantInfo()['current'], |
'Instant enabled for non-search URLs.') |
+ |
self.SetOmniboxText('google.es') |
self.WaitUntilOmniboxQueryDone() |
self.assertFalse(self.GetInstantInfo()['current'], |
'Instant enabled for non-search URLs.') |
+ |
self.SetOmniboxText(self.GetFileURLForDataPath('title2.html')) |
self.WaitUntilOmniboxQueryDone() |
self.assertFalse(self.GetInstantInfo()['current'], |
'Instant enabled for non-search URLs.') |
def testInstantDisabledForJavaScript(self): |
- """Test that instant is disabled for javascript URLs.""" |
+ """Test that Instant is disabled for JavaScript URLs.""" |
self.SetOmniboxText('javascript:') |
self.assertFalse(self.GetInstantInfo()['current'], |
- 'Instant enabled for javascript URL.') |
+ 'Instant enabled for JavaScript URL.') |
def testInstantLoadsFor100CharsLongQuery(self): |
- """Test that instant loads for search query of 100 characters.""" |
+ """Test that Instant loads for search query of 100 characters.""" |
query = 'abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz' \ |
'abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuv' |
self.assertEqual(100, len(query)) |
@@ -149,49 +149,43 @@ class InstantTest(pyauto.PyUITest): |
self.assertTrue(self.WaitUntil(self._DoneLoadingGoogleQuery, args=[query])) |
def _BringUpInstant(self): |
- """Helper function to bring up instant.""" |
+ """Helper function to bring up Instant.""" |
self.SetOmniboxText('google') |
self.assertTrue(self.WaitUntil(self._DoneLoading)) |
self.assertTrue('www.google.com' in self.GetInstantInfo()['location'], |
msg='No www.google.com in %s' % |
self.GetInstantInfo()['location']) |
+ def testInstantOverlayNotStoredInHistory(self): |
+ """Test that Instant overlay page is not stored in history.""" |
+ self._BringUpInstant() |
+ history = self.GetHistoryInfo().History() |
+ self.assertEqual(0, len(history), msg='Instant URL stored in history.') |
+ |
def testFindInCanDismissInstant(self): |
- """Test that instant preview is dismissed by find-in-page.""" |
+ """Test that Instant preview is dismissed by find-in-page.""" |
self._BringUpInstant() |
self.OpenFindInPage() |
- self.assertEqual(self.GetActiveTabTitle(), 'New Tab') |
+ self.assertFalse(self.GetInstantInfo()['current'], |
+ 'Find-in-page does not dismiss Instant.') |
def testNTPCanDismissInstant(self): |
- """Test that instant preview is dismissed by adding new tab page.""" |
+ """Test that Instant preview is dismissed by adding new tab page.""" |
self.NavigateToURL('about:blank'); |
self._BringUpInstant() |
self.AppendTab(pyauto.GURL('chrome://newtab')) |
- self.CloseTab(tab_index=1) |
- self.assertEqual(self.GetActiveTabTitle(), 'about:blank') |
+ self.assertFalse(self.GetInstantInfo()['current'], |
+ 'NTP does not dismiss Instant.') |
def testExtnPageCanDismissInstant(self): |
- """Test that instant preview is dismissed by extension page.""" |
+ """Test that Instant preview is dismissed by extension page.""" |
self._BringUpInstant() |
self.AppendTab(pyauto.GURL('chrome://extensions')) |
- self.CloseTab(tab_index=1) |
- self.assertEqual(self.GetActiveTabTitle(), 'New Tab') |
- |
- def testNewWindowCanDismissInstant(self): |
- """Test that instant preview is dismissed by New Window.""" |
- self._BringUpInstant() |
- self.OpenNewBrowserWindow(True) |
- self.CloseBrowserWindow(1) |
- self.assertEqual(self.GetActiveTabTitle(), 'New Tab') |
- |
- def testPreFetchInstantURLNotInHistory(self): |
- """Test that pre-fetched URLs are not saved in History.""" |
- self._BringUpInstant() |
- history = self.GetHistoryInfo().History() |
- self.assertFalse(history, msg='Pre-feteched URL saved in History') |
+ self.assertFalse(self.GetInstantInfo()['current'], |
+ 'Extension page does not dismiss Instant.') |
def _AssertInstantDoesNotDownloadFile(self, path): |
- """Asserts instant does not download the specified file. |
+ """Asserts Instant does not download the specified file. |
Args: |
path: Path to file. |
@@ -205,14 +199,13 @@ class InstantTest(pyauto.PyUITest): |
msg='Should not download: %s' % filepath) |
def testInstantDoesNotDownloadZipFile(self): |
- """Test that instant does not download zip file.""" |
+ """Test that Instant does not download zip file.""" |
self._AssertInstantDoesNotDownloadFile(os.path.join('zip', 'test.zip')) |
def testInstantDoesNotDownloadPDFFile(self): |
- """Test that instant does not download PDF file.""" |
+ """Test that Instant does not download PDF file.""" |
self._AssertInstantDoesNotDownloadFile(os.path.join('printing', |
'cloud_print_unittest.pdf')) |
- |
if __name__ == '__main__': |
pyauto_functional.Main() |