Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 | 2 |
| 3 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 3 # Copyright (c) 2011 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 cgi | 7 import cgi |
| 8 import os | 8 import os |
| 9 | 9 |
| 10 import pyauto_functional # Must be imported before pyauto | 10 import pyauto_functional # Must be imported before pyauto |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 185 self.GetBrowserWindow(0).GetTab(1).Close(True) | 185 self.GetBrowserWindow(0).GetTab(1).Close(True) |
| 186 self.assertEqual(self.GetActiveTabTitle(), 'about:blank') | 186 self.assertEqual(self.GetActiveTabTitle(), 'about:blank') |
| 187 | 187 |
| 188 def testNewWindowCanDismissInstant(self): | 188 def testNewWindowCanDismissInstant(self): |
| 189 """Test that instant preview is dismissed by New Window.""" | 189 """Test that instant preview is dismissed by New Window.""" |
| 190 self._BringUpInstant() | 190 self._BringUpInstant() |
| 191 self.OpenNewBrowserWindow(True) | 191 self.OpenNewBrowserWindow(True) |
| 192 self.CloseBrowserWindow(1) | 192 self.CloseBrowserWindow(1) |
| 193 self.assertEqual(self.GetActiveTabTitle(), 'about:blank') | 193 self.assertEqual(self.GetActiveTabTitle(), 'about:blank') |
| 194 | 194 |
| 195 def testPreFetchInstantURLNotInHistory(self): | |
| 196 """Test that pre-fetched URL not saved in History.""" | |
|
Nirnimesh
2011/05/20 02:02:03
s/not/are not/
dyu1
2011/05/20 04:19:06
Done.
| |
| 197 self._BringUpInstant() | |
| 198 raw_input() | |
|
Nirnimesh
2011/05/20 02:02:03
remove
dyu1
2011/05/20 04:19:06
Done.
| |
| 199 history = self.GetHistoryInfo().History() | |
| 200 print history | |
|
Nirnimesh
2011/05/20 02:02:03
remove
dyu1
2011/05/20 04:19:06
Done.
| |
| 201 self.assertFalse(history, msg='Pre-feteched URL saved in History') | |
| 202 | |
| 203 def testPreFetchInstantURLGeneratesNoPopups(self): | |
| 204 """Test that pre-fetched URL does not generate pop-ups.""" | |
|
Nirnimesh
2011/05/20 02:02:03
s/pop-ups/popups/
dyu1
2011/05/20 04:19:06
Done.
| |
| 205 # Set an exception to allow popups from www.popuptest.com. | |
| 206 value = {'[*.]www.popuptest.com': {'popups': 1}} | |
| 207 self.SetPrefs(pyauto.kContentSettingsPatterns, value) | |
| 208 self.SetOmniboxText('http://www.popuptest.com/popuptest1.html') | |
|
Nirnimesh
2011/05/20 02:02:03
WaitForOmniboxQueryDone() after this line
Nirnimesh
2011/05/20 02:02:03
can we use a local http url here?
dyu1
2011/05/20 04:19:06
Done.
| |
| 209 self.assertEqual(1, self.GetBrowserWindowCount(), | |
| 210 msg='Pre-fetched URL generated popups.') | |
| 211 | |
| 212 def testPreFetchInstantURLSetsNoCookies(self): | |
| 213 """Test that pre-fetched URL does not set cookies.""" | |
| 214 http_url = 'http://www.google.com' | |
| 215 self.SetOmniboxText(http_url) | |
|
Nirnimesh
2011/05/20 02:02:03
WaitForOmniboxQueryDone() after this line
dyu1
2011/05/20 04:19:06
Done.
| |
| 216 cookie_data = self.GetCookie(pyauto.GURL(http_url)) | |
| 217 self.assertFalse(cookie_data, msg='Cookie set for pre-fetched instant URL') | |
| 218 | |
| 195 def _AssertInstantDoesNotDownloadFile(self, path): | 219 def _AssertInstantDoesNotDownloadFile(self, path): |
| 196 """Asserts instant does not download the specified file. | 220 """Asserts instant does not download the specified file. |
| 197 | 221 |
| 198 Args: | 222 Args: |
| 199 path: Path to file. | 223 path: Path to file. |
| 200 """ | 224 """ |
| 201 self.NavigateToURL('chrome://downloads') | 225 self.NavigateToURL('chrome://downloads') |
| 202 filepath = self.GetFileURLForDataPath(path) | 226 filepath = self.GetFileURLForDataPath(path) |
| 203 self.SetOmniboxText(filepath) | 227 self.SetOmniboxText(filepath) |
| 204 self.WaitUntilOmniboxQueryDone() | 228 self.WaitUntilOmniboxQueryDone() |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 240 """Test that instant loads PNG file.""" | 264 """Test that instant loads PNG file.""" |
| 241 self._AssertInstantLoadsFile(os.path.join('save_page', '1.png')) | 265 self._AssertInstantLoadsFile(os.path.join('save_page', '1.png')) |
| 242 | 266 |
| 243 def testInstantLoadsSVG(self): | 267 def testInstantLoadsSVG(self): |
| 244 """Test that instant loads SVG file.""" | 268 """Test that instant loads SVG file.""" |
| 245 self._AssertInstantLoadsFile(os.path.join('circle.svg')) | 269 self._AssertInstantLoadsFile(os.path.join('circle.svg')) |
| 246 | 270 |
| 247 | 271 |
| 248 if __name__ == '__main__': | 272 if __name__ == '__main__': |
| 249 pyauto_functional.Main() | 273 pyauto_functional.Main() |
| OLD | NEW |