| Index: functional/instant.py
|
| ===================================================================
|
| --- functional/instant.py (revision 71508)
|
| +++ functional/instant.py (working copy)
|
| @@ -21,6 +21,16 @@
|
| info = self.GetInstantInfo()
|
| return info.get('current') and not info.get('loading')
|
|
|
| + def _CanDismissInstant(self):
|
| + test_dir = os.path.join(os.path.abspath(self.DataDir()), 'google')
|
| + file_path = os.path.join(test_dir, 'google.html')
|
| + file_url = self.GetFileURLForPath(file_path)
|
| + self.SetOmniboxText(file_url)
|
| + self.assertTrue(self.WaitUntil(self._DoneLoading))
|
| + location = self.GetInstantInfo()['location']
|
| + self.assertTrue('google.html' in location,
|
| + msg='No google.html in %s' % location)
|
| +
|
| def testInstantNavigation(self):
|
| """Test that instant navigates based on omnibox input."""
|
| self.SetOmniboxText('google.com')
|
| @@ -63,6 +73,29 @@
|
| self.assertFalse(self.GetInstantInfo()['active'],
|
| 'Instant enabled for javascript URL.')
|
|
|
| -
|
| + def testInstantCanDismiss(self):
|
| + """Test that instant preview is dismissed by
|
| + find-in-page, new tab page, extenions page, new window."""
|
| + #Test with find-in-page
|
| + self._CanDismissInstant()
|
| + self.OpenFindInPage()
|
| + self.assertEqual(self.GetActiveTabTitle(), '')
|
| + #Test with new tab page.
|
| + self._CanDismissInstant()
|
| + self.AppendTab(pyauto.GURL('chrome://newtab'))
|
| + self.RunCommand(pyauto.IDC_CLOSE_TAB)
|
| + self.assertEqual(self.GetActiveTabTitle(), '')
|
| + #Test with extensions page
|
| + self._CanDismissInstant()
|
| + self.AppendTab(pyauto.GURL('chrome://extensions'))
|
| + self.RunCommand(pyauto.IDC_CLOSE_TAB)
|
| + self.assertEqual(self.GetActiveTabTitle(), '')
|
| + #Test with new window
|
| + self._CanDismissInstant()
|
| + self.RunCommand(pyauto.IDC_NEW_WINDOW)
|
| + self.CloseBrowserWindow(1)
|
| + self.assertEqual(self.GetActiveTabTitle(), '')
|
| + self._CanDismissInstant()
|
| +
|
| if __name__ == '__main__':
|
| pyauto_functional.Main()
|
|
|