| 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('google.com' in location) | 27 self.assertTrue('google.com' in location, |
| 28 msg='No google.com in %s' % location) |
| 28 | 29 |
| 29 self.SetOmniboxText('bing.com') | 30 self.SetOmniboxText('search.yahoo.com') |
| 30 self.assertTrue(self.WaitUntil(self._DoneLoading)) | 31 self.assertTrue(self.WaitUntil(self._DoneLoading)) |
| 31 location = self.GetInstantInfo()['location'] | 32 location = self.GetInstantInfo()['location'] |
| 32 self.assertTrue('bing.com' in location) | 33 self.assertTrue('search.yahoo.com' in location, |
| 34 msg='No search.yahoo.com in %s' % location) |
| 33 | 35 |
| 34 # Initiate instant search (at default google.com). | 36 # Initiate instant search (at default google.com). |
| 35 self.SetOmniboxText('instant') | 37 self.SetOmniboxText('chrome instant') |
| 36 self.assertTrue(self.WaitUntil(self._DoneLoading)) | 38 self.assertTrue(self.WaitUntil(self._DoneLoading)) |
| 37 location = self.GetInstantInfo()['location'] | 39 location = self.GetInstantInfo()['location'] |
| 38 self.assertTrue('google.com' in location) | 40 self.assertTrue('google.com' in location, |
| 41 msg='No google.com in %s' % location) |
| 39 | 42 |
| 40 | 43 |
| 41 if __name__ == '__main__': | 44 if __name__ == '__main__': |
| 42 pyauto_functional.Main() | 45 pyauto_functional.Main() |
| OLD | NEW |