| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 import cgi | 6 import cgi |
| 7 import os | 7 import os |
| 8 | 8 |
| 9 import pyauto_functional # Must be imported before pyauto | 9 import pyauto_functional # Must be imported before pyauto |
| 10 import pyauto | 10 import pyauto |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 self.SetOmniboxText('google') | 150 self.SetOmniboxText('google') |
| 151 self.assertTrue(self.WaitUntil(self._DoneLoading)) | 151 self.assertTrue(self.WaitUntil(self._DoneLoading)) |
| 152 self.assertTrue('www.google.com' in self.GetInstantInfo()['location'], | 152 self.assertTrue('www.google.com' in self.GetInstantInfo()['location'], |
| 153 msg='No www.google.com in %s' % | 153 msg='No www.google.com in %s' % |
| 154 self.GetInstantInfo()['location']) | 154 self.GetInstantInfo()['location']) |
| 155 | 155 |
| 156 def testFindInCanDismissInstant(self): | 156 def testFindInCanDismissInstant(self): |
| 157 """Test that instant preview is dismissed by find-in-page.""" | 157 """Test that instant preview is dismissed by find-in-page.""" |
| 158 self._BringUpInstant() | 158 self._BringUpInstant() |
| 159 self.OpenFindInPage() | 159 self.OpenFindInPage() |
| 160 self.assertEqual(self.GetActiveTabTitle(), 'about:blank') | 160 self.assertEqual(self.GetActiveTabTitle(), 'New Tab') |
| 161 | 161 |
| 162 def testNTPCanDismissInstant(self): | 162 def testNTPCanDismissInstant(self): |
| 163 """Test that instant preview is dismissed by adding new tab page.""" | 163 """Test that instant preview is dismissed by adding new tab page.""" |
| 164 self.NavigateToURL('about:blank'); |
| 164 self._BringUpInstant() | 165 self._BringUpInstant() |
| 165 self.AppendTab(pyauto.GURL('chrome://newtab')) | 166 self.AppendTab(pyauto.GURL('chrome://newtab')) |
| 166 self.GetBrowserWindow(0).GetTab(1).Close(True) | 167 self.GetBrowserWindow(0).GetTab(1).Close(True) |
| 167 self.assertEqual(self.GetActiveTabTitle(), 'about:blank') | 168 self.assertEqual(self.GetActiveTabTitle(), 'about:blank') |
| 168 | 169 |
| 169 def testExtnPageCanDismissInstant(self): | 170 def testExtnPageCanDismissInstant(self): |
| 170 """Test that instant preview is dismissed by extension page.""" | 171 """Test that instant preview is dismissed by extension page.""" |
| 171 self._BringUpInstant() | 172 self._BringUpInstant() |
| 172 self.AppendTab(pyauto.GURL('chrome://extensions')) | 173 self.AppendTab(pyauto.GURL('chrome://extensions')) |
| 173 self.GetBrowserWindow(0).GetTab(1).Close(True) | 174 self.GetBrowserWindow(0).GetTab(1).Close(True) |
| 174 self.assertEqual(self.GetActiveTabTitle(), 'about:blank') | 175 self.assertEqual(self.GetActiveTabTitle(), 'New Tab') |
| 175 | 176 |
| 176 def testNewWindowCanDismissInstant(self): | 177 def testNewWindowCanDismissInstant(self): |
| 177 """Test that instant preview is dismissed by New Window.""" | 178 """Test that instant preview is dismissed by New Window.""" |
| 178 self._BringUpInstant() | 179 self._BringUpInstant() |
| 179 self.OpenNewBrowserWindow(True) | 180 self.OpenNewBrowserWindow(True) |
| 180 self.CloseBrowserWindow(1) | 181 self.CloseBrowserWindow(1) |
| 181 self.assertEqual(self.GetActiveTabTitle(), 'about:blank') | 182 self.assertEqual(self.GetActiveTabTitle(), 'New Tab') |
| 182 | 183 |
| 183 def testPreFetchInstantURLNotInHistory(self): | 184 def testPreFetchInstantURLNotInHistory(self): |
| 184 """Test that pre-fetched URLs are not saved in History.""" | 185 """Test that pre-fetched URLs are not saved in History.""" |
| 185 self._BringUpInstant() | 186 self._BringUpInstant() |
| 186 history = self.GetHistoryInfo().History() | 187 history = self.GetHistoryInfo().History() |
| 187 self.assertFalse(history, msg='Pre-feteched URL saved in History') | 188 self.assertFalse(history, msg='Pre-feteched URL saved in History') |
| 188 | 189 |
| 189 def _AssertInstantDoesNotDownloadFile(self, path): | 190 def _AssertInstantDoesNotDownloadFile(self, path): |
| 190 """Asserts instant does not download the specified file. | 191 """Asserts instant does not download the specified file. |
| 191 | 192 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 205 self._AssertInstantDoesNotDownloadFile(os.path.join('zip', 'test.zip')) | 206 self._AssertInstantDoesNotDownloadFile(os.path.join('zip', 'test.zip')) |
| 206 | 207 |
| 207 def testInstantDoesNotDownloadPDFFile(self): | 208 def testInstantDoesNotDownloadPDFFile(self): |
| 208 """Test that instant does not download PDF file.""" | 209 """Test that instant does not download PDF file.""" |
| 209 self._AssertInstantDoesNotDownloadFile(os.path.join('printing', | 210 self._AssertInstantDoesNotDownloadFile(os.path.join('printing', |
| 210 'cloud_print_unittest.pdf')) | 211 'cloud_print_unittest.pdf')) |
| 211 | 212 |
| 212 | 213 |
| 213 if __name__ == '__main__': | 214 if __name__ == '__main__': |
| 214 pyauto_functional.Main() | 215 pyauto_functional.Main() |
| OLD | NEW |