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 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 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 # Add an exception to allow plugins on hulu.com. | 208 # Add an exception to allow plugins on hulu.com. |
209 self.SetPrefs(pyauto.kContentSettingsPatterns, | 209 self.SetPrefs(pyauto.kContentSettingsPatterns, |
210 {'[*.]hulu.com,*': {'plugins': 1}}) | 210 {'[*.]hulu.com,*': {'plugins': 1}}) |
211 self.AppendTab(pyauto.GURL('http://www.hulu.com')) | 211 self.AppendTab(pyauto.GURL('http://www.hulu.com')) |
212 self.assertTrue(self._GetPluginPID('Shockwave Flash'), | 212 self.assertTrue(self._GetPluginPID('Shockwave Flash'), |
213 msg='No plugin process for Shockwave Flash') | 213 msg='No plugin process for Shockwave Flash') |
214 | 214 |
215 def testBlockPluginException(self): | 215 def testBlockPluginException(self): |
216 """Verify that plugins can be blocked on a domain by adding | 216 """Verify that plugins can be blocked on a domain by adding |
217 an exception(s).""" | 217 an exception(s).""" |
218 url = self.GetHttpURLForDataPath(os.path.join('plugin', | 218 url = 'http://www.hulu.com' |
219 'flash-clicktoplay.html')) | |
220 self.NavigateToURL(url) | 219 self.NavigateToURL(url) |
221 # Wait until Shockwave Flash plugin process loads. | 220 # Wait until Shockwave Flash plugin process loads. |
222 self.assertTrue(self.WaitUntil( | 221 self.assertTrue(self.WaitUntil( |
223 lambda: self._GetPluginPID('Shockwave Flash') is not None), | 222 lambda: self._GetPluginPID('Shockwave Flash') is not None), |
224 msg='No plugin process for Shockwave Flash') | 223 msg='No plugin process for Shockwave Flash') |
225 self.Kill(self._GetPluginPID('Shockwave Flash')) | 224 self.Kill(self._GetPluginPID('Shockwave Flash')) |
226 self.assertTrue(self.WaitUntil( | 225 self.assertTrue(self.WaitUntil( |
227 lambda: self._GetPluginPID('Shockwave Flash') is None), | 226 lambda: self._GetPluginPID('Shockwave Flash') is None), |
228 msg='Expected Shockwave Flash plugin to die after killing') | 227 msg='Expected Shockwave Flash plugin to die after killing') |
229 | 228 |
230 # Add an exception to block plugins on localhost. | 229 # Add an exception to block plugins on localhost. |
231 self.SetPrefs(pyauto.kContentSettingsPatterns, | 230 self.SetPrefs(pyauto.kContentSettingsPatterns, |
232 {'[*.]127.0.0.1,*': {'plugins': 2}}) | 231 {'[*.]hulu.com,*': {'plugins': 2}}) |
233 self.GetBrowserWindow(0).GetTab(0).Reload() | 232 self.GetBrowserWindow(0).GetTab(0).Reload() |
234 self.assertFalse(self._GetPluginPID('Shockwave Flash'), | 233 self.assertFalse(self._GetPluginPID('Shockwave Flash'), |
235 msg='Shockwave Flash Plug-in not blocked.') | 234 msg='Shockwave Flash Plug-in not blocked.') |
236 | 235 |
237 | 236 |
238 if __name__ == '__main__': | 237 if __name__ == '__main__': |
239 pyauto_functional.Main() | 238 pyauto_functional.Main() |
OLD | NEW |