| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 | 2 |
| 3 # Copyright (c) 2010 The Chromium Authors. All rights reserved. | 3 # Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
| 5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
| 6 | 6 |
| 7 import os |
| 8 |
| 7 import pyauto_functional # Must be imported before pyauto | 9 import pyauto_functional # Must be imported before pyauto |
| 8 import pyauto | 10 import pyauto |
| 9 | 11 |
| 10 | 12 |
| 11 class InstantTest(pyauto.PyUITest): | 13 class InstantTest(pyauto.PyUITest): |
| 12 """TestCase for Omnibox Instant feature.""" | 14 """TestCase for Omnibox Instant feature.""" |
| 13 | 15 |
| 14 def setUp(self): | 16 def setUp(self): |
| 15 pyauto.PyUITest.setUp(self) | 17 pyauto.PyUITest.setUp(self) |
| 16 self.SetPrefs(pyauto.kInstantEnabled, True) | 18 self.SetPrefs(pyauto.kInstantEnabled, True) |
| (...skipping 16 matching lines...) Expand all Loading... |
| 33 self.assertTrue('google.es' in location, | 35 self.assertTrue('google.es' in location, |
| 34 msg='No google.es in %s' % location) | 36 msg='No google.es in %s' % location) |
| 35 | 37 |
| 36 # Initiate instant search (at default google.com). | 38 # Initiate instant search (at default google.com). |
| 37 self.SetOmniboxText('chrome instant') | 39 self.SetOmniboxText('chrome instant') |
| 38 self.assertTrue(self.WaitUntil(self._DoneLoading)) | 40 self.assertTrue(self.WaitUntil(self._DoneLoading)) |
| 39 location = self.GetInstantInfo()['location'] | 41 location = self.GetInstantInfo()['location'] |
| 40 self.assertTrue('google.com' in location, | 42 self.assertTrue('google.com' in location, |
| 41 msg='No google.com in %s' % location) | 43 msg='No google.com in %s' % location) |
| 42 | 44 |
| 45 def testInstantDisabledInIncognito(self): |
| 46 """Test that instant is disabled in Incognito mode.""" |
| 47 self.RunCommand(pyauto.IDC_NEW_INCOGNITO_WINDOW) |
| 48 self.SetOmniboxText('google.com', windex=1) |
| 49 self.assertFalse(self.GetInstantInfo()['active'], |
| 50 'Instant enabled in Incognito mode.') |
| 51 |
| 52 def testInstantOverlayNotStoredInHistory(self): |
| 53 """Test that instant overlay page is not stored in history.""" |
| 54 url = self.GetFileURLForPath(os.path.join(self.DataDir(), 'title2.html')) |
| 55 self.SetOmniboxText(url) |
| 56 self.assertTrue(self.WaitUntil(self._DoneLoading)) |
| 57 history = self.GetHistoryInfo().History() |
| 58 self.assertEqual(0, len(history)) |
| 59 |
| 60 def testInstantDisabledForJavaScript(self): |
| 61 """Test that instant is disabled for javascript URLs.""" |
| 62 self.SetOmniboxText('javascript:') |
| 63 self.assertFalse(self.GetInstantInfo()['active'], |
| 64 'Instant enabled for javascript URL.') |
| 65 |
| 43 | 66 |
| 44 if __name__ == '__main__': | 67 if __name__ == '__main__': |
| 45 pyauto_functional.Main() | 68 pyauto_functional.Main() |
| OLD | NEW |