| 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 pyauto_functional  # Must be imported before pyauto | 7 import pyauto_functional  # Must be imported before pyauto | 
| 8 import pyauto | 8 import pyauto | 
| 9 | 9 | 
| 10 | 10 | 
| 11 class InstantTest(pyauto.PyUITest): | 11 class InstantTest(pyauto.PyUITest): | 
| 12   """TestCase for Omnibox Instant feature.""" | 12   """TestCase for Omnibox Instant feature.""" | 
| 13 | 13 | 
| 14   def setUp(self): | 14   def setUp(self): | 
| 15     pyauto.PyUITest.setUp(self) | 15     pyauto.PyUITest.setUp(self) | 
| 16     self.SetPrefs(pyauto.kInstantEnabled, True) | 16     self.SetPrefs(pyauto.kInstantEnabled, True) | 
| 17 | 17 | 
| 18   def _DoneLoading(self): | 18   def _DoneLoading(self): | 
| 19     info = self.GetInstantInfo() | 19     info = self.GetInstantInfo() | 
| 20     return info.get('current') and not info.get('loading') | 20     return info.get('current') and not info.get('loading') | 
| 21 | 21 | 
| 22   def testInstantNavigation(self): | 22   def testInstantNavigation(self): | 
| 23     """Test that instant navigates based on omnibox input.""" | 23     """Test that instant navigates based on omnibox input.""" | 
| 24     self.SetOmniboxText('google.com') | 24     self.SetOmniboxText('google.com') | 
| 25     self.assertTrue(self.WaitUntil(self._DoneLoading)) | 25     self.assertTrue(self.WaitUntil(self._DoneLoading)) | 
| 26     location = self.GetInstantInfo()['location'] | 26     location = self.GetInstantInfo()['location'] | 
| 27     self.assertTrue(location.startswith('http://www.google.com')) | 27     self.assertTrue('google.com' in location) | 
| 28 | 28 | 
| 29     self.SetOmniboxText('bing.com') | 29     self.SetOmniboxText('bing.com') | 
| 30     self.assertTrue(self.WaitUntil(self._DoneLoading)) | 30     self.assertTrue(self.WaitUntil(self._DoneLoading)) | 
| 31     location = self.GetInstantInfo()['location'] | 31     location = self.GetInstantInfo()['location'] | 
| 32     self.assertTrue(location.startswith('http://www.bing.com')) | 32     self.assertTrue('bing.com' in location) | 
| 33 | 33 | 
| 34     # Initiate instant search (at default google.com). | 34     # Initiate instant search (at default google.com). | 
| 35     self.SetOmniboxText('instant') | 35     self.SetOmniboxText('instant') | 
| 36     self.assertTrue(self.WaitUntil(self._DoneLoading)) | 36     self.assertTrue(self.WaitUntil(self._DoneLoading)) | 
| 37     location = self.GetInstantInfo()['location'] | 37     location = self.GetInstantInfo()['location'] | 
| 38     self.assertTrue(location.startswith('http://www.google.com')) | 38     self.assertTrue('google.com' in location) | 
| 39 | 39 | 
| 40 | 40 | 
| 41 if __name__ == '__main__': | 41 if __name__ == '__main__': | 
| 42   pyauto_functional.Main() | 42   pyauto_functional.Main() | 
| OLD | NEW | 
|---|