| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 # Copyright (c) 2010 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2010 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 logging | 6 import logging |
| 7 import os | 7 import os |
| 8 import re | 8 import re |
| 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 | 185 |
| 186 def testBlockPluginException(self): | 186 def testBlockPluginException(self): |
| 187 """Verify that plugins can be blocked on a domain by adding | 187 """Verify that plugins can be blocked on a domain by adding |
| 188 an exception(s).""" | 188 an exception(s).""" |
| 189 # We are using the same live site in order to detect if the web page | 189 # We are using the same live site in order to detect if the web page |
| 190 # is using shockwave flash process. | 190 # is using shockwave flash process. |
| 191 # On few test machines navigation takes more than the default time so | 191 # On few test machines navigation takes more than the default time so |
| 192 # setting 1 min of wait time here. | 192 # setting 1 min of wait time here. |
| 193 test_utils.CallFunctionWithNewTimeout(self, 1 * 60 * 1000, | 193 test_utils.CallFunctionWithNewTimeout(self, 1 * 60 * 1000, |
| 194 lambda: self.NavigateToURL('http://vimeo.com')) | 194 lambda: self.NavigateToURL('http://vimeo.com')) |
| 195 pid = self._GetPluginPID('Shockwave Flash') | 195 # Wait until Shockwave Flash plugin process loads. |
| 196 self.assertTrue(pid, msg='No plugin process for Shockwave Flash') | 196 self.assertTrue(self.WaitUntil( |
| 197 self.Kill(pid) | 197 lambda: self._GetPluginPID('Shockwave Flash') is not None), |
| 198 msg='No plugin process for Shockwave Flash') |
| 199 self.Kill(self._GetPluginPID('Shockwave Flash')) |
| 198 self.assertTrue(self.WaitUntil( | 200 self.assertTrue(self.WaitUntil( |
| 199 lambda: self._GetPluginPID('Shockwave Flash') is None), | 201 lambda: self._GetPluginPID('Shockwave Flash') is None), |
| 200 msg='Expected Shockwave Flash plugin to die after killing') | 202 msg='Expected Shockwave Flash plugin to die after killing') |
| 201 | 203 |
| 202 # Add an exception to block plugins on hulu.com. | 204 # Add an exception to block plugins on vimeo.com. |
| 203 self.SetPrefs(pyauto.kContentSettingsPatterns, | 205 self.SetPrefs(pyauto.kContentSettingsPatterns, |
| 204 {'[*.]vimeo.com': {'plugins': 2}}) | 206 {'[*.]vimeo.com': {'plugins': 2}}) |
| 205 self.GetBrowserWindow(0).GetTab(0).Reload() | 207 self.GetBrowserWindow(0).GetTab(0).Reload() |
| 206 self.assertFalse(self._GetPluginPID('Shockwave Flash'), | 208 self.assertFalse(self._GetPluginPID('Shockwave Flash'), |
| 207 msg='Plug-in not blocked.') | 209 msg='Shockwave Flash Plug-in not blocked.') |
| 208 | 210 |
| 209 | 211 |
| 210 if __name__ == '__main__': | 212 if __name__ == '__main__': |
| 211 pyauto_functional.Main() | 213 pyauto_functional.Main() |
| OLD | NEW |